ID:               39425
 User updated by:  jvano at read dot sk
 Reported By:      jvano at read dot sk
 Status:           Bogus
 Bug Type:         *General Issues
 Operating System: Irrelevant (All)
 PHP Version:      5.2.0
 New Comment:

Thanks for link and explain but don't you think that it is serious
problem? Operation is simple and common. The same problem I've found in
Java but not in C, C++, C# or Python. 

Some another solution and notice of this problem is on page:
http://www.php.net/manual/en/language.types.float.php#language.types.flo

But my question is, if this can not be solved as well as in other
languages (maybe they have similar problem but this concrete they
don't)?


Previous Comments:
------------------------------------------------------------------------

[2006-11-08 12:06:59] [EMAIL PROTECTED]

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.



------------------------------------------------------------------------

[2006-11-08 08:04:10] jvano at read dot sk

Description:
------------
Problem is in all versions of PHP.

Problem is in basic mathematic operation (+/-) wiht double. When I use
simple values and make some basic operation, for example (5.7 - (1.4 +
4.3)).

This problem is in another combinations but not in all.

Reproduce code:
---------------
<?php

echo (5.7 - (1.4 + 4.3));

?>

Expected result:
----------------
In all cases is expected 0(zero). But result is always +/-
8.881784197E-016.

Actual result:
--------------
I think that problem is in representation of double value.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39425&edit=1

Reply via email to