fdimd32(), fdimd64(), fdimd128() — Calculate the positive difference

Standards

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

Format

#define __STDC_WANT_DEC_FP__
#include <math.h> 

_Decimal32  fdimd32(_Decimal32 x, _Decimal32 y); 
_Decimal64  fdimd64(_Decimal64 x, _Decimal64 y);
_Decimal128 fdimd128(_Decimal128 x, _Decimal128 y);
_Decimal32  fdim(_Decimal32 x, _Decimal32 y);     /* C++ only */
_Decimal64  fdim(_Decimal64 x, _Decimal64 y);     /* C++ only */
_Decimal128 fdim(_Decimal128 x, _Decimal128 y);   /* C++ only */

General description

The fdim functions compute the positive difference between x and y.
Notes:
  1. To use IEEE decimal floating-point, the hardware must have the Decimal Floating-Point Facility installed.
  2. These functions work in IEEE decimal floating-point format. See IEEE binary floating-point for more information

Returned value

The fdim functions return the positive difference between x and y.

Example

⁄* CELEBF76

   This example illustrates the fdimd32() function.

*⁄

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

int main(void)
{
   _Decimal32 x = 56789.70DF, y = 56790.00DF, z;

   z = fdimd32(y, x);

   printf("The result of fdim32(%Hf, %Hf)\n is %Hf\n", y, x, z);
   return 0;
}

Related information