-
-
Notifications
You must be signed in to change notification settings - Fork 694
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Issue 21601 - std.math : pow(float/double, -2) produces sometimes…
… wrong result (#7783) Fix Issue 21601 - std.math : pow(float/double, -2) produces sometimes wrong result merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
- Loading branch information
Showing
2 changed files
with
43 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Implementation of `pow(f, -2)` and `f ^^ -2` changed | ||
|
||
We noticed that the implementation of `pow(f, -2)` and `f ^^ -2` with | ||
`f` being a floating point value, was buggy for some values of `f`. | ||
Unfortunately the fix implies small changes for other values for `f` | ||
(with exponent `-2`) too: The least significant bits of the result might | ||
differ from the current implementation. (This is due to the | ||
peculiarities of floating point numbers and cannot be avoided with | ||
reasonable means.) | ||
|
||
To avoid problems, make sure, that your algorithms do not rely on the | ||
least significant bits of floating point calculations, for example by | ||
using `isClose` instead of `==`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters