public static double SinPi(
double x
)
Public Shared Function SinPi (
x As Double
) As Double
public:
static double SinPi(
double x
)
static member SinPi :
x : float -> float
Formulas involving sin(πx) appear in many contexts. By using this method instead of Math.Sin(Math.PI * x), you will increase performance and avoid inaccuracies that arise from the finite precision of the stored constant PI.
Suppose, for example, x = 1.0E6. Since x is an integer, sin(πx) = 0.0. However, due to the finite accuracy of Math.PI, Math.PI * x is not a perfect multiple of π, and Math.Sin(Math.PI * x) = -2.2318717360358953E-10. But MoreMath.SinPi(x) = 0.0 exactly. Even for arguments that are not exact integers, the accurary of MoreMath.SinPi will be better.