#44803 [Bgs]: round()
| From: | oguzhanozbay at yahoo dot com | Date: | Wed, 23 Apr 2008 01:00:03 +0000 |
| Subject: | #44803 [Bgs]: round() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124441@lists.php.net to get a copy of this message | ||
ID: 44803
User updated by: oguzhanozbay at yahoo dot com
Reported By: oguzhanozbay at yahoo dot com
Status: Bogus
Bug Type: Unknown/Other Function
Operating System: ýss isapi & apache 2.2
PHP Version: 5.2.5
New Comment:
; The number of significant digits displayed in floating point
numbers.
precision = 14
This my php.ini precision config.
I make it 30 (and resart server) but nothing changed.
same server, same config ->
echo 60000000*(10.5);
output 6.3E+8
echo 6000000000000*10;
output 60000000000000
How can "60000000*(10.5)" need much precision than "6000000000000*10"?
Previous Comments:
------------------------------------------------------------------------
[2008-04-23 00:47:34] felipe@php.net
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.
------------------------------------------------------------------------
[2008-04-22 23:41:06] oguzhanozbay at yahoo dot com
Description:
------------
How can it be!
Reproduce code:
---------------
echo round(60000000*10.5);
output 6.3E+8 !!!
echo round(60000000*(10.5));
output 6.3E+8 !!!
echo round(60000000*(10.5),2);
output 6.3E+8 !!!
echo round(70000000*(10.5));
output 7.35E+8 !!!
echo round(70000000*(11.5),2);
output 805000000 => true
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44803&edit=1