Bug #17611: float takes away zeros at the end

From: Date: Wed, 05 Jun 2002 12:40:26 +0000
Subject: Bug #17611: float takes away zeros at the end
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-9539@lists.php.net to get a copy of this message
From: fredrik.soderquist@ks.se Operating system: Linux: Debian potato PHP version: 4.2.1 PHP Bug Type: Math related Bug description: float takes away zeros at the end Sample script: <?php $a = "5.00"; $b = (float) $a; //returns 5 $c = (double) $a; //returns 5 $d = (real) $a; //returns 5 settype($a,"float"); //$a now returns 5 (gettype($a) returns double) $e = "5.01"; $f = (float) $e; //returns 5.01 (gettype($f) returns double) ?> My configure line: ./configure --prefix=/etc/php --exec-prefix=/etc/php/exec --with-sybase=/etc/freetds --with-apxs2=/etc/apache/bin/apxs --with-cpdflib=/usr/local/lib --enable-calender' Comment: In any ordanary programming langauge "float" always is a specified amount of numbers. Float in PHP seemes to remove the zeros. When I convert an interger (or any other type) to a floating number it should add the amount of zeros that are specified for the language. Ex: int a = 3; float a; a becomes 3.0. You should at least be able to convert from a string such as "5.000000" to a float without it removing the zeros after the didget! -- Edit bug report at http://bugs.php.net/?id=17611&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17611&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17611&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17611&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17611&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17611&r=support Expected behavior: http://bugs.php.net/fix.php?id=17611&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17611&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17611&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17611&r=globals

« previous php.bugs (#9539) next »