Math387.FixAngle / FixAnglef Method

Overload List

#SignatureDescription
1Double FixAngle(Double ThetaRad)Fast angle reduction to [-Pi,Pi].
2Single FixAnglef(Single ThetaRad)

Overload 1: Double FixAngle(Double ThetaRad)

Fast angle reduction to [-Pi,Pi].

#NameTypeDescription
1ThetaRadDoublescalar

Returns: Double - Returns ThetaRad reduced to the [-Pi,Pi] interval.

Remarks:

Neither FixAngle nor Rem(x, 2*Pi) are suitable for angle reduction of large arguments. Both use the double-precision 2*Pi constant (~53 bits), so the accumulated constant error n * ulp(2*Pi) grows with magnitude: ~1e-10 rad at |x|=1e6, ~0.14 rad at |x|=1e15, meaningless above |x|=1e16. Sin, Cos and Tan handle large arguments internally using Payne-Hanek range reduction with an extended-precision 2/Pi table (hundreds of bits), which preserves full double precision regardless of input magnitude.

FixAngle should not be used before passing values to trigonometric functions. For arguments above 1E+6 it would corrupt result, and there is no performance advantage either when calling sin(FixAngle(x)) in compare to just sin(x).

Overload 2: Single FixAnglef(Single ThetaRad)

#NameTypeDescription
1ThetaRadSinglescalar

Returns: Single