mirror of
https://github.com/MikeMcl/decimal.js.git
synced 2026-09-22 20:04:09 +00:00
#217 Compute acos with less cancellation near x=1
This commit is contained in:
committed by
Michael Mclaughlin
parent
7f01abd83d
commit
08e5a381d2
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user