fmod

Calculates the remainder of the division x / y

fmod
(
D1
D2
)
(
auto const ref D1 x
,
auto const ref D2 y
)

Parameters

x D1

dividend

y D2

divisor

Return Value

Type: auto

The value of x - n * y, where n is the quotient rounded toward zero of the division x / y

Throws

InvalidOperationExceptionx or y is signaling NaN, x = ±∞, y = ±0.0
UnderflowExceptionresult is too small to be represented
DivisionByZeroExceptiony = 0.0
InexactExceptionthe result is inexact

Special values

xyfmod(x, y)
NaNanyNaN
anyNaNNaN
±∞anyNaN
any0.0NaN
any±∞NaN

Examples

decimal32 x = "18.5";
decimal32 y = "4.2";
assert (fmod(x, y) == decimal32("1.7"));

Meta