1COPYSIGN(3)                Linux Programmer's Manual               COPYSIGN(3)
2
3
4

NAME

6       copysign, copysignf, copysignl - copy sign of a number
7

SYNOPSIS

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():
20           _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE >= 600 ||
21           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
22           or cc -std=c99
23

DESCRIPTION

25       The copysign() functions return a value whose  absolute  value  matches
26       that of x, but whose sign bit matches that of y.
27
28       For example, copysign(42.0, -1.0) and copysign(-42.0, -1.0) both return
29       -42.0.
30

RETURN VALUE

32       On success, these functions return a value  whose  magnitude  is  taken
33       from x and whose sign is taken from y.
34
35       If x is a NaN, a NaN with the sign bit of y is returned.
36

ERRORS

38       No errors occur.
39

CONFORMING TO

41       C99, POSIX.1-2001.  This function is defined in IEC 559 (and the appen‐
42       dix with recommended functions in IEEE 754/IEEE 854).
43

NOTES

45       On architectures where the floating-point formats are not IEEE 754 com‐
46       pliant, the copysign() functions may treat a negative zero as positive.
47

SEE ALSO

49       signbit(3)
50

COLOPHON

52       This  page  is  part of release 3.53 of the Linux man-pages project.  A
53       description of the project, and information about reporting  bugs,  can
54       be found at http://www.kernel.org/doc/man-pages/.
55
56
57
58GNU                               2012-03-25                       COPYSIGN(3)
Impressum