1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2024-10-27 20:34:12 +00:00

Correct sqrt initial estimate

This commit is contained in:
Michael Mclaughlin 2020-09-28 21:58:18 +01:00
parent 11699c1d1c
commit e70384ea7e
2 changed files with 2 additions and 2 deletions

View File

@ -1728,7 +1728,7 @@
e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
if (s == 1 / 0) {
n = '1e' + e;
n = '5e' + e;
} else {
n = s.toExponential();
n = n.slice(0, n.indexOf('e') + 1) + e;

View File

@ -1724,7 +1724,7 @@ P.squareRoot = P.sqrt = function () {
e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
if (s == 1 / 0) {
n = '1e' + e;
n = '5e' + e;
} else {
n = s.toExponential();
n = n.slice(0, n.indexOf('e') + 1) + e;