Math387.Rem / Remf Method

Overload List

#SignatureDescription
1function Rem(const X: TCplx; const Y: TCplx): TCplx;Complex remainder after division.
2function Rem(const X: TSCplx; const Y: TSCplx): TSCplx;
3function Rem(const X: Double; const Y: Double): Double;IEEE 754 floating-point remainder (fmod).
4function Remf(const X: Single; const Y: Single): Single;

Overload 1: function Rem(const X: TCplx; const Y: TCplx): TCplx;

Complex remainder after division.

#NameTypeDescription
1XTCplx
2YTCplx

Returns: TCplx (complex) - The remainder after complex division: X/Y. Applied component-wise.

Overload 2: function Rem(const X: TSCplx; const Y: TSCplx): TSCplx;

#NameTypeDescription
1XTSCplx
2YTSCplx

Returns: TSCplx

Overload 3: function Rem(const X: Double; const Y: Double): Double;

IEEE 754 floating-point remainder (fmod).

#NameTypeDescription
1XDouble
2YDouble

Returns: Double - The exact remainder of X/Y, with |result| < |Y| and same sign as X.

Remarks:

Computes X - trunc(X/Y) * Y with no rounding error (IEEE 754 exact operation). General-purpose modular arithmetic for arbitrary divisor Y - use for clock wrapping, spatial tiling, fractional part extraction, or any case where you need the exact numerical value of the remainder in a guaranteed range.

Not suitable for angle reduction before trigonometric functions. Sin, Cos and Tan handle large arguments internally using Payne-Hanek range reduction with extended-precision constants - calling Rem(x, 2*Pi) beforehand does not improve their accuracy and can degrade it for large |x|.

Overload 4: function Remf(const X: Single; const Y: Single): Single;

#NameTypeDescription
1XSingle
2YSingle

Returns: Single