Bug #66081 [Opn->Nab]: Error with decimals
| From: | derick@php.net | Date: | Tue, 12 Nov 2013 16:21:09 +0000 |
| Subject: | Bug #66081 [Opn->Nab]: Error with decimals | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-182717@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66081&edit=1
ID: 66081
Updated by: derick@php.net
Reported by: ffernandez at sidetours dot com
Summary: Error with decimals
-Status: Open
+Status: Not a bug
Type: Bug
Package: Math related
Operating System: Windows 7
PHP Version: Irrelevant
Block user comment: N
Private report: N
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://www.floating-point-gui.de/
Thank you for your interest in PHP.
.
Previous Comments:
------------------------------------------------------------------------
[2013-11-12 16:14:23] ffernandez at sidetours dot com
Description:
------------
---
From manual page: http://www.php.net/function.ceil#refsect1-function.ceil-description
---
(36.77 * 100) == 3677
ceil(36.77 * 100) == 3678 // Should be 3677
Test script:
---------------
<?php
echo "(36.77 * 100) == ".(36.77 * 100)."<br />\n";
echo "ceil(36.77 * 100) == ".ceil(36.77 * 100)."<br />\n";
?>
Expected result:
----------------
(36.77 * 100) == 3677
ceil(36.77 * 100) == 3677
Actual result:
--------------
ceil(36.77 * 100) == 3678
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66081&edit=1