#18978 [NEW]: mathematical bug
| From: | leocui at msn dot com | Date: | Tue, 20 Aug 2002 06:08:36 +0000 |
| Subject: | #18978 [NEW]: mathematical bug | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-17264@lists.php.net to get a copy of this message | ||
From: leocui@msn.com
Operating system: Mandrake 8.1
PHP version: 4.2.1
PHP Bug Type: *Math Functions
Bug description: mathematical bug
There is a mathematical bug in PHP 4.0.6, 4.1.2 and 4.2.1.
When I try to run the following script:
<?php
echo "20.91-20.85=";
eCho 20.91-20.85;
echo "<br>";
echo "10.33-10.23=";
echo 10.33-10.23;
echo "<br>";
echo "20.33-20.23=";
echo 20.33-20.23;
echo "<br>";
echo "21.33-21.23=";
echo 21.33-21.23;
echo "<br>";
echo "30.33-30.23=";
echo 30.33-30.23;
echo "<br>";
I got the following result,
20.91-20.85=0.059999999999999 (Wrong)
10.33-10.23=0.1 (Right)
20.33-20.23=0.099999999999998 (Wrong)
21.33-21.23=0.099999999999998 (Wrong)
30.33-30.23=0.099999999999998 (Wrong)
Obviously it¡¯s wrong.
--
Edit bug report at http://bugs.php.net/?id=18978&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=18978&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=18978&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18978&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18978&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18978&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18978&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18978&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18978&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18978&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18978&r=globals