#21628 [NEW]: decimal numbers without decimal places
| From: | czapel at go2 dot pl | Date: | Tue, 14 Jan 2003 08:41:32 +0000 |
| Subject: | #21628 [NEW]: decimal numbers without decimal places | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-29974@lists.php.net to get a copy of this message | ||
From: czapel@go2.pl
Operating system: SuSE Linux 8.0
PHP version: 4.2.2
PHP Bug Type: *Math Functions
Bug description: decimal numbers without decimal places
I have some unexplicable problem, when I try to perform any mathematical
operation. This is my example script:
<?
echo microtime()."<br>";
$a=1.121212;
$b=2.999999;
echo gettype($a)."<br>";
echo gettype($b)."<br>";
echo bcmul($a,bcmul($b,$b,10),10)."<br>";
$c=$a*$b*$b;
echo $c;
?>
To make sure that browser doesn't read from cache I put microtime. The
problem is that sometimes as a result I get number with decimal places
(and
this is ok), but sometimes I get just integers as a result, in this case
it
is 4. Maybe somebody has already heart about that. I have no idea, how
should I lose this problem. Please, help me.
Regards
Michal
Configuration I use:
PHP 4.2.2
SuSE Linux
Apache 1.3.12
--
Edit bug report at http://bugs.php.net/?id=21628&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21628&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21628&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21628&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21628&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21628&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21628&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21628&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21628&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21628&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21628&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21628&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21628&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21628&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=21628&r=gnused