#44255 [Com]: floating point result 0.0:
| From: | jfafard at gmail dot com | Date: | Wed, 30 Sep 2009 03:09:12 +0000 |
| Subject: | #44255 [Com]: floating point result 0.0: | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-143070@lists.php.net to get a copy of this message | ||
ID: 44255
Comment by: jfafard at gmail dot com
Reported By: php at jelmer dot cc
Status: No Feedback
Bug Type: Math related
Operating System: Linux
PHP Version: 5.2.5
New Comment:
I am also having this problem. I'm using php version 5.2.4 To
reproduce:
echo (0.08 / 0.8);
or
echo (0.04 / 0.4);
pretty much anything like this that should result in 0.1
Previous Comments:
------------------------------------------------------------------------
[2008-03-05 01:00:00] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2008-02-26 18:06:18] msaraujo@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
I have not been able to reproduce your code.
PHP 5.2.5
Linux
------------------------------------------------------------------------
[2008-02-26 17:58:53] php at jelmer dot cc
Description:
------------
Linux version 2.6.22-3-686 (Debian 2.6.22-6) (maks@debian.org) (gcc
version 4.1.3 20071019 (prerelease) (Debian 4.1.2-17)) #1 SMP Mon Nov 12
08:32:57 UTC 2007
PHP (PHP 5.2.5-2 with Suhosin-Patch 0.9.6.2 (cli) (built: Feb 1 2008
21:17:20)) returns a rather strange result for a certain mathematical
expression. Also, the weird result is only returned in very specific
cases:
php> = (0.005 + 0.002/3 + 0.194 + 0.001/3 )/2
0.0:
(notice the semicolon!)
php> = (0.004 + 0.002/3 + 0.195 + 0.001/3 )/2
0.1
php> = (0.005 + 0.194 + 0.002/3 + 0.001/3 )/2
0.1
When $result is the 'strange' result:
is_float($result) == true
is_float(0.0:) ==> syntax error
Needless to say the strange result is resulting in syntax-errors in the
code where it occurs.
Reproduce code:
---------------
print (0.005 + 0.002/3 + 0.194 + 0.001/3 )/2
Expected result:
----------------
I'd expect:
0.1
Actual result:
--------------
I'm getting:
0.0:
(notice the ':')
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44255&edit=1