#49747 [Opn->Bgs]: floor() issue
| From: | sjoerd@php.net | Date: | Fri, 02 Oct 2009 11:30:22 +0000 |
| Subject: | #49747 [Opn->Bgs]: floor() issue | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-143181@lists.php.net to get a copy of this message | ||
ID: 49747
Updated by: sjoerd@php.net
Reported By: rajiv dot ambegaokar at oracle dot com
-Status: Open
+Status: Bogus
Bug Type: Math related
Operating System: Windows XP
PHP Version: 5.2.11
New Comment:
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.
If you would like to know more about "floats" and what IEEE
754 is, read this:
http://docs.sun.com/source/806-3568/ncg_goldberg.html
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2009-10-02 10:27:37] rajiv dot ambegaokar at oracle dot com
Description:
------------
Floor function not working properly.
Reproduce code:
---------------
<?php
$a = 43.1234 ;
$a = floor($a * 10000);
echo $a;
?>
Expected result:
----------------
431234
Actual result:
--------------
431233
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49747&edit=1