MathF.IEEERemainder(Single, Single) Metodo

Definizione

Restituisce il resto della divisione tra il numero specificato e un altro numero specificato.

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

Parametri

x
Single

Dividendo.

y
Single

Divisore.

Restituisce

Un numero uguale a x - (y Q), dove Q è il quoziente di x / y arrotondato all'intero più vicino; se x / y è contenuto tra due interi, verrà restituito l'intero pari.

Se x - (y Q) è zero, verrà restituito il valore +0 se x è positivo oppure -0 se x è negativo.

Se y = 0, verrà restituito NaN.

Commenti

Questa operazione è conforme all'operazione di resto definita nella sezione 5.1 di ANSI/IEEE Std 754-1985; IEEE Standard per Binary Floating-Point Aritmetica; Institute of Electrical and Electronics Engineers, Inc; 1985.

Il IEEERemainder metodo non è uguale all'operatore resto. Anche se entrambi restituiscono il resto dopo la divisione, le formule usate sono diverse. La formula per il IEEERemainder metodo è:

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

Al contrario, la formula per l'operatore di resto è:

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

Si applica a