sin_reduced Function

private elemental function sin_reduced(r) result(y)

Horner sin Taylor on |r| ≤ π/4. sin(r) = r * P(r²) where P is the odd-power polynomial in r² — avoids computing r¹, r³, r⁵… separately. 9 terms (highest power r¹⁷) gives < 1e-18 truncation error.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: r

Return Value real(kind=wp)


Called by

proc~~sin_reduced~~CalledByGraph proc~sin_reduced sin_reduced proc~safe_cos_polynomial safe_cos_polynomial proc~safe_cos_polynomial->proc~sin_reduced proc~safe_sin_polynomial safe_sin_polynomial proc~safe_sin_polynomial->proc~sin_reduced

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: p
real(kind=wp), private :: u

Source Code

   elemental function sin_reduced(r) result(y)
      !! Horner sin Taylor on |r| ≤ π/4.  `sin(r) = r * P(r²)` where
      !! P is the odd-power polynomial in r² — avoids computing r¹,
      !! r³, r⁵... separately.  9 terms (highest power r¹⁷) gives
      !! < 1e-18 truncation error.
      real(wp), intent(in) :: r
      real(wp) :: y
      real(wp) :: u, p

      u = r*r
      p = SIN_C8
      p = p*u + SIN_C7
      p = p*u + SIN_C6
      p = p*u + SIN_C5
      p = p*u + SIN_C4
      p = p*u + SIN_C3
      p = p*u + SIN_C2
      p = p*u + SIN_C1
      p = p*u + SIN_C0
      y = r*p
   end function sin_reduced