1COPYSIGN(3) Linux Programmer's Manual COPYSIGN(3)
2
3
4
6 copysign, copysignf, copysignl - copy sign of a number
7
9 #include <math.h>
10
11 double copysign(double x, double y);
12 float copysignf(float x, float y);
13 long double copysignl(long double x, long double y);
14
15 Link with -lm.
16
17 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19 copysign(), copysignf(), copysignl(): _SVID_SOURCE || _BSD_SOURCE ||
20 _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or cc -std=c99
21
23 The copysign() functions return a value whose absolute value matches
24 that of x, but whose sign bit matches that of y.
25
27 On success, these functions return a value whose magnitude is taken
28 from x and whose sign is taken from y.
29
30 If x is a NaN, a NaN with the sign bit of y is returned.
31
33 No errors occur.
34
36 C99, POSIX.1-2001. This function is defined in IEC 559 (and the appen‐
37 dix with recommended functions in IEEE 754/IEEE 854).
38
40 On architectures where the floating-point formats are not IEEE 754 com‐
41 pliant, the copysign() functions may treat a negative zero as positive.
42
44 signbit(3)
45
47 This page is part of release 3.25 of the Linux man-pages project. A
48 description of the project, and information about reporting bugs, can
49 be found at http://www.kernel.org/doc/man-pages/.
50
51
52
53GNU 2008-08-05 COPYSIGN(3)