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