Command:

COPYSIGN(3) Linux Programmer's Manual COPYSIGN(3)NAMEcopysign, copysignf, copysignl - copy sign of a numberSYNOPSIS#include<math.h>doublecopysign(doublex,doubley);floatcopysignf(floatx,floaty);longdoublecopysignl(longdoublex,longdoubley);Link with-lm. Feature Test Macro Requirements for glibc (see feature_test_macros(7)):copysign(),copysignf(),copysignl(): _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; orcc-std=c99DESCRIPTIONThecopysign() functions return a value whose absolute value matches that ofx, but whose sign bit matches that ofy.RETURNVALUEOn success, these functions return a value whose magnitude is taken fromxand whose sign is taken fromy. Ifxis a NaN, a NaN with the sign bit ofyis returned.ERRORSNo errors occur.CONFORMINGTOC99, POSIX.1-2001. This function is defined in IEC 559 (and the appendix with recommended functions in IEEE 754/IEEE 854).NOTESOn architectures where the floating-point formats are not IEEE 754 compliant, thecopysign() functions may treat a negative zero as positive.SEEALSOsignbit(3)COLOPHONThis page is part of release 3.22 of the Linuxman-pagesproject. A description of the project, and informa- tion about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU 2008-08-05 COPYSIGN(3)