fmodd32(), fmodd64(), fmodd128() — Calculate floating-point remainder

Standards

Standards / Extensions C or C++ Dependencies
C/C++ DFP both z/OS® V1.11

Format

#define __STDC_WANT_DEC_FP__
#include <math.h>

_Decimal32  fmodd32(_Decimal32 x, _Decimal32 y); 
_Decimal64  fmodd64(_Decimal64 x, _Decimal64 y); 
_Decimal128 fmodd128(_Decimal128 x, _Decimal128 y); 

_Decimal32  fmod(_Decimal32 x, _Decimal32 y);     /* C++ only */
_Decimal64  fmod(_Decimal64 x, _Decimal64 y);     /* C++ only */
_Decimal128 fmod(_Decimal128 x, _Decimal128 y);    /* C++ only */

General description

Calculates the floating-point remainder of x/y. The absolute value of the result is always less than the absolute value of y. The result will have the same sign as x.

Notes:
  1. These functions work in IEEE decimal floating-point format. See IEEE decimal floating-pointIEEE Decimal Floating-Point for more information.
  2. To use IEEE decimal floating-point, the hardware must have the Decimal Floating-Point Facility installed.

Returned value

If successful, the function returns the floating-point remainder of x/y.

If y is 0, the function sets errno to EDOM and returns NaNQ. No other errors will occur.

Example

⁄* CELEBF83

   This example illustrates the fmodd32() function.

*⁄

#define  __STDC_WANT_DEC_FP__
#include <math.h>
#include <stdio.h>

void main(void)
{
   _Decimal32 x, y, z;

   x = -10.0DF;
   y = 3.0DF;
   z = fmodd32(x, y);

   printf("fmodd32( %Hf, %Hf ) = %Hf\n", x, y, z);
}

Related information