mirror of
https://github.com/MikeMcl/decimal.js.git
synced 2024-10-27 20:34:12 +00:00
use a method less prone to cancellation near x=1
This commit is contained in:
parent
e634266aad
commit
2b1298cd69
@ -744,14 +744,13 @@
|
||||
|
||||
Ctor.precision = pr + 6;
|
||||
Ctor.rounding = 1;
|
||||
|
||||
x = x.asin();
|
||||
halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
|
||||
|
||||
x = (new Ctor(1)).minus(x).div(x.plus(1)).sqrt().atan();
|
||||
|
||||
Ctor.precision = pr;
|
||||
Ctor.rounding = rm;
|
||||
|
||||
return halfPi.minus(x);
|
||||
return x.times(2);
|
||||
};
|
||||
|
||||
|
||||
|
@ -741,13 +741,12 @@ P.inverseCosine = P.acos = function () {
|
||||
Ctor.precision = pr + 6;
|
||||
Ctor.rounding = 1;
|
||||
|
||||
x = x.asin();
|
||||
halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
|
||||
x = (new Ctor(1)).minus(x).div(x.plus(1)).sqrt().atan();
|
||||
|
||||
Ctor.precision = pr;
|
||||
Ctor.rounding = rm;
|
||||
|
||||
return halfPi.minus(x);
|
||||
return x.times(2);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user