-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decimal: improve Sqrt performance & increase Float/SetFloat precision
Refactor (*Decimal).Sqrt to match the big.Float implementation (still leaving out sqrtDirect). Compared to (*big.Float).Sqrt, the target precision is slightly lower but precision increase in the Newton loop is more conservative. Instead of using a costly Float64 call to compute the initial guess, it is now directly converted from the most significant Word of the mantissa at a slight precision cost on 32 bits platforms (which causes about one more loop iteration). (*Decimal).Float and (*Decimal).SetFloat now use a higher precision when applying the exponent of five.
- Loading branch information
Showing
3 changed files
with
83 additions
and
70 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
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
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