copysignd32(), copysignd64(), copysignd128() — Copy the sign from one floating-point number to another
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 copysignd32(_Decimal32 x, _Decimal32 y);
_Decimal64 copysignd64(_Decimal64 x, _Decimal64 y);
_Decimal128 copysignd128(_Decimal128 x, _Decimal128 y);
_Decimal32 copysign(_Decimal32 x, _Decimal32 y); /C++ only */
_Decimal64 copysign(_Decimal64 x, _Decimal64 y); /C++ only */
_Decimal128 copysign(_Decimal128 x, _Decimal128 y); /C++ only */
General description
The copysign functions
produce a value with the magnitude of x and
the sign of y.
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
The copysign functions return a value with the magnitude of x and the sign of y.
Example
/* CELEBC47
This example illustrates the copysignd64() function.
*/
#define __STDC_WANT_DEC_FP__
#include <math.h>
#include <stdio.h>
int main(void)
{
_Decimal64 x = 1.2DD, y = -1.0DD , z;
z = copysignd64(x, y);
printf("The result of copysignd64(%Df,%Df) is %Df\n",x,y,z);
}
Related information
- math.h
- copysign(), copysignf(), copysignl() — Copy the sign from one floating-point number to another
- ilogbd32(), ilogbd64(), ilogbd128() — Integer unbiased exponent
- logbd32(), logbd64(), logbd128() — Unbiased exponent
- nextafterd32(), nextafterd64(), nextafterd128() — Next representable decimal floating-point value