IEEE 754 requires correct rounding for numbers of this sort of size.
IEEE 754 has four rounding modes(bottom of the page.
Rounds to the nearest value, except for 5 which is equidistant, in which case it rounds to the nearest even digit.
Next higher
Next lower.
Truncate.
All are valid.
The MS CRT provides _control87 and varients to allow the user to choose which mode they require. With the default being nearest.
In the case of -95.24436542871095 (the fullest precision available from a 8-byte float), with the last digit (5) being equidistant from ...09 and ...10, it rounds to the even value. Per the spec.
In reply to Re^2: Decimal precision issue: Windows vs. Unix
by BrowserUk
in thread Decimal precision issue: Windows vs. Unix
by whakka
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |