Math module

sin_or_cos

procedure · 1 overloadSource

sin(x) when the compile-time flag IS_SIN is true, otherwise cos(x), for float64. Lets generic code choose at compile time.

ExampleOpen in playground ↗
assert(sin_or_cos(0.0, true) == 0 && sin_or_cos(0.0, false) == 1);
sin_or_cos :: (x: float64, $IS_SIN: bool) -> float64

sin(x) when IS_SIN is true, cos(x) otherwise.

Parameters

x: float64
the angle in radians.
$IS_SIN: bool
picks sine or cosine at compile time.

Returns

float64

See also