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           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
21               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
22               || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
23

DESCRIPTION

25       These  functions return a value whose absolute value matches that of x,
26       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

ATTRIBUTES

41       For  an  explanation  of  the  terms  used   in   this   section,   see
42       attributes(7).
43
44       ┌─────────────────────────────────────┬───────────────┬─────────┐
45Interface                            Attribute     Value   
46       ├─────────────────────────────────────┼───────────────┼─────────┤
47copysign(), copysignf(), copysignl() │ Thread safety │ MT-Safe │
48       └─────────────────────────────────────┴───────────────┴─────────┘

CONFORMING TO

50       C99,  POSIX.1-2001,  POSIX.1-2008.  This function is defined in IEC 559
51       (and the appendix with recommended functions in IEEE 754/IEEE 854).
52

NOTES

54       On architectures where the floating-point formats are not IEEE 754 com‐
55       pliant, these functions may treat a negative zero as positive.
56

SEE ALSO

58       signbit(3)
59

COLOPHON

61       This  page  is  part of release 4.16 of the Linux man-pages project.  A
62       description of the project, information about reporting bugs,  and  the
63       latest     version     of     this    page,    can    be    found    at
64       https://www.kernel.org/doc/man-pages/.
65
66
67
68GNU                               2017-09-15                       COPYSIGN(3)
Impressum