Math387::Rem Function

Overload List

#SignatureDescription
1double Rem(const double X, const double Y);IEEE 754 floating-point remainder (fmod).
2TCplx Rem(const TCplx &X, const TCplx &Y);Complex remainder after division.
3TSCplx Rem(const TSCplx &X, const TSCplx &Y);

Overload 1: double Rem(const double X, const double Y);

IEEE 754 floating-point remainder (fmod).

#NameTypeDescription
1Xconst double
2Yconst double

Returns: 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|.

Declared in Dew::Math::Units::Math387 · Dew.Math/Units.Math387.h · Cross-compiler

Overload 2: TCplx Rem(const TCplx &X, const TCplx &Y);

Complex remainder after division.

#NameTypeDescription
1Xconst TCplx &
2Yconst TCplx &

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

Declared in Dew::Math::Units::Math387 · Dew.Math/Units.Math387.h · Cross-compiler

Overload 3: TSCplx Rem(const TSCplx &X, const TSCplx &Y);

#NameTypeDescription
1Xconst TSCplx &
2Yconst TSCplx &
Declared in Dew::Math::Units::Math387 · Dew.Math/Units.Math387.h · Cross-compiler