MathF.IEEERemainder(Single, Single) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
A dividend.
- y
- Single
A divisor.
Returns
A number equal to x
- (y
Q), where Q is the quotient of x
/ y
rounded to the nearest integer (if x
/ y
falls halfway between two integers, the even integer is returned).
If x
- (y
Q) is zero, the value +0 is returned if x
is positive, or -0 if x
is negative.
If y
= 0, NaN is returned.
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
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for