Reputation: 4020
In C++, according to
Is hardcode float precise if it can be represented by binary format in IEEE 754?,
10+0.5 should be exactly equals to 10.5 without rounding because both 10,0.5 and 10.5 are exact values in IEEE 754, which is different from the case in
Is floating point math broken?
But the first question is about C++, and javascript doesn't have integer type, so I would like to know if the case about exact values also applies in javascript.
Upvotes: 1
Views: 197
Reputation: 2802
Yes. See this related answer which cites the standard specifying JS's adherence to IEEE 754.
Upvotes: 2