MoreMathSinPi Method

Computes the sine of the given multiple of π.

Definition

Namespace: Meta.Numerics
Assembly: Meta.Numerics (in Meta.Numerics.dll) Version: 4.2.0+6d77d64445f7d5d91b12e331399c4362ecb25333
C#
public static double SinPi(
	double x
)

Parameters

x  Double
The argument.

Return Value

Double
The value of sin(xπ).

Remarks

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.

See Also