語言

MathF.IEEERemainder(Single, Single) 方法

定義

回傳將指定數字除以另一個指定數字所得的餘數。

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

參數

x
Single

numerator

y
Single

分母

傳回

除以 x 的結果 y

備註

此操作符合 ANSI/IEEE Std 754-1985 第 5.1 節所定義的其餘操作;IEEE 二進位 Floating-Point 算術標準;電機電子工程師學會; 1985.

此 IEEERemainder 方法與 剩餘算子不同。 雖然兩者除法後都會返回剩餘部分,但它們使用的公式不同。 該 IEEERemainder 方法的公式為:

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

相較之下,剩餘算子的公式為:

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

適用於