Skip to content

Commit 9a33edc

Browse files
committed
Correct sqrt initial estimate
1 parent db8091b commit 9a33edc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

big.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@
782782
if (!(c.length + e & 1)) c += '0';
783783
s = Math.sqrt(c);
784784
e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
785-
r = new Big((s == 1 / 0 ? '1e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
785+
r = new Big((s == 1 / 0 ? '5e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
786786
} else {
787787
r = new Big(s);
788788
}

big.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ P.sqrt = function () {
779779
if (!(c.length + e & 1)) c += '0';
780780
s = Math.sqrt(c);
781781
e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
782-
r = new Big((s == 1 / 0 ? '1e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
782+
r = new Big((s == 1 / 0 ? '5e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
783783
} else {
784784
r = new Big(s);
785785
}

0 commit comments

Comments
 (0)