1.\" Copyright (c) 1985, 1991 Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 33.\" $FreeBSD$ 34.\" 35.Dd February 25, 1994 36.Dt IEEE 3 37.Os 38.Sh NAME 39.Nm copysign , 40.Nm copysignf , 41.Nm finite , 42.Nm finitef , 43.Nm ilogb , 44.Nm ilogbf , 45.Nm nextafter , 46.Nm nextafterf , 47.Nm remainder , 48.Nm remainderf , 49.Nm scalbn , 50.Nm scalbnf 51.Nd functions for IEEE arithmetic 52.Sh LIBRARY 53.Lb libm 54.Sh SYNOPSIS 55.In math.h 56.Ft double 57.Fn copysign "double x" "double y" 58.Ft float 59.Fn copysignf "float x" "float y" 60.Ft int 61.Fn finite "double x" 62.Ft int 63.Fn finitef "float x" 64.Ft int 65.Fn ilogb "double x" 66.Ft int 67.Fn ilogbf "float x" 68.Ft double 69.Fn nextafter "double x" "double y" 70.Ft float 71.Fn nextafterf "float x" "float y" 72.Ft double 73.Fn remainder "double x" "double y" 74.Ft float 75.Fn remainderf "float x" "float y" 76.Ft double 77.Fn scalbn "double x" "int n" 78.Ft float 79.Fn scalbnf "float x" "int n" 80.Sh DESCRIPTION 81These functions are required or recommended by 82.St -ieee754 . 83.Pp 84.Fn copysign 85and 86.Fn copysignf 87return 88.Fa x 89with its sign changed to 90.Fa y Ns 's . 91.Pp 92.Fn finite 93and 94.Fn finitef 95return the value 1 just when 96\-\*(If \*(Lt 97.Fa x 98\*(Lt +\*(If; 99otherwise a 100zero is returned 101(when 102.Pf \\*(Ba Ns Fa x Ns \\*(Ba 103= \*(If or 104.Fa x 105is \*(Na). 106.Pp 107.Fn ilogb 108and 109.Fn ilogbf 110return 111.Fa x Ns 's exponent, 112in integer format. 113.Fn ilogb \*(Pm\*(If 114returns 115.Dv INT_MAX 116and 117.Fn ilogb 0 118returns 119.Dv INT_MIN . 120.Pp 121.Fn nextafter 122and 123.Fn nextafterf 124return the next machine representable number from 125.Fa x 126in direction 127.Fa y . 128.Pp 129.Fn remainder 130and 131.Fn remainderf 132return the remainder 133.Fa r 134:= 135.Fa x 136\- 137.Fa n\(**y 138where 139.Fa n 140is the integer nearest the exact value of 141.Bk -words 142.Fa x Ns / Ns Fa y ; 143.Ek 144moreover if 145.Pf \\*(Ba Fa n 146\- 147.Sm off 148.Fa x No / Fa y No \\*(Ba 149.Sm on 150= 1511/2 152then 153.Fa n 154is even. Consequently 155the remainder is computed exactly and 156.Sm off 157.Pf \\*(Ba Fa r No \\*(Ba 158.Sm on 159\*(Le 160.Sm off 161.Pf \\*(Ba Fa y No \\*(Ba/2 . 162.Sm on 163But 164.Fn remainder x 0 165and 166.Fn remainder \*(If 0 167are invalid operations that produce a \*(Na. 168.Pp 169.Fn scalbn 170and 171.Fn scalbnf 172return 173.Fa x Ns \(**(2** Ns Fa n ) 174computed by exponent manipulation. 175.Sh SEE ALSO 176.Xr math 3 177.Sh HISTORY 178The 179.Nm ieee 180functions appeared in 181.Bx 4.3 . 182.Sh STANDARDS 183.St -ieee754 184