MathF.IEEERemainder(Single, Single) Metoda

Definicja

Zwraca resztę wynikową z dzielenia określonej liczby przez inną określoną liczbę.

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

Parametry

x
Single

Dywidenda.

y
Single

Dzielnik.

Zwraca

Liczba równa x - (y Q), gdzie Q jest ilorazem x / y zaokrąglonym do najbliższej liczby całkowitej (jeśli x / y spadnie w połowie między dwiema liczbami całkowitymi, zwracana jest parzysta liczba całkowita).

Jeśli x - (y Q) jest zero, wartość +0 jest zwracana, jeśli x jest dodatnia, lub -0, jeśli x jest ujemna.

Jeśli y = 0, NaN jest zwracany.

Uwagi

Ta operacja jest zgodna z operacją pozostałą zdefiniowaną w sekcji 5.1 ANSI/IEEE Std 754-1985; Standard IEEE dla arytmetyki Floating-Point binarnych; Institute of Electrical and Electronics Engineers, Inc; 1985.

Metoda IEEERemainder nie jest taka sama jak operator reszty. Mimo że obie zwracają resztę po dzieleniu, używane formuły są różne. Formuła IEEERemainder metody to:

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

Natomiast formuła dla pozostałego operatora to:

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

Dotyczy