AngouriMath

Navigation

← Back to list of members

SinAndCos​(PeterO.​Numbers.​EDecimal,​PeterO.​Numbers.​EContext)

 Method (no overloads)

Summary

The sine and the cosine of x together, each to the precision of
context: the argument reduced to [-pi, pi] and then halved
until it is below a twentieth, two Taylor series of a dozen terms there, and the
double-angle formulas back up.

Remarks

The series alone, on an argument up to pi, is sixty terms at a hundred digits
and its cost was most of a sin(x); halved six times the argument is below a
twentieth and fifteen terms are enough, and a doubling is a multiplication. Each
doubling multiplies the absolute error by about four, so the work is done with
eight digits more than asked for and rounded at the end.
The sine is its own series and not sqrt(1 - cos^2), which it was: that loses
half the digits wherever the sine is small, and sin(10^-10) came back to fifty
digits at a hundred. https://github.com/asc-community/AngouriMath/issues/1338

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 4378 pages online