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 <= 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  at‐
42       tributes(7).
43
44       ┌────────────────────────────────────────────┬───────────────┬─────────┐
45Interface                                   Attribute     Value   
46       ├────────────────────────────────────────────┼───────────────┼─────────┤
47copysign(), copysignf(), copysignl()        │ Thread safety │ MT-Safe │
48       └────────────────────────────────────────────┴───────────────┴─────────┘
49

CONFORMING TO

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

NOTES

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

SEE ALSO

59       signbit(3)
60

COLOPHON

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