Bewerken

Share via


MathF.IEEERemainder(Single, Single) Method

Definition

Returns the remainder resulting from the division of a specified number by another specified number.

public:
 static float IEEERemainder(float x, float y);
public static float IEEERemainder (float x, float y);
static member IEEERemainder : single * single -> single
Public Shared Function IEEERemainder (x As Single, y As Single) As Single

Parameters

x
Single

The numerator

y
Single

The denominator

Returns

The result of dividing x by y

Remarks

This operation complies with the remainder operation defined in Section 5.1 of ANSI/IEEE Std 754-1985; IEEE Standard for Binary Floating-Point Arithmetic; Institute of Electrical and Electronics Engineers, Inc; 1985.

The IEEERemainder method is not the same as the remainder operator. Although both return the remainder after division, the formulas they use are different. The formula for the IEEERemainder method is:

IEEERemainder = dividend - (divisor * MathF.Round(dividend / divisor))

In contrast, the formula for the remainder operator is:

Remainder = (MathF.Abs(dividend) - (MathF.Abs(divisor) *
            (MathF.Floor(MathF.Abs(dividend) / MathF.Abs(divisor))))) *
            MathF.Sign(dividend)

Applies to