Some calculation is unpredictable when add a neglect number.

RESOLVED INVALID

Status

()

Core
JavaScript Engine
--
major
RESOLVED INVALID
5 years ago
5 years ago

People

(Reporter: dindog, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
These are some results in console:
< 1.3+1.4
> 2.7

< 1.3+(-2)
> -0.7

< 1.3-2.1
> -0.8
Everything seems fines.

< 2.3- 4.23
> -1.9300000000000006
?????

The stable version of Firefox ( 22 ) is affected. Not sure is it reported or not.
(Reporter)

Comment 1

5 years ago
...oh, other browsers gave the same results, it's a false alarm? 
Sorry guys. I should have checked that before I reported. 

Would be grateful if there is somebody fill me in why it works like this.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → INVALID
This is not an issue with JavaScript, it's a limitation of how IEEE-754, the floating point format used in pretty much all computer systems, represents numbers.

See[1] and the various resources linked from there for more details.

[1]: http://stackoverflow.com/questions/588004/is-javascripts-floating-point-math-broken
You need to log in before you can comment on or make changes to this bug.