Math module

frac

procedure · 1 overloadSource

The fractional part x - floor(x), always in [0, 1) for finite x. For a negative x this is not the part after the decimal point: frac(-1.25) is 0.75. Only float and float64.

ExampleOpen in playground ↗
assert(frac(2.25) == 0.25 && frac(-1.25) == 0.75 && frac(3.0) == 0);
frac :: (x: $T) -> T

The part of x above its floor, in 0..1. Negative values wrap up, so -0.25 gives 0.75.

Parameters

x: $T
the value.

Returns

T

See also