1*a80f2c8dSmaya.\" $NetBSD: copysign.3,v 1.4 2017/09/28 15:03:18 maya Exp $ 23fffced2Sjruoho.\" 33fffced2Sjruoho.\" Copyright (c) 2011 Jukka Ruohonen <jruohonen@iki.fi> 43fffced2Sjruoho.\" All rights reserved. 53fffced2Sjruoho.\" 63fffced2Sjruoho.\" Redistribution and use in source and binary forms, with or without 73fffced2Sjruoho.\" modification, are permitted provided that the following conditions 83fffced2Sjruoho.\" are met: 93fffced2Sjruoho.\" 1. Redistributions of source code must retain the above copyright 103fffced2Sjruoho.\" notice, this list of conditions and the following disclaimer. 113fffced2Sjruoho.\" 2. Redistributions in binary form must reproduce the above copyright 123fffced2Sjruoho.\" notice, this list of conditions and the following disclaimer in the 133fffced2Sjruoho.\" documentation and/or other materials provided with the distribution. 143fffced2Sjruoho.\" 153fffced2Sjruoho.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 163fffced2Sjruoho.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 173fffced2Sjruoho.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 183fffced2Sjruoho.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 193fffced2Sjruoho.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 203fffced2Sjruoho.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 213fffced2Sjruoho.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 223fffced2Sjruoho.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 233fffced2Sjruoho.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 243fffced2Sjruoho.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 253fffced2Sjruoho.\" POSSIBILITY OF SUCH DAMAGE. 263fffced2Sjruoho.\" 2709a8e7a0Smaya.Dd September 28, 2017 283fffced2Sjruoho.Dt COPYSIGN 3 293fffced2Sjruoho.Os 303fffced2Sjruoho.Sh NAME 313fffced2Sjruoho.Nm copysign , 323fffced2Sjruoho.Nm copysignf , 333fffced2Sjruoho.Nm copysignl 343fffced2Sjruoho.Nd functions to manipulate signs 353fffced2Sjruoho.Sh LIBRARY 363fffced2Sjruoho.Lb libm 373fffced2Sjruoho.Sh SYNOPSIS 383fffced2Sjruoho.In math.h 393fffced2Sjruoho.Ft double 403fffced2Sjruoho.Fn copysign "double x" "double y" 413fffced2Sjruoho.Ft float 423fffced2Sjruoho.Fn copysignf "float x" "float y" 433fffced2Sjruoho.Ft long double 443fffced2Sjruoho.Fn copysignl "long double x" "long double y" 450a4f43d1Smaya.In tgmath.h 460a4f43d1Smaya.Ft real-floating 470a4f43d1Smaya.Fn copysign "real-floating x" "real-floating y" 483fffced2Sjruoho.Sh DESCRIPTION 493fffced2SjruohoThe 503fffced2Sjruoho.Fn copysign , 513fffced2Sjruoho.Fn copysignf , 523fffced2Sjruohoand 533fffced2Sjruoho.Fn copysignl 543fffced2Sjruohofunctions return a value whose absolute value matches 553fffced2Sjruoho.Fa x , 563fffced2Sjruohobut whose sign bit is taken from 573fffced2Sjruoho.Fa y . 583fffced2Sjruoho.Sh RETURN VALUES 593fffced2SjruohoUpon successful completion, 603fffced2Sjruohoall three functions return a value with the magnitude of 613fffced2Sjruoho.Fa x 623fffced2Sjruohoand the sign of 633fffced2Sjruoho.Fa y . 643fffced2SjruohoIf 653fffced2Sjruoho.Fa x 663fffced2Sjruohois 673fffced2Sjruoho\*(Na , 683fffced2Sjruohothe functions return a 693fffced2Sjruoho\*(Na 703fffced2Sjruohowith the sign of 713fffced2Sjruoho.Fa y . 723fffced2Sjruoho.Sh SEE ALSO 733fffced2Sjruoho.Xr math 3 , 743fffced2Sjruoho.Xr signbit 3 753fffced2Sjruoho.Sh STANDARDS 763fffced2SjruohoThe described functions conform to 773fffced2Sjruoho.St -isoC-99 . 783fffced2Sjruoho.\" 793fffced2Sjruoho.\" XXX: Verify this. 803fffced2Sjruoho.\" 813fffced2Sjruoho.\" The functions are also recommended by 823fffced2Sjruoho.\" .St -ieee754 833fffced2Sjruoho.\" 843fffced2Sjruoho.\" .Sh HISTORY 853fffced2Sjruoho.\" 863fffced2Sjruoho.\" XXX: Fill this. 873fffced2Sjruoho.\" 883fffced2Sjruoho.\" These functions first appeared in ???. 893fffced2Sjruoho.\" 90*a80f2c8dSmaya.Sh CAVEATS 91*a80f2c8dSmayaNote that on implementations that represent a signed zero 92*a80f2c8dSmayabut do not treat negative zero consistently in arithmetic operations, 93*a80f2c8dSmayathese functions may regard the sign of zero as positive. 94