floord32(), floord64(), floord128() — Round down to integral value

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  floord32(_Decimal32 x); 
_Decimal64  floord64(_Decimal64 x);
_Decimal128 floord128(_Decimal128 x);
_Decimal32  floor(_Decimal32 x);      /* C++ only */
_Decimal64  floor(_Decimal64 x);      /* C++ only */
_Decimal128 floor(_Decimal128 x);     /* C++ only */

General description

Calculates the largest integer that is less than or equal to x.
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 Decimal Floating-Point" for more information.

Returned value

Returns the calculated integral value expressed as a _Decimal32, _Decimal64, or _Decimal128 value. The result cannot have a range error.

Example

⁄* CELEBF78

   This example illustrates the floord64() function.

   This example assigns y the value of the largest integer that is less
   than or equal to 2.8, and it assigns z the value of the largest
   integer that is less than or equal to -2.8.

*⁄

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

int main(void)
{
   _Decimal64 y, z;

   y = floord64(+2.8DD);
   z = floord64(-2.8DD);

   printf("floord64(+2.8) = %+Df\n", y);
   printf("floord64(-2.8) = %+Df\n", z);
}

Related information