1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2026-09-23 12:24:47 +00:00

Fix asin losing precision near x = 1

This commit is contained in:
apoorva-01
2026-07-10 00:17:54 +05:30
parent 1a6e845004
commit 02f1e51c3b
3 changed files with 10 additions and 2 deletions

View File

@@ -932,7 +932,8 @@ P.inverseSine = P.asin = function () {
Ctor.precision = pr + 6;
Ctor.rounding = 1;
x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
// See https://github.com/MikeMcl/decimal.js/issues/249
x = x.div(new Ctor(1).minus(x).times(new Ctor(1).plus(x)).sqrt().plus(1)).atan();
Ctor.precision = pr;
Ctor.rounding = rm;