ceild32(), ceild64(), ceild128() — Round up 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 ceild32(_Decimal32 x);
_Decimal64 ceild64(_Decimal64 x);
_Decimal128 ceild128(_Decimal128 x);
_Decimal32 ceil(_Decimal32 x); /* C++ only */
_Decimal64 ceil(_Decimal64 x); /* C++ only */
_Decimal128 ceil(_Decimal128 x); /* C++ only */
General description
Computes the smallest
integer that is greater than or equal to x.
Notes:
- To use IEEE decimal floating-point, the hardware must have the Decimal Floating-Point Facility installed.
- These functions work in IEEE decimal floating-point format. See "IEEE Decimal Floating-Point" for more information.
Returned value
These functions are always successful.
Example
/* CELEBC50
This example illustrates the ceild32() function.
This example sets y to the smallest integer greater than
1.05, and then to the smallest integer greater than -1.05.
The results are 2.0 and -1.0, respectively.
*/
#define __STDC_WANT_DEC_FP__
#include <math.h>
#include <stdio.h>
int main(void)
{
_Decimal32 y, z;
y = ceild32(+1.05DF); /* y = +2.0 */
z = ceild32(-1.05DF); /* z = -1.0 */
printf("ceild32(+1.05) = % Hf\n"
"ceild32(-1.05) = % Hf\n", y, z);
}