#21658 [NEW]: Strange sprintf behaviour

From: Date: Wed, 15 Jan 2003 14:06:22 +0000
Subject: #21658 [NEW]: Strange sprintf behaviour
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-30113@lists.php.net to get a copy of this message
From:             andrea@euronia.it
Operating system: Gentoo Linux
PHP version:      4.3.0
PHP Bug Type:     *General Issues
Bug description:  Strange sprintf behaviour

mod_php 4.3.0 produce a strange sprintf behaviour

for($t=0;$t<10;$t++) {
	$r=(float) rand(0,10000)/3;
	echo $r." -> ".sprintf('%.3f',$r)."\n";
}

will produce ...

1975.33333333 -> ç.000
508.333333333 -> ,.000
2483.66666667 -> ã.000
61.6666666667 -> m.000
2514.66666667 -> I00.000
2499.66666667 -> *0.000
1957.33333333 -> ü0000.000
3167.33333333 -> 0.é00
655.666666667 -> 600.000
3321.66666667 -> ).000
2256.33333333 -> 0.S00
383.666666667 -> 0.,00
1565.33333333 -> M.000

I suppose there's something wrong with glibc 2.3.1

Any ideas?
-- 
Edit bug report at http://bugs.php.net/?id=21658&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21658&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21658&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21658&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21658&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21658&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21658&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21658&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21658&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21658&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21658&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21658&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21658&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21658&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=21658&r=gnused



Thread (4 messages)

« previous php.bugs (#30113) next »