2 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" References consulted:
7 .\" Linux libc source code
8 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
10 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
11 .\" Modified 2002-08-10 by Walter Harms (walter.harms@informatik.uni-oldenburg.de)
12 .TH copysign 3 (date) "Linux man-pages (unreleased)"
14 copysign, copysignf, copysignl \- copy sign of a number
17 .RI ( libm ", " \-lm )
22 .BI "double copysign(double " x ", double " y );
23 .BI "float copysignf(float " x ", float " y );
24 .BI "long double copysignl(long double " x ", long double " y );
28 Feature Test Macro Requirements for glibc (see
29 .BR feature_test_macros (7)):
36 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
37 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
38 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
41 These functions return a value whose absolute value matches that of
43 but whose sign bit matches that of
47 .I "copysign(42.0,\ \-1.0)"
49 .I "copysign(\-42.0, \-1.0)"
52 On success, these functions return a value whose magnitude is taken from
54 and whose sign is taken from
60 a NaN with the sign bit of
66 For an explanation of the terms used in this section, see
74 Interface Attribute Value
79 T} Thread safety MT-Safe
85 C99, POSIX.1-2001, POSIX.1-2008.
87 This function is defined in IEC 559 (and the appendix with
88 recommended functions in IEEE 754/IEEE 854).
90 On architectures where the floating-point formats are not IEEE 754 compliant,
92 functions may treat a negative zero as positive.