]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
2 | .\" | |
5fbde956 | 3 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da MK |
4 | .\" |
5 | .\" References consulted: | |
6 | .\" Linux libc source code | |
7 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
8 | .\" 386BSD man pages | |
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) | |
45186a5d | 11 | .TH COPYSIGN 3 2021-03-22 "Linux man-pages (unreleased)" |
fea681da MK |
12 | .SH NAME |
13 | copysign, copysignf, copysignl \- copy sign of a number | |
2af19291 AC |
14 | .SH LIBRARY |
15 | Math library | |
8fc3b2cf | 16 | .RI ( libm ", " \-lm ) |
fea681da MK |
17 | .SH SYNOPSIS |
18 | .nf | |
19 | .B #include <math.h> | |
68e4db0a | 20 | .PP |
fea681da | 21 | .BI "double copysign(double " x ", double " y ); |
fea681da | 22 | .BI "float copysignf(float " x ", float " y ); |
fea681da MK |
23 | .BI "long double copysignl(long double " x ", long double " y ); |
24 | .fi | |
68e4db0a | 25 | .PP |
d39ad78f | 26 | .RS -4 |
cc4615cc MK |
27 | Feature Test Macro Requirements for glibc (see |
28 | .BR feature_test_macros (7)): | |
d39ad78f | 29 | .RE |
68e4db0a | 30 | .PP |
cc4615cc | 31 | .BR copysign (), |
e0bf9127 | 32 | .BR copysignf (), |
cc4615cc | 33 | .BR copysignl (): |
9d2adbae | 34 | .nf |
5c10d2c5 | 35 | _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
9d2adbae MK |
36 | || /* Since glibc 2.19: */ _DEFAULT_SOURCE |
37 | || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE | |
38 | .fi | |
fea681da | 39 | .SH DESCRIPTION |
5600f73a | 40 | These functions return a value whose absolute value matches that of |
022671eb MK |
41 | .IR x , |
42 | but whose sign bit matches that of | |
43 | .IR y . | |
847e0d88 | 44 | .PP |
d9d62b8f MK |
45 | For example, |
46 | .I "copysign(42.0,\ \-1.0)" | |
47 | and | |
48 | .I "copysign(\-42.0, \-1.0)" | |
49 | both return \-42.0. | |
db002ad7 MK |
50 | .SH RETURN VALUE |
51 | On success, these functions return a value whose magnitude is taken from | |
52 | .I x | |