diff options
Diffstat (limited to 'lib/msun/man')
60 files changed, 6858 insertions, 0 deletions
diff --git a/lib/msun/man/acos.3 b/lib/msun/man/acos.3 new file mode 100644 index 000000000000..e21687c1bb66 --- /dev/null +++ b/lib/msun/man/acos.3 @@ -0,0 +1,84 @@ +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd July 31, 2008 +.Dt ACOS 3 +.Os +.Sh NAME +.Nm acos , +.Nm acosf , +.Nm acosl +.Nd arc cosine functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn acos "double x" +.Ft float +.Fn acosf "float x" +.Ft long double +.Fn acosl "long double x" +.Sh DESCRIPTION +The +.Fn acos , +.Fn acosf , +and +.Fn acosl +functions compute the principal value of the arc cosine of +.Fa x . +.Sh RETURN VALUES +These functions return the arc cosine in the range +.Bq 0 , \*(Pi +radians. +If: +.Bd -unfilled -offset indent +.Pf \&| Ns Fa x Ns \&| > 1 , +.Ed +.Pp +.Fn acos x +raises an invalid exception and returns an \*(Na. +.Sh SEE ALSO +.Xr asin 3 , +.Xr atan 3 , +.Xr atan2 3 , +.Xr cos 3 , +.Xr cosh 3 , +.Xr fenv 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr sinh 3 , +.Xr tan 3 , +.Xr tanh 3 +.Sh STANDARDS +The +.Fn acos , +.Fn acosf , +and +.Fn acosl +functions conform to +.St -isoC-99 . diff --git a/lib/msun/man/acosh.3 b/lib/msun/man/acosh.3 new file mode 100644 index 000000000000..0268bde8e092 --- /dev/null +++ b/lib/msun/man/acosh.3 @@ -0,0 +1,82 @@ +.\" Copyright (c) 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd June 9, 2013 +.Dt ACOSH 3 +.Os +.Sh NAME +.Nm acosh , +.Nm acoshf , +.Nm acoshl +.Nd inverse hyperbolic cosine functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn acosh "double x" +.Ft float +.Fn acoshf "float x" +.Ft long double +.Fn acoshl "long double x" +.Sh DESCRIPTION +The +.Fn acosh , +.Fn acoshf , +and +.Fn acoshl +functions compute the inverse hyperbolic cosine +of the real +argument +.Fa x . +For a discussion of error due to roundoff, see +.Xr math 3 . +.Sh RETURN VALUES +These functions +return the inverse hyperbolic cosine of +.Fa x . +If the argument is less than 1, +.Fn acosh +raises an invalid exception and returns an \*(Na. +.Sh SEE ALSO +.Xr asinh 3 , +.Xr atanh 3 , +.Xr exp 3 , +.Xr fenv 3 , +.Xr math 3 +.Sh HISTORY +The +.Fn acosh , +.Fn acoshf , +and +.Fn acoshl +functions appeared in +.Bx 4.3 , +.Fx 2.0 , +and +.Fx 10.0 , +respectively. diff --git a/lib/msun/man/asin.3 b/lib/msun/man/asin.3 new file mode 100644 index 000000000000..20dc7ac1f54c --- /dev/null +++ b/lib/msun/man/asin.3 @@ -0,0 +1,86 @@ +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd July 31, 2008 +.Dt ASIN 3 +.Os +.Sh NAME +.Nm asin , +.Nm asinf , +.Nm asinl +.Nd arc sine functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn asin "double x" +.Ft float +.Fn asinf "float x" +.Ft long double +.Fn asinl "long double x" +.Sh DESCRIPTION +The +.Fn asin , +.Fn asinf , +and +.Fn asinl +functions compute the principal value of the arc sine of +.Fa x . +.Sh RETURN VALUES +These functions return the arc sine in the range +.Bk -words +.Bq -\*(Pi/2 , +\*(Pi/2 +.Ek +radians. +If: +.Bd -unfilled -offset indent +.Pf \&| Ns Fa x Ns \&| > 1 +.Ed +.Pp +.Fn asin x +raises an invalid exception and returns an \*(Na. +.Sh SEE ALSO +.Xr acos 3 , +.Xr atan 3 , +.Xr atan2 3 , +.Xr cos 3 , +.Xr cosh 3 , +.Xr fenv 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr sinh 3 , +.Xr tan 3 , +.Xr tanh 3 +.Sh STANDARDS +The +.Fn asin , +.Fn asinf , +and +.Fn asinl +functions conform to +.St -isoC-99 . diff --git a/lib/msun/man/asinh.3 b/lib/msun/man/asinh.3 new file mode 100644 index 000000000000..66515fa6ac0b --- /dev/null +++ b/lib/msun/man/asinh.3 @@ -0,0 +1,78 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd June 9, 2013 +.Dt ASINH 3 +.Os +.Sh NAME +.Nm asinh , +.Nm asinhf , +.Nm asinhl +.Nd inverse hyperbolic sine functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn asinh "double x" +.Ft float +.Fn asinhf "float x" +.Ft long double +.Fn asinhl "long double x" +.Sh DESCRIPTION +The +.Fn asinh , +.Fn asinhf , +and +.Fn asinhl +functions compute the inverse hyperbolic sine +of the real +argument +.Fa x . +For a discussion of error due to roundoff, see +.Xr math 3 . +.Sh RETURN VALUES +These functions +return the inverse hyperbolic sine of +.Fa x . +.Sh SEE ALSO +.Xr acosh 3 , +.Xr atanh 3 , +.Xr exp 3 , +.Xr math 3 +.Sh HISTORY +The +.Fn asinh , +.Fn asinhf , +and +.Fn asinhl +functions appeared in +.Bx 4.3 , +.Fx 2.0 , +and +.Fx 10.0 , +respectively. diff --git a/lib/msun/man/atan.3 b/lib/msun/man/atan.3 new file mode 100644 index 000000000000..d04787ce8bfe --- /dev/null +++ b/lib/msun/man/atan.3 @@ -0,0 +1,78 @@ +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd July 31, 2008 +.Dt ATAN 3 +.Os +.Sh NAME +.Nm atan , +.Nm atanf , +.Nm atanl +.Nd arc tangent functions of one variable +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn atan "double x" +.Ft float +.Fn atanf "float x" +.Ft long double +.Fn atanl "long double x" +.Sh DESCRIPTION +The +.Fn atan , +.Fn atanf , +and +.Fn atanl +functions compute the principal value of the arc tangent of +.Fa x . +.Sh RETURN VALUES +These functions return the arc tangent in the range +.Bk -words +.Bq -\*(Pi/2 , +\*(Pi/2 +.Ek +radians. +.Sh SEE ALSO +.Xr acos 3 , +.Xr asin 3 , +.Xr atan2 3 , +.Xr cos 3 , +.Xr cosh 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr sinh 3 , +.Xr tan 3 , +.Xr tanh 3 +.Sh STANDARDS +The +.Fn atan , +.Fn atanf , +and +.Fn atanl +functions conform to +.St -isoC-99 . diff --git a/lib/msun/man/atan2.3 b/lib/msun/man/atan2.3 new file mode 100644 index 000000000000..df023777ce71 --- /dev/null +++ b/lib/msun/man/atan2.3 @@ -0,0 +1,222 @@ +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd July 31, 2008 +.Dt ATAN2 3 +.Os +.Sh NAME +.Nm atan2 , +.Nm atan2f , +.Nm atan2l , +.Nm carg , +.Nm cargf , +.Nm cargl +.Nd arc tangent and complex phase angle functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn atan2 "double y" "double x" +.Ft float +.Fn atan2f "float y" "float x" +.Ft long double +.Fn atan2l "long double y" "long double x" +.In complex.h +.Ft double +.Fn carg "double complex z" +.Ft float +.Fn cargf "float complex z" +.Ft long double +.Fn cargl "long double complex z" +.Sh DESCRIPTION +The +.Fn atan2 , +.Fn atan2f , +and +.Fn atan2l +functions compute the principal value of the arc tangent of +.Fa y/ Ns Fa x , +using the signs of both arguments to determine the quadrant of +the return value. +.Pp +The +.Fn carg , +.Fn cargf , +and +.Fn cargl +functions compute the complex argument (or phase angle) of +.Fa z . +The complex argument is the number theta such that +.Li z = r * e^(I * theta) , +where +.Li r = cabs(z) . +The call +.Li carg(z) +is equivalent to +.Li atan2(cimag(z), creal(z)) , +and similarly for +.Fn cargf +and +.Fn cargl . +.Sh RETURN VALUES +The +.Fn atan2 , +.Fn atan2f , +and +.Fn atan2l +functions, if successful, +return the arc tangent of +.Fa y/ Ns Fa x +in the range +.Bk -words +.Bq \&- Ns \*(Pi , \&+ Ns \*(Pi +.Ek +radians. +Here are some of the special cases: +.Bl -column atan_(y,x)_:=____ sign(y)_(Pi_atan2(Xy_xX))___ +.It Fn atan2 y x No := Ta +.Fn atan y/x Ta +if +.Fa x +> 0, +.It Ta sign( Ns Fa y Ns )*(\*(Pi - +.Fn atan "\*(Bay/x\*(Ba" ) Ta +if +.Fa x +< 0, +.It Ta +.No 0 Ta +if x = y = 0, or +.It Ta +.Pf sign( Fa y Ns )*\*(Pi/2 Ta +if +.Fa x += 0 \(!= +.Fa y . +.El +.Sh NOTES +The function +.Fn atan2 +defines "if x > 0," +.Fn atan2 0 0 += 0 despite that previously +.Fn atan2 0 0 +may have generated an error message. +The reasons for assigning a value to +.Fn atan2 0 0 +are these: +.Bl -enum -offset indent +.It +Programs that test arguments to avoid computing +.Fn atan2 0 0 +must be indifferent to its value. +Programs that require it to be invalid are vulnerable +to diverse reactions to that invalidity on diverse computer systems. +.It +The +.Fn atan2 +function is used mostly to convert from rectangular (x,y) +to polar +.if n\ +(r,theta) +.if t\ +(r,\(*h) +coordinates that must satisfy x = +.if n\ +r\(**cos theta +.if t\ +r\(**cos\(*h +and y = +.if n\ +r\(**sin theta. +.if t\ +r\(**sin\(*h. +These equations are satisfied when (x=0,y=0) +is mapped to +.if n \ +(r=0,theta=0). +.if t \ +(r=0,\(*h=0). +In general, conversions to polar coordinates +should be computed thus: +.Bd -unfilled -offset indent +.if n \{\ +r := hypot(x,y); ... := sqrt(x\(**x+y\(**y) +theta := atan2(y,x). +.\} +.if t \{\ +r := hypot(x,y); ... := \(sr(x\u\s82\s10\d+y\u\s82\s10\d) +\(*h := atan2(y,x). +.\} +.Ed +.It +The foregoing formulas need not be altered to cope in a +reasonable way with signed zeros and infinities +on a machine that conforms to +.Tn IEEE 754 ; +the versions of +.Xr hypot 3 +and +.Fn atan2 +provided for +such a machine are designed to handle all cases. +That is why +.Fn atan2 \(+-0 \-0 += \(+-\*(Pi +for instance. +In general the formulas above are equivalent to these: +.Bd -unfilled -offset indent +.if n \ +r := sqrt(x\(**x+y\(**y); if r = 0 then x := copysign(1,x); +.if t \ +r := \(sr(x\(**x+y\(**y);\0\0if r = 0 then x := copysign(1,x); +.Ed +.El +.Sh SEE ALSO +.Xr acos 3 , +.Xr asin 3 , +.Xr atan 3 , +.Xr cabs 3 , +.Xr cos 3 , +.Xr cosh 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr sinh 3 , +.Xr tan 3 , +.Xr tanh 3 +.Sh STANDARDS +The +.Fn atan2 , +.Fn atan2f , +.Fn atan2l , +.Fn carg , +.Fn cargf , +and +.Fn cargl +functions conform to +.St -isoC-99 . diff --git a/lib/msun/man/atanh.3 b/lib/msun/man/atanh.3 new file mode 100644 index 000000000000..3fd9d2977d8f --- /dev/null +++ b/lib/msun/man/atanh.3 @@ -0,0 +1,85 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd June 9, 2013 +.Dt ATANH 3 +.Os +.Sh NAME +.Nm atanh , +.Nm atanhf , +.Nm atanhl +.Nd inverse hyperbolic tangent functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn atanh "double x" +.Ft float +.Fn atanhf "float x" +.Ft long double +.Fn atanhl "long double x" +.Sh DESCRIPTION +The +.Fn atanh , +.Fn atanhf , +and +.Fn atanhl +functions compute the inverse hyperbolic tangent +of the real +argument +.Fa x . +For a discussion of error due to roundoff, see +.Xr math 3 . +.Sh RETURN VALUES +These functions +return the inverse hyperbolic tangent of +.Fa x +if successful. +If the argument has absolute value 1, a divide-by-zero exception +is raised and an infinity is returned. +If +.Fa |x| +> 1, an invalid exception is raised and an \*(Na is returned. +.Sh SEE ALSO +.Xr acosh 3 , +.Xr asinh 3 , +.Xr exp 3 , +.Xr fenv 3 , +.Xr math 3 +.Sh HISTORY +The +.Fn atanh , +.Fn atanhf , +and +.Fn atanhl +functions appeared in +.Bx 4.3 , +.Fx 2.0 , +and +.Fx 10.0 , +respectively. diff --git a/lib/msun/man/cacos.3 b/lib/msun/man/cacos.3 new file mode 100644 index 000000000000..6da7e6f6a55d --- /dev/null +++ b/lib/msun/man/cacos.3 @@ -0,0 +1,152 @@ +.\" Copyright (c) 2013 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd February 15, 2017 +.Dt CACOS 3 +.Os +.Sh NAME +.Nm cacos , +.Nm cacosf , +.Nm cacosl , +.Nm cacosh , +.Nm cacoshf , +.Nm cacoshl , +.Nm casin , +.Nm casinf , +.Nm casinl , +.Nm casinh , +.Nm casinhf , +.Nm casinhl , +.Nm catan , +.Nm catanf , +.Nm catanl , +.Nm catanh , +.Nm catanhf , +.Nm catanhl +.Nd complex inverse trigonometric and hyperbolic functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In complex.h +.Ft double complex +.Fn cacos "double complex z" +.Ft float complex +.Fn cacosf "float complex z" +.Ft long double complex +.Fn cacosl "long double complex z" +.Ft double complex +.Fn cacosh "double complex z" +.Ft float complex +.Fn cacoshf "float complex z" +.Ft long double complex +.Fn cacoshl "long double complex z" +.Ft double complex +.Fn casin "double complex z" +.Ft float complex +.Fn casinf "float complex z" +.Ft long double complex +.Fn casinl "long double complex z" +.Ft double complex +.Fn casinh "double complex z" +.Ft float complex +.Fn casinhf "float complex z" +.Ft long double complex +.Fn casinhl "long double complex z" +.Ft double complex +.Fn catan "double complex z" +.Ft float complex +.Fn catanf "float complex z" +.Ft long double complex +.Fn catanl "long double complex z" +.Ft double complex +.Fn catanh "double complex z" +.Ft float complex +.Fn catanhf "float complex z" +.Ft long double complex +.Fn catanhl "long double complex z" +.Sh DESCRIPTION +The +.Fn cacos , +.Fn casin , +and +.Fn catan +functions compute the principal value of the inverse cosine, sine, +and tangent of the complex number +.Fa z , +respectively. +The +.Fn cacosh , +.Fn casinh , +and +.Fn catanh +functions compute the principal value of the inverse hyperbolic +cosine, sine, and tangent. +The +.Fn cacosf , +.Fn casinf , +.Fn catanf +.Fn cacoshf , +.Fn casinhf , +and +.Fn catanhf +functions perform the same operations in +.Fa float +precision. +The +.Fn cacosl , +.Fn casinl , +.Fn catanl +.Fn cacoshl , +.Fn casinhl , +and +.Fn catanhl +functions perform the same operations in +.Fa long double +precision. +.Pp +.ds Un \[cu] +There is no universal convention for defining the principal values of +these functions. +The following table gives the branch cuts, and the +corresponding ranges for the return values, adopted by the C language. +.Bl -column ".Sy Function" ".Sy (-\*(If*I, -I) \*(Un (I, \*(If*I)" ".Sy [-\*(Pi/2*I, \*(Pi/2*I]" +.It Sy Function Ta Sy Branch Cut(s) Ta Sy Range +.It cacos Ta (-\*(If, -1) \*(Un (1, \*(If) Ta [0, \*(Pi] +.It casin Ta (-\*(If, -1) \*(Un (1, \*(If) Ta [-\*(Pi/2, \*(Pi/2] +.It catan Ta (-\*(If*I, -I) \*(Un (I, \*(If*I) Ta [-\*(Pi/2, \*(Pi/2] +.It cacosh Ta (-\*(If, 1) Ta [-\*(Pi*I, \*(Pi*I] +.It casinh Ta (-\*(If*I, -I) \*(Un (I, \*(If*I) Ta [-\*(Pi/2*I, \*(Pi/2*I] +.It catanh Ta (-\*(If, -1) \*(Un (1, \*(If) Ta [-\*(Pi/2*I, \*(Pi/2*I] +.El +.Sh SEE ALSO +.Xr ccos 3 , +.Xr ccosh 3 , +.Xr complex 3 , +.Xr cos 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr tan 3 +.Sh STANDARDS +These functions conform to +.St -isoC-99 . diff --git a/lib/msun/man/ccos.3 b/lib/msun/man/ccos.3 new file mode 100644 index 000000000000..3e6cfcec73fa --- /dev/null +++ b/lib/msun/man/ccos.3 @@ -0,0 +1,79 @@ +.\" Copyright (c) 2011 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd October 17, 2011 +.Dt CCOS 3 +.Os +.Sh NAME +.Nm ccos , +.Nm ccosf , +.Nm csin , +.Nm csinf , +.Nm ctan , +.Nm ctanf +.Nd complex trigonometric functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In complex.h +.Ft double complex +.Fn ccos "double complex z" +.Ft float complex +.Fn ccosf "float complex z" +.Ft double complex +.Fn csin "double complex z" +.Ft float complex +.Fn csinf "float complex z" +.Ft double complex +.Fn ctan "double complex z" +.Ft float complex +.Fn ctanf "float complex z" +.Sh DESCRIPTION +The +.Fn ccos , +.Fn csin , +and +.Fn ctan +functions compute the cosine, sine, and tangent of the complex number +.Fa z , +respectively. +The +.Fn ccosf , +.Fn csinf , +and +.Fn ctanf +functions perform the same operations in +.Fa float +precision. +.Sh SEE ALSO +.Xr cacos 3 , +.Xr ccosh 3 , +.Xr complex 3 , +.Xr cos 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr tan 3 +.Sh STANDARDS +These functions conform to +.St -isoC-99 . diff --git a/lib/msun/man/ccosh.3 b/lib/msun/man/ccosh.3 new file mode 100644 index 000000000000..cca8c097c4cf --- /dev/null +++ b/lib/msun/man/ccosh.3 @@ -0,0 +1,79 @@ +.\" Copyright (c) 2011 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd October 17, 2011 +.Dt CCOSH 3 +.Os +.Sh NAME +.Nm ccosh , +.Nm ccoshf , +.Nm csinh , +.Nm csinhf , +.Nm ctanh , +.Nm ctanhf +.Nd complex hyperbolic functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In complex.h +.Ft double complex +.Fn ccosh "double complex z" +.Ft float complex +.Fn ccoshf "float complex z" +.Ft double complex +.Fn csinh "double complex z" +.Ft float complex +.Fn csinhf "float complex z" +.Ft double complex +.Fn ctanh "double complex z" +.Ft float complex +.Fn ctanhf "float complex z" +.Sh DESCRIPTION +The +.Fn ccosh , +.Fn csinh , +and +.Fn ctanh +functions compute the hyperbolic cosine, sine, and tangent of the complex number +.Fa z , +respectively. +The +.Fn ccoshf , +.Fn csinhf , +and +.Fn ctanhf +functions perform the same operations in +.Fa float +precision. +.Sh SEE ALSO +.Xr cacosh 3 , +.Xr ccos 3 , +.Xr complex 3 , +.Xr cosh 3 , +.Xr math 3 , +.Xr sinh 3 , +.Xr tanh 3 +.Sh STANDARDS +These functions conform to +.St -isoC-99 . diff --git a/lib/msun/man/ceil.3 b/lib/msun/man/ceil.3 new file mode 100644 index 000000000000..9a0a5be89f64 --- /dev/null +++ b/lib/msun/man/ceil.3 @@ -0,0 +1,75 @@ +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 13, 2005 +.Dt CEIL 3 +.Os +.Sh NAME +.Nm ceil , +.Nm ceilf , +.Nm ceill +.Nd smallest integral value greater than or equal to x +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn ceil "double x" +.Ft float +.Fn ceilf "float x" +.Ft "long double" +.Fn ceill "long double x" +.Sh DESCRIPTION +The +.Fn ceil , +.Fn ceilf +and +.Fn ceill +functions return the smallest integral value +greater than or equal to +.Fa x , +expressed as a floating-point number. +.Sh SEE ALSO +.Xr abs 3 , +.Xr fabs 3 , +.Xr floor 3 , +.Xr ieee 3 , +.Xr math 3 , +.Xr rint 3 , +.Xr round 3 , +.Xr trunc 3 +.Sh STANDARDS +The +.Fn ceil +function conforms to +.St -isoC . +The +.Fn ceilf +and +.Fn ceill +functions conform to +.St -isoC-99 . diff --git a/lib/msun/man/cexp.3 b/lib/msun/man/cexp.3 new file mode 100644 index 000000000000..e65981e90627 --- /dev/null +++ b/lib/msun/man/cexp.3 @@ -0,0 +1,116 @@ +.\" Copyright (c) 2011 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd November 3, 2021 +.Dt CEXP 3 +.Os +.Sh NAME +.Nm cexp , +.Nm cexpf , +.Nm cexpl +.Nd complex exponential functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In complex.h +.Ft double complex +.Fn cexp "double complex z" +.Ft float complex +.Fn cexpf "float complex z" +.Ft long double complex +.Fn cexpl "long double complex z" +.Sh DESCRIPTION +The +.Fn cexp , +.Fn cexpf , +and +.Fn cexpl +functions compute the complex exponential of +.Fa z , +also known as +.Em cis Ns ( Ns +.Fa z Ns ) . +.Sh RETURN VALUES +For real numbers +.Fa x +and +.Fa y , +.Fn cexp +behaves according to Euler's formula: +.Bd -ragged -offset indent +.Fn cexp "x + I*y" += +.Po Sy e Ns ** Ns +.Fa x * +.Em cos Ns Po Ns +.Fa y Ns Pc Pc + Po Ns +.Sy I +* +.Sy e Ns ** Ns +.Fa x +* +.Em sin Ns Po Ns +.Fa y Ns Pc Pc +.Ed +.Pp +Generally speaking, infinities, zeroes and \*(Nas are handled as would +be expected from this identity given the usual rules of floating-point +arithmetic. +However, care is taken to avoid generating \*(Nas when they are not deserved. +For example, mathematically we expect that +.Fo cimag +.Fn cexp "x + I*0" Fc += 0 regardless of the value of +.Fa x , +and +.Fn cexp +preserves this identity even if +.Fa x +is \*(If or \*(Na. +Likewise, +.Fn cexp "-\*(If + I*y" += 0 and +.Fo creal +.Fn cexp "\*(If + I*y" Fc += \*(If +for any +.Fa y +(even though the latter property is only mathematically true for +representable +.Fa y . ) +If +.Fa y +is not finite, the sign of the result is indeterminate. +.Sh SEE ALSO +.Xr complex 3 , +.Xr exp 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn cexp , +.Fn cexpf , +and +.Fn cexpl +functions conform to +.St -isoC-99 . diff --git a/lib/msun/man/cimag.3 b/lib/msun/man/cimag.3 new file mode 100644 index 000000000000..684040aac1aa --- /dev/null +++ b/lib/msun/man/cimag.3 @@ -0,0 +1,119 @@ +.\" Copyright (c) 2004 Stefan Farfeleder +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd August 7, 2008 +.Dt CIMAG 3 +.Os +.Sh NAME +.Nm cimag , cimagf , cimagl , +.Nm conj , conjf , conjl , +.Nm cproj , cprojf , cprojl , +.Nm creal , crealf , creall +.Nd "functions to manipulate complex numbers" +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In complex.h +.Ft double +.Fn cimag "double complex z" +.Ft float +.Fn cimagf "float complex z" +.Ft "long double" +.Fn cimagl "long double complex z" +.Ft "double complex" +.Fn conj "double complex z" +.Ft "float complex" +.Fn conjf "float complex z" +.Ft "long double complex" +.Fn conjl "long double complex z" +.Ft "double complex" +.Fn cproj "double complex z" +.Ft "float complex" +.Fn cprojf "float complex z" +.Ft "long double complex" +.Fn cprojl "long double complex z" +.Ft double +.Fn creal "double complex z" +.Ft float +.Fn crealf "float complex z" +.Ft "long double" +.Fn creall "long double complex z" +.Sh DESCRIPTION +Let +.Sm off +.Fa a + b * Em i +.Sm on +denote the complex number +.Fa z . +.Pp +The +.Fn creal +functions return the real part +.Fa a , +and the +.Fn cimag +functions return the imaginary part +.Fa b . +.Pp +The +.Fn conj +functions return the complex conjugate +.Sm off +.Fa a - b * Em i . +.Sm on +.Pp +The +.Fn cproj +functions return the projection onto the Riemann sphere. +If +.Fa z +contains an infinite component, then the result is +.Fa \*(If \*(Pm 0 Ns * Ns Em i , +where the (zero) imaginary part of the result has the same sign as +.Fa b . +Otherwise, the result is +.Fa z . +.Pp +These functions do not signal any floating point exceptions. +.Sh STANDARDS +The +.Fn cimag , +.Fn conj , +.Fn cproj , +and +.Fn creal +functions conform to +.St -isoC-99 . +.Sh HISTORY +The +.Fn cimag , +.Fn conj +and +.Fn creal +functions first appeared in +.Fx 5.3 . +The +.Fn cproj +functions appeared in +.Fx 8.0 . diff --git a/lib/msun/man/clog.3 b/lib/msun/man/clog.3 new file mode 100644 index 000000000000..db54e100ba78 --- /dev/null +++ b/lib/msun/man/clog.3 @@ -0,0 +1,99 @@ +.\" Copyright (c) 2017 Steven G. Kargl <kargl@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd June 6, 2018 +.Dt CLOG 3 +.Os +.Sh NAME +.Nm clog , +.Nm clogf +and +.Nm clogl +.Nd complex natural logarithm functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In complex.h +.Ft double complex +.Fn clog "double complex z" +.Ft float complex +.Fn clogf "float complex z" +.Ft long double complex +.Fn clogl "long double complex z" +.Sh DESCRIPTION +The +.Fn clog , +.Fn clogf , +and +.Fn clogl +functions compute the complex natural logarithm of +.Fa z . +with a branch cut along the negative real axis . +.Sh RETURN VALUES +The +.Fn clog +function returns the complex natural logarithm value, in the +range of a strip mathematically unbounded along the real axis and in +the interval [-I* \*(Pi , +I* \*(Pi ] along the imaginary axis. +The function satisfies the relationship: +.Fo clog +.Fn conj "z" Fc += +.Fo conj +.Fn clog "z" Fc . +.Pp +.\" Table is formatted for an 80-column xterm. +.Bl -column ".Sy +\*(If + I*\*(Na" ".Sy Return value" ".Sy Divide-by-zero exception" +.It Sy Argument Ta Sy Return value Ta Sy Comment +.It -0 + I*0 Ta -\*(If + I*\*(Pi Ta Divide-by-zero exception +.It Ta Ta raised +.It +0 + I*0 Ta -\*(If + I*0 Ta Divide by zero exception +.It Ta Ta raised +.It x + I*\*(If Ta +\*(If + I*\*(Pi/2 Ta For finite x +.It x + I*\*(Na Ta \*(Na + I*\*(Na Ta Optionally raises invalid +.It Ta Ta floating-point exception +.It Ta Ta for finite x +.It -\*(If + I*y Ta +\*(If + I*\*(Pi Ta For finite positive-signed y +.It +\*(If + I*y Ta +\*(If + I*0 Ta For finite positive-signed y +.It -\*(If + I*\*(If Ta +\*(If + I*3\*(Pi/4 +.It +\*(If + I*\*(If Ta +\*(If + I*\*(Pi/4 +.It \*(Pm\*(If + I*\*(Na Ta +\*(If + I*\*(Na +.It \*(Na + I*y Ta \*(Na + I*\*(Na Ta Optionally raises invalid +.It Ta Ta floating-point exception +.It Ta Ta for finite y +.It \*(Na + I*\*(If Ta +\*(If + I*\*(Na +.It \*(Na + I*\*(Na Ta \*(Na + I*\*(Na +.El +.Sh SEE ALSO +.Xr complex 3 , +.Xr log 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn clog , +.Fn cexpf , +and +.Fn clogl +functions conform to +.St -isoC-99 . diff --git a/lib/msun/man/complex.3 b/lib/msun/man/complex.3 new file mode 100644 index 000000000000..8465311e7a4b --- /dev/null +++ b/lib/msun/man/complex.3 @@ -0,0 +1,127 @@ +.\" Copyright (c) 2011 Murray Stokely <murray@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd November 3, 2021 +.Dt COMPLEX 3 +.Os +.Sh NAME +.Nm complex +.Nd "complex arithmetic" +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In complex.h +.Sh DESCRIPTION +These functions support complex arithmetic in the C math library. +.Sh "LIST OF FUNCTIONS" +Each of the following +.Vt "double complex" +functions has a +.Vt "float complex" +counterpart with an +.Ql f +appended to the name and a +.Vt "long double complex" +counterpart with an +.Ql l +appended. +As an example, the +.Vt "float complex" +and +.Vt "long double complex" +counterparts of +.Ft double +.Fn cabs "double complex z" +are +.Ft float +.Fn cabsf "float complex z" +and +.Ft "long double" +.Fn cabsl "long double complex z" , +respectively. +.de Cl +.Bl -column "csqrt" "complex absolute value (i.e., norm, modulus, magnitude)" +.Em "Name Description" +.. +.\" Section 7.3.5 - 7.3.7 of ISO C99 standard unimplemented, see BUGS +.\" Section 7.3.8 of ISO C99 standard +.Ss Absolute-value Functions +.Cl +cabs complex absolute value (i.e., norm, modulus, magnitude) +csqrt complex square root +.El +.Ss Exponential Function +.Cl +cexp exponential base e +.El +.Ss Natural logarithm Function +.Cl +clog natural logarithm +.El +.\" Section 7.3.9 of ISO C99 standard +.Ss Manipulation Functions +.Cl +carg compute the argument (i.e., phase angle) +cimag compute the imaginary part +conj compute the complex conjugate +cproj compute projection onto Riemann sphere +creal compute the real part +.El +.\" Section 7.3.5-6 of ISO C99 standard +.Ss Trigonometric and Hyperbolic Functions +.Cl +cacos arc cosine +cacosh arc hyperbolic cosine +casin arc sine +casinh arc hyperbolic sine +catan arc tangent +catanh arc hyperbolic tangent +ccos cosine +ccosh hyperbolic cosine +cpow power function +csin sine +csinh hyperbolic sine +ctan tangent +ctanh hyperbolic tangent +.El +.Sh SEE ALSO +.Xr fenv 3 , +.Xr ieee 3 , +.Xr math 3 , +.Xr tgmath 3 +.Rs +.%T "ISO/IEC 9899:TC3" +.%U http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf +.Re +.Sh STANDARDS +The +.In complex.h +functions described here conform to +.St -isoC-99 . +.Sh BUGS +The power functions, +.Fn cpowf, cpow , +and +.Fn cpowl , +are implemented, but the code was neither reviewed nor tested. diff --git a/lib/msun/man/copysign.3 b/lib/msun/man/copysign.3 new file mode 100644 index 000000000000..091164fbeda9 --- /dev/null +++ b/lib/msun/man/copysign.3 @@ -0,0 +1,83 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 26, 2005 +.Dt COPYSIGN 3 +.Os +.Sh NAME +.Nm copysign , +.Nm copysignf , +.Nm copysignl +.Nd copy sign +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn copysign "double x" "double y" +.Ft float +.Fn copysignf "float x" "float y" +.Ft long double +.Fn copysignl "long double x" "long double y" +.Sh DESCRIPTION +The +.Fn copysign , +.Fn copysignf +and +.Fn copysignl +functions +return +.Fa x +with its sign changed to +.Fa y Ns 's . +.Sh SEE ALSO +.Xr fabs 3 , +.Xr fdim 3 , +.Xr ieee 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn copysign , +.Fn copysignf , +and +.Fn copysignl +routines conform to +.St -isoC-99 . +They implement the Copysign function recommended by +.St -ieee754 . +.Sh HISTORY +The +.Fn copysign , +.Fn copysignf , +and +.Fn copysignl +functions appeared in +.Bx 4.3 , +.Fx 2.0 , +and +.Fx 5.3 , +respectively. diff --git a/lib/msun/man/cos.3 b/lib/msun/man/cos.3 new file mode 100644 index 000000000000..4b5223b37261 --- /dev/null +++ b/lib/msun/man/cos.3 @@ -0,0 +1,85 @@ +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 1, 2020 +.Dt COS 3 +.Os +.Sh NAME +.Nm cos , +.Nm cosf , +.Nm cosl +.Nd cosine functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn cos "double x" +.Ft float +.Fn cosf "float x" +.Ft long double +.Fn cosl "long double x" +.Sh DESCRIPTION +The +.Fn cos , +.Fn cosf , +and +.Fn cosl +functions compute the cosine of +.Fa x +(measured in radians). +A large magnitude argument may yield a result with little or no +significance. +For a discussion of error due to roundoff, see +.Xr math 3 . +.Sh RETURN VALUES +The +.Fn cos , +.Fn cosf , +and +.Fn cosl +functions return the cosine value. +.Sh SEE ALSO +.Xr acos 3 , +.Xr asin 3 , +.Xr atan 3 , +.Xr atan2 3 , +.Xr ccos 3 , +.Xr cosh 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr sinh 3 , +.Xr tan 3 , +.Xr tanh 3 +.Sh STANDARDS +These functions conform to +.St -isoC-99 . +.Sh HISTORY +The +.Fn cos +function first appeared in +.At v1 . diff --git a/lib/msun/man/cosh.3 b/lib/msun/man/cosh.3 new file mode 100644 index 000000000000..22105f259817 --- /dev/null +++ b/lib/msun/man/cosh.3 @@ -0,0 +1,75 @@ +.\" Copyright (c) 1989, 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 3, 2022 +.Dt COSH 3 +.Os +.Sh NAME +.Nm cosh , +.Nm coshf , +.Nm coshl +.Nd hyperbolic cosine functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn cosh "double x" +.Ft float +.Fn coshf "float x" +.Ft long double +.Fn coshl "long double x" +.Sh DESCRIPTION +The +.Fn cosh , +.Fn coshf , +and +.Fn coshl +functions compute the hyperbolic cosine of +.Fa x . +.Sh SEE ALSO +.Xr acos 3 , +.Xr asin 3 , +.Xr atan 3 , +.Xr atan2 3 , +.Xr ccosh 3 , +.Xr cos 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr sinh 3 , +.Xr tan 3 , +.Xr tanh 3 +.Sh STANDARDS +The +.Fn cosh +function conforms to +.St -isoC . +.Sh HISTORY +The +.Fn cosh +function first appeared in +.At v7 . diff --git a/lib/msun/man/cospi.3 b/lib/msun/man/cospi.3 new file mode 100644 index 000000000000..86e63fb77498 --- /dev/null +++ b/lib/msun/man/cospi.3 @@ -0,0 +1,103 @@ +.\" Copyright (c) 2017 Steven G. Kargl <kargl@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 1, 2017 +.Dt COSPI 3 +.Os +.Sh NAME +.Nm cospi , +.Nm cospif , +.Nm cospil +.Nd half\(encycle cosine functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn cospi "double x" +.Ft float +.Fn cospif "float x" +.Ft long double +.Fn cospil "long double x" +.Sh DESCRIPTION +The +.Fn cospi , +.Fn cospif , +and +.Fn cospil +functions compute the cosine of +.Fa "\(*p \(mu x" . +and measure angles in half-cycles. +.Sh RETURN VALUES +The +.Fn cospi , +.Fn cospif , +and +.Fn cospil +functions returns +.Fn cos "\(*p \(mu x" . +If \*(Bax\*(Ba \*(Ge 2^(p - 1) +where p is the floating\(enpoint precision of +.Ar x , +then the returned value is 1 and it has no significance. +.Sh SPECIAL VALUES +.Bl -tag -width "cospi(+n/2)" +.It Fn cospi \*(Pm0 +returns 1. +.It Fn cospi \*(Pmn/2 +returns 0 for positive integers +.Ar n . +.It Fn cospi n +returns 1 for even integers +.Ar n . +.It Fn cospi n +returns \-1 for odd integers +.Ar n . +.It Fn cospi \*(Pm\(if +return an \*(Na and raises an FE_INVALID exception. +.It Fn cospi \*(Na +return an \*(Na and raises an FE_INVALID exception. +.El +.Sh SEE ALSO +.Xr cos 3 , +.Xr fenv 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr sinpi 3 , +.Xr tan 3 , +.Xr tanpi 3 +.Sh AUTHORS +The half\(encycle trignometric functions were written by +.An Steven G. Kargl Aq Mt kargl@FreeBSD.org . +.Sh STANDARDS +These functions conform to +IEEE Std 754\(tm\(en2008 , +\(dqIEEE Standard for Floating-Point Arithmetic\(dq +and to +ISO/IEC TS 18661-4 , +\(dqInformation technology \(em Programming languages, their environments, +and system software interfaces \(em Floating\(enpoint extensions for +C\(dq \(em Part 4: Supplementary functions. + + diff --git a/lib/msun/man/cpow.3 b/lib/msun/man/cpow.3 new file mode 100644 index 000000000000..0faa9d57a169 --- /dev/null +++ b/lib/msun/man/cpow.3 @@ -0,0 +1,62 @@ +.\" Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org> +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: June 5 2013 $ +.Dt CPOW 3 +.Os +.Sh NAME +.Nm cpow , +.Nm cpowf , +.Nm cpowl +.Nd complex power functions +.Sh SYNOPSIS +.In complex.h +.Ft double complex +.Fn cpow "double complex x" "double complex z" +.Ft float complex +.Fn cpowf "float complex x" "float complex z" +.Ft long double complex +.Fn cpowl "long double complex x" "long double complex z" +.Sh DESCRIPTION +The +.Fn cpow , +.Fn cpowf +and +.Fn cpowl +functions compute the complex number +.Fa x +raised to the complex power +.Fa z , +with a branch cut along the negative real axis for the first argument. +.Sh RETURN VALUES +The +.Fn cpow , +.Fn cpowf +and +.Fn cpowl +functions return the complex number +.Fa x +raised to the complex power +.Fa z . +.Sh SEE ALSO +.Xr cexp 3 , +.Xr clog 3 +.Sh STANDARDS +The +.Fn cpow , +.Fn cpowf +and +.Fn cpowl +functions conform to +.St -isoC-99 . diff --git a/lib/msun/man/csqrt.3 b/lib/msun/man/csqrt.3 new file mode 100644 index 000000000000..a5f667c8fdd6 --- /dev/null +++ b/lib/msun/man/csqrt.3 @@ -0,0 +1,100 @@ +.\" Copyright (c) 2007-2008 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd November 4, 2018 +.Dt CSQRT 3 +.Os +.Sh NAME +.Nm csqrt , +.Nm csqrtf , +.Nm csqrtl +.Nd complex square root functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In complex.h +.Ft double complex +.Fn csqrt "double complex z" +.Ft float complex +.Fn csqrtf "float complex z" +.Ft long double complex +.Fn csqrtl "long double complex z" +.Sh DESCRIPTION +The +.Fn csqrt , +.Fn csqrtf , +and +.Fn csqrtl +functions compute the square root of +.Fa z +in the complex plane, with a branch cut along the negative real axis. +In other words, +.Fn csqrt , +.Fn csqrtf , +and +.Fn csqrtl +always return the square root whose real part is non-negative. +.Sh RETURN VALUES +These functions return the requested square root. +The square root of 0 is +.Li +0 \*(Pm 0 , +where the imaginary parts of the input and respective result have +the same sign. +For infinities and \*(Nas, the following rules apply, with the +earlier rules having precedence: +.Bl -column -offset indent "-\*(If + \*(Na*I" "\*(If \*(Pm \*(If*I " "(for all k)" +.Em "Input" Ta Em "Result" Ta \& +k + \*(If*I \*(If + \*(If*I (for all k) +-\*(If + \*(Na*I \*(Na \*(Pm \*(If*I \& +\*(If + \*(Na*I \*(If + \*(Na*I \& +k + \*(Na*I \*(Na + \*(Na*I \& +\*(Na + k*I \*(Na + \*(Na*I \& +-\*(If + k*I +0 + \*(If*I \& +\*(If + k*I \*(If + 0*I \& +.El +.Pp +For numbers with negative imaginary parts, the above special cases +apply given the identity: +.Dl csqrt(conj(z)) = conj(csqrt(z)) +Note that the sign of \*(Na is indeterminate. +Also, if the real or imaginary part of the input is finite and +an \*(Na is generated, an invalid exception will be thrown. +.Sh SEE ALSO +.Xr cabs 3 , +.Xr fenv 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn csqrt , +.Fn csqrtf , +and +.Fn csqrtl +functions conform to +.St -isoC-99 . +.Sh BUGS +For +.Fn csqrt +and +.Fn csqrtl , +inexact results are not always correctly rounded. diff --git a/lib/msun/man/erf.3 b/lib/msun/man/erf.3 new file mode 100644 index 000000000000..8d66017ed11c --- /dev/null +++ b/lib/msun/man/erf.3 @@ -0,0 +1,106 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd June 23, 2024 +.Dt ERF 3 +.Os +.Sh NAME +.Nm erf , +.Nm erff , +.Nm erfl , +.Nm erfc , +.Nm erfcf , +.Nm erfcl +.Nd error function operators +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn erf "double x" +.Ft float +.Fn erff "float x" +.Ft "long double" +.Fn erfl "long double x" +.Ft double +.Fn erfc "double x" +.Ft float +.Fn erfcf "float x" +.Ft "long double" +.Fn erfcl "long double x" +.Sh DESCRIPTION +These functions calculate the error function of +.Fa x . +.Pp +The +.Fn erf , +.Fn erff , +and +.Fn erfl +functions calculate the error function of x; where +.Bd -ragged -offset indent +.if n \{\ +erf(x) = 2/sqrt(pi)\(**\|integral from 0 to x of exp(\-t\(**t) dt. +\} +.if t \{\ +erf\|(x) := +(2/\(sr\(*p)\|\(is\d\s8\z0\s10\u\u\s8x\s10\d\|exp(\-t\u\s82\s10\d)\|dt. +\} +.Ed +.Pp +The +.Fn erfc , +.Fn erfcf , +and +.Fn erfcl +functions calculate the complementary error function of +.Fa x ; +that is +.Fn erfc +subtracts the result of the error function +.Fn erf x +from 1.0. +.Sh SEE ALSO +.Xr math 3 +.Sh STANDARDS +The +.Fn erf , +.Fn erff , +.Fn erfl , +.Fn erfc , +.Fn erfcf +and +.Fn erfcl +functions conform to +.St -isoC-99 . +.Sh HISTORY +The +.Fn erf +and +.Fn erfc +functions appeared in +.Bx 4.3 . diff --git a/lib/msun/man/exp.3 b/lib/msun/man/exp.3 new file mode 100644 index 000000000000..a94c372fa0f5 --- /dev/null +++ b/lib/msun/man/exp.3 @@ -0,0 +1,194 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 1, 2020 +.Dt EXP 3 +.Os +.Sh NAME +.Nm exp , +.Nm expf , +.Nm expl , +.\" The sorting error is intentional. exp, expf, and expl should be adjacent. +.Nm exp2 , +.Nm exp2f , +.Nm exp2l , +.Nm expm1 , +.Nm expm1f , +.Nm expm1l , +.Nm pow , +.Nm powf , +.Nm powl +.Nd exponential and power functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn exp "double x" +.Ft float +.Fn expf "float x" +.Ft long double +.Fn expl "long double x" +.Ft double +.Fn exp2 "double x" +.Ft float +.Fn exp2f "float x" +.Ft long double +.Fn exp2l "long double x" +.Ft double +.Fn expm1 "double x" +.Ft float +.Fn expm1f "float x" +.Ft long double +.Fn expm1l "long double x" +.Ft double +.Fn pow "double x" "double y" +.Ft float +.Fn powf "float x" "float y" +.Ft long double +.Fn powl "long double x" "long double y" +.Sh DESCRIPTION +The +.Fn exp , +.Fn expf , +and +.Fn expl +functions compute the base +.Ms e +exponential value of the given argument +.Fa x . +.Pp +The +.Fn exp2 , +.Fn exp2f , +and +.Fn exp2l +functions compute the base 2 exponential of the given argument +.Fa x . +.Pp +The +.Fn expm1 , +.Fn expm1f , +and the +.Fn expm1l +functions compute the value exp(x)\-1 accurately even for tiny argument +.Fa x . +.Pp +The +.Fn pow , +.Fn powf , +and the +.Fn powl +functions compute the value +of +.Fa x +to the exponent +.Fa y . +.Sh ERROR (due to Roundoff etc.) +The values of +.Fn exp 0 , +.Fn expm1 0 , +.Fn exp2 integer , +and +.Fn pow integer integer +are exact provided that they are representable. +.\" XXX Is this really true for pow()? +Otherwise the error in these functions is generally below one +.Em ulp . +.Sh RETURN VALUES +These functions will return the appropriate computation unless an error +occurs or an argument is out of range. +The functions +.Fn pow x y , +.Fn powf x y , +and +.Fn powl x y +raise an invalid exception and return an \*(Na if +.Fa x +< 0 and +.Fa y +is not an integer. +.Sh NOTES +The function +.Fn pow x 0 +returns x**0 = 1 for all x including x = 0, \*(If, and \*(Na . +Previous implementations of pow may +have defined x**0 to be undefined in some or all of these +cases. +Here are reasons for returning x**0 = 1 always: +.Bl -enum -width indent +.It +Any program that already tests whether x is zero (or +infinite or \*(Na) before computing x**0 cannot care +whether 0**0 = 1 or not. +Any program that depends +upon 0**0 to be invalid is dubious anyway since that +expression's meaning and, if invalid, its consequences +vary from one computer system to another. +.It +Some Algebra texts (e.g.\& Sigler's) define x**0 = 1 for +all x, including x = 0. +This is compatible with the convention that accepts a[0] +as the value of polynomial +.Bd -literal -offset indent +p(x) = a[0]\(**x**0 + a[1]\(**x**1 + a[2]\(**x**2 +...+ a[n]\(**x**n +.Ed +.Pp +at x = 0 rather than reject a[0]\(**0**0 as invalid. +.It +Analysts will accept 0**0 = 1 despite that x**y can +approach anything or nothing as x and y approach 0 +independently. +The reason for setting 0**0 = 1 anyway is this: +.Bd -ragged -offset indent +If x(z) and y(z) are +.Em any +functions analytic (expandable +in power series) in z around z = 0, and if there +x(0) = y(0) = 0, then x(z)**y(z) \(-> 1 as z \(-> 0. +.Ed +.It +If 0**0 = 1, then +\*(If**0 = 1/0**0 = 1 too; and +then \*(Na**0 = 1 too because x**0 = 1 for all finite +and infinite x, i.e., independently of x. +.El +.Sh SEE ALSO +.Xr clog 3 , +.Xr cpow 3 , +.Xr fenv 3 , +.Xr ldexp 3 , +.Xr log 3 , +.Xr math 3 +.Sh STANDARDS +These functions conform to +.St -isoC-99 . +.Sh HISTORY +The +.Fn exp +function appeared in +.At v1 . diff --git a/lib/msun/man/fabs.3 b/lib/msun/man/fabs.3 new file mode 100644 index 000000000000..031b6aa54d18 --- /dev/null +++ b/lib/msun/man/fabs.3 @@ -0,0 +1,78 @@ +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd October 25, 2003 +.Dt FABS 3 +.Os +.Sh NAME +.Nm fabs , +.Nm fabsf , +.Nm fabsl +.Nd floating-point absolute value functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn fabs "double x" +.Ft float +.Fn fabsf "float x" +.Ft long double +.Fn fabsl "long double x" +.Sh DESCRIPTION +The +.Fn fabs , +.Fn fabsf +and +.Fn fabsl +functions compute the absolute value of a floating-point number +.Fa x . +.Sh RETURN VALUES +The +.Fn fabs , +.Fn fabsf +and +.Fn fabsl +functions return the absolute value of +.Fa x . +.Sh SEE ALSO +.Xr abs 3 , +.Xr ceil 3 , +.Xr floor 3 , +.Xr ieee 3 , +.Xr math 3 , +.Xr rint 3 +.Sh STANDARDS +The +.Fn fabs +function conforms to +.St -isoC . +The +.Fn fabsf +and +.Fn fabsl +functions conform to +.St -isoC-99 . diff --git a/lib/msun/man/fdim.3 b/lib/msun/man/fdim.3 new file mode 100644 index 000000000000..69b01cee1018 --- /dev/null +++ b/lib/msun/man/fdim.3 @@ -0,0 +1,84 @@ +.\" Copyright (c) 2004 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd June 29, 2004 +.Dt FDIM 3 +.Os +.Sh NAME +.Nm fdim , +.Nm fdimf , +.Nm fdiml +.Nd positive difference functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn fdim "double x" "double y" +.Ft float +.Fn fdimf "float x" "float y" +.Ft long double +.Fn fdiml "long double x" "long double y" +.Sh DESCRIPTION +The +.Fn fdim , +.Fn fdimf , +and +.Fn fdiml +functions return the positive difference between +.Fa x +and +.Fa y . +That is, if +.Fa x\- Ns Fa y +is positive, then +.Fa x\- Ns Fa y +is returned. +If either +.Fa x +or +.Fa y +is an \*(Na, then an \*(Na is returned. +Otherwise, the result is +.Li +0.0 . +.Pp +Overflow or underflow may occur if the exact result is not +representable in the return type. +No other exceptions are raised. +.Sh SEE ALSO +.Xr fabs 3 , +.Xr fmax 3 , +.Xr fmin 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn fdim , +.Fn fdimf , +and +.Fn fdiml +functions conform to +.St -isoC-99 . +.Sh HISTORY +These routines first appeared in +.Fx 5.3 . diff --git a/lib/msun/man/feclearexcept.3 b/lib/msun/man/feclearexcept.3 new file mode 100644 index 000000000000..e3bb2fd8842f --- /dev/null +++ b/lib/msun/man/feclearexcept.3 @@ -0,0 +1,137 @@ +.\" Copyright (c) 2004 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd May 8, 2004 +.Dt FECLEAREXCEPT 3 +.Os +.Sh NAME +.Nm feclearexcept , +.Nm fegetexceptflag , +.Nm feraiseexcept , +.Nm fesetexceptflag , +.Nm fetestexcept +.Nd floating-point exception flag manipulation +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In fenv.h +.Fd "#pragma STDC FENV_ACCESS ON" +.Ft int +.Fn feclearexcept "int excepts" +.Ft int +.Fn fegetexceptflag "fexcept_t *flagp" "int excepts" +.Ft int +.Fn feraiseexcept "int excepts" +.Ft int +.Fn fesetexceptflag "const fexcept_t *flagp" "int excepts" +.Ft int +.Fn fetestexcept "int excepts" +.Sh DESCRIPTION +The +.Fn feclearexcept +routine clears the floating-point exception flags specified by +.Fa excepts , +whereas +.Fn feraiseexcept +raises the specified exceptions. +Raising an exception causes the corresponding flag to be set, +and a +.Dv SIGFPE +is delivered to the process if the exception is unmasked. +.Pp +The +.Fn fetestexcept +function determines which flags are currently set, of those specified by +.Fa excepts . +.Pp +The +.Fn fegetexceptflag +function stores the state of the exception flags specified in +.Fa excepts +in the opaque object pointed to by +.Fa flagp . +Similarly, +.Fn fesetexceptflag +changes the specified exception flags to reflect the state stored in +the object pointed to by +.Fa flagp . +Note that the flags restored with +.Fn fesetexceptflag +must be a (not necessarily proper) subset of the flags recorded by +a prior call to +.Fn fegetexceptflag . +.Pp +For all of these functions, the possible types of exceptions +include those described in +.Xr fenv 3 . +Some architectures may define other types of floating-point exceptions. +.Sh IMPLEMENTATION NOTES +On some architectures, raising an overflow or underflow exception +also causes an inexact exception to be raised. +In these cases, the overflow or underflow will be raised first. +.Pp +The +.Fn fegetexceptflag +and +.Fn fesetexceptflag +routines are preferred to +.Fn fetestexcept +and +.Fn feraiseexcept , +respectively, for saving and restoring exception flags. +The latter do not re-raise exceptions and may preserve +architecture-specific information such as addresses where +exceptions occurred. +.Sh RETURN VALUES +The +.Fn feclearexcept , +.Fn fegetexceptflag , +.Fn feraiseexcept , +and +.Fn fesetexceptflag +functions return 0 upon success, and non-zero otherwise. +The +.Fn fetestexcept +function returns the bitwise OR of the values of the current exception +flags that were requested. +.Sh SEE ALSO +.Xr sigaction 2 , +.Xr feholdexcept 3 , +.Xr fenv 3 , +.Xr feupdateenv 3 , +.Xr fpgetsticky 3 , +.Xr fpresetsticky 3 +.Sh STANDARDS +The +.Fn feclearexcept , +.Fn fegetexceptflag , +.Fn feraiseexcept , +.Fn fesetexceptflag , +and +.Fn fetestexcept +routines conform to +.St -isoC-99 . +.Sh HISTORY +These functions first appeared in +.Fx 5.3 . diff --git a/lib/msun/man/feenableexcept.3 b/lib/msun/man/feenableexcept.3 new file mode 100644 index 000000000000..db94825990a5 --- /dev/null +++ b/lib/msun/man/feenableexcept.3 @@ -0,0 +1,96 @@ +.\" Copyright (c) 2004 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd March 16, 2005 +.Dt FEENABLEEXCEPT 3 +.Os +.Sh NAME +.Nm feenableexcept , +.Nm fedisableexcept , +.Nm fegetexcept +.Nd floating-point exception masking +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In fenv.h +.Fd "#pragma STDC FENV_ACCESS ON" +.Ft int +.Fn feenableexcept "int excepts" +.Ft int +.Fn fedisableexcept "int excepts" +.Ft int +.Fn fegetexcept "void" +.Sh DESCRIPTION +The +.Fn feenableexcept +and +.Fn fedisableexcept +functions +unmask and mask (respectively) exceptions specified in +.Fa excepts . +The +.Fn fegetexcept +function +returns the current exception mask. +All exceptions are masked by default. +.Pp +Floating-point operations that produce unmasked exceptions will trap, and a +.Dv SIGFPE +will be delivered to the process. +By installing a signal handler for +.Dv SIGFPE , +applications can take appropriate action immediately without +testing the exception flags after every operation. +Note that the trap may not be immediate, but it should occur +before the next floating-point instruction is executed. +.Pp +For all of these functions, the possible types of exceptions +include those described in +.Xr fenv 3 . +Some architectures may define other types of floating-point exceptions. +.Sh RETURN VALUES +The +.Fn feenableexcept , +.Fn fedisableexcept , +and +.Fn fegetexcept +functions return a bitmap of the exceptions that were unmasked +prior to the call. +.Sh SEE ALSO +.Xr sigaction 2 , +.Xr feclearexcept 3 , +.Xr feholdexcept 3 , +.Xr fenv 3 , +.Xr feupdateenv 3 +.Sh BUGS +Functions in the standard library may trigger exceptions multiple +times as a result of intermediate computations; +however, they generally do not trigger spurious exceptions. +.Pp +No interface is provided to permit exceptions to be handled in +nontrivial ways. +There is no uniform way for an exception handler to access +information about the exception-causing instruction, or +to determine whether that instruction should be reexecuted +after returning from the handler. diff --git a/lib/msun/man/fegetenv.3 b/lib/msun/man/fegetenv.3 new file mode 100644 index 000000000000..9e77149a6f04 --- /dev/null +++ b/lib/msun/man/fegetenv.3 @@ -0,0 +1,111 @@ +.\" Copyright (c) 2004 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd May 8, 2004 +.Dt FEGETENV 3 +.Os +.Sh NAME +.Nm fegetenv , +.Nm feholdexcept , +.Nm fesetenv , +.Nm feupdateenv +.Nd floating-point environment save and restore +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In fenv.h +.Fd "#pragma STDC FENV_ACCESS ON" +.Ft int +.Fn fegetenv "fenv_t *envp" +.Ft int +.Fn feholdexcept "fenv_t *envp" +.Ft int +.Fn fesetenv "const fenv_t *envp" +.Ft int +.Fn feupdateenv "const fenv_t *envp" +.Sh DESCRIPTION +The floating-point environment includes exception flags and masks, the +current rounding mode, and other architecture-specific settings. +However, it does not include the floating-point register file. +.Pp +The +.Fn fegetenv +function stores the current floating-point environment in the object +pointed to by +.Fa envp , +whereas +.Fn feholdexcept +saves the current environment, then clears all exception flags +and masks all floating-point exceptions. +.Pp +The +.Fn fesetenv +function restores a previously saved environment. +The +.Fn feupdateenv +function restores a saved environment as well, but it also +raises any exceptions that were set in the environment it +replaces. +.Pp +The +.Fn feholdexcept +function is often used with +.Fn feupdateenv +or +.Fn fesetenv +to suppress spurious exceptions that occur as a result of +intermediate computations. +An example in +.Xr fenv 3 +demonstrates how to do this. +.Sh RETURN VALUES +The +.Fn fegetenv , +.Fn feholdexcept , +.Fn fesetenv , +and +.Fn feupdateenv +functions return 0 if they succeed, and non-zero otherwise. +.Sh SEE ALSO +.Xr feclearexcept 3 , +.Xr fenv 3 , +.Xr feraiseexcept 3 , +.Xr fesetenv 3 , +.Xr fetestexcept 3 , +.Xr fpgetmask 3 , +.Xr fpgetprec 3 , +.Xr fpsetmask 3 , +.Xr fpsetprec 3 +.Sh STANDARDS +The +.Fn fegetenv , +.Fn feholdexcept , +.Fn fesetenv , +and +.Fn feupdateenv +functions conform to +.St -isoC-99 . +.Sh HISTORY +These routines first appeared in +.Fx 5.3 . diff --git a/lib/msun/man/fegetround.3 b/lib/msun/man/fegetround.3 new file mode 100644 index 000000000000..b41ef93322a1 --- /dev/null +++ b/lib/msun/man/fegetround.3 @@ -0,0 +1,81 @@ +.\" Copyright (c) 2004 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd May 8, 2004 +.Dt FEGETROUND 3 +.Os +.Sh NAME +.Nm fegetround , +.Nm fesetround +.Nd floating-point rounding control +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In fenv.h +.Fd "#pragma STDC FENV_ACCESS ON" +.Ft int +.Fn fegetround void +.Ft int +.Fn fesetround "int round" +.Sh DESCRIPTION +The +.Fn fegetround +function determines the current floating-point rounding mode, +and the +.Fn fesetround +function sets the current rounding mode to +.Fa round . +The rounding mode is one of +.Dv FE_TONEAREST , FE_DOWNWARD , FE_UPWARD , +or +.Dv FE_TOWARDZERO , +as described in +.Xr fenv 3 . +.Sh RETURN VALUES +The +.Fn fegetround +routine returns the current rounding mode. +The +.Fn fesetround +function returns 0 on success and non-zero otherwise; +however, the present implementation always succeeds. +.Sh SEE ALSO +.Xr fenv 3 , +.Xr fpgetround 3 , +.Xr fpsetround 3 +.Sh STANDARDS +The +.Fn fegetround +and +.Fn fesetround +functions conform to +.St -isoC-99 . +.Sh HISTORY +These routines first appeared in +.Fx 5.3 . +They supersede the non-standard +.Xr fpgetround 3 +and +.Xr fpsetround 3 +functions. diff --git a/lib/msun/man/fenv.3 b/lib/msun/man/fenv.3 new file mode 100644 index 000000000000..ee67ef29bae1 --- /dev/null +++ b/lib/msun/man/fenv.3 @@ -0,0 +1,291 @@ +.\" Copyright (c) 2004 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd March 16, 2005 +.Dt FENV 3 +.Os +.Sh NAME +.Nm feclearexcept , +.Nm fegetexceptflag , +.Nm feraiseexcept , +.Nm fesetexceptflag , +.Nm fetestexcept , +.Nm fegetround , +.Nm fesetround , +.Nm fegetenv , +.Nm feholdexcept , +.Nm fesetenv , +.Nm feupdateenv , +.Nm feenableexcept , +.Nm fedisableexcept , +.Nm fegetexcept +.Nd floating-point environment control +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In fenv.h +.Fd "#pragma STDC FENV_ACCESS ON" +.Ft int +.Fn feclearexcept "int excepts" +.Ft int +.Fn fegetexceptflag "fexcept_t *flagp" "int excepts" +.Ft int +.Fn feraiseexcept "int excepts" +.Ft int +.Fn fesetexceptflag "const fexcept_t *flagp" "int excepts" +.Ft int +.Fn fetestexcept "int excepts" +.Ft int +.Fn fegetround void +.Ft int +.Fn fesetround "int round" +.Ft int +.Fn fegetenv "fenv_t *envp" +.Ft int +.Fn feholdexcept "fenv_t *envp" +.Ft int +.Fn fesetenv "const fenv_t *envp" +.Ft int +.Fn feupdateenv "const fenv_t *envp" +.Ft int +.Fn feenableexcept "int excepts" +.Ft int +.Fn fedisableexcept "int excepts" +.Ft int +.Fn fegetexcept void +.Sh DESCRIPTION +The +.In fenv.h +routines manipulate the floating-point environment, +which includes the exception flags and rounding modes defined in +.St -ieee754 . +.Ss Exceptions +Exception flags are set as side-effects of floating-point arithmetic +operations and math library routines, and they remain set until +explicitly cleared. +The following macros expand to bit flags of type +.Vt int +representing the five standard floating-point exceptions. +.Bl -tag -width ".Dv FE_DIVBYZERO" +.It Dv FE_DIVBYZERO +A divide-by-zero exception occurs when the +.Em exact +result of a computation is infinite (according to the limit definition). +For example, dividing a finite non-zero number by zero or computing +.Fn log 0 +raises a divide-by-zero exception. +.It Dv FE_INEXACT +An inexact exception is raised whenever there is a loss of accuracy +due to rounding. +.It Dv FE_INVALID +Invalid operation exceptions occur when a program attempts to +perform calculations for which there is no reasonable representable +answer. +For instance, subtraction of like-signed infinities, division of zero by zero, +ordered comparison involving \*(Nas, and taking the real square root of a +negative number are all invalid operations. +.It Dv FE_OVERFLOW +In contrast with divide-by-zero, +an overflow exception occurs when an infinity is produced because +the magnitude of the exact result is +.Em finite +but too large to fit in the destination type. +For example, computing +.Li DBL_MAX * 2 +raises an overflow exception. +.It Dv FE_UNDERFLOW +Underflow occurs when the result of a computation loses precision +because it is too close to zero. +The result is a subnormal number or zero. +.El +.Pp +Additionally, the +.Dv FE_ALL_EXCEPT +macro expands to the bitwise OR of the above flags and any +architecture-specific flags. +Combinations of these flags are passed to the +.Fn feclearexcept , +.Fn fegetexceptflag , +.Fn feraiseexcept , +.Fn fesetexceptflag , +and +.Fn fetestexcept +functions to clear, save, raise, restore, and examine the +processor's floating-point exception flags, respectively. +.Pp +Exceptions may be +.Em unmasked +with +.Fn feenableexcept +and masked with +.Fn fedisableexcept . +Unmasked exceptions cause a trap when they are produced, and +all exceptions are masked by default. +The current mask can be tested with +.Fn fegetexcept . +.Ss Rounding Modes +.St -ieee754 +specifies four rounding modes. +These modes control the direction in which results are rounded +from their exact values in order to fit them into binary +floating-point variables. +The four modes correspond with the following symbolic constants. +.Bl -tag -width ".Dv FE_TOWARDZERO" +.It Dv FE_TONEAREST +Results are rounded to the closest representable value. +If the exact result is exactly half way between two representable +values, the value whose last binary digit is even (zero) is chosen. +This is the default mode. +.It Dv FE_DOWNWARD +Results are rounded towards negative \*[If]. +.It Dv FE_UPWARD +Results are rounded towards positive \*[If]. +.It Dv FE_TOWARDZERO +Results are rounded towards zero. +.El +.Pp +The +.Fn fegetround +and +.Fn fesetround +functions query and set the rounding mode. +.Ss Environment Control +The +.Fn fegetenv +and +.Fn fesetenv +functions save and restore the floating-point environment, +which includes exception flags, the current exception mask, +the rounding mode, and possibly other implementation-specific +state. +The +.Fn feholdexcept +function behaves like +.Fn fegetenv , +but with the additional effect of clearing the exception flags and +installing a +.Em non-stop +mode. +In non-stop mode, floating-point operations will set exception flags +as usual, but no +.Dv SIGFPE +signals will be generated as a result. +Non-stop mode is the default, but it may be altered by +.Fn feenableexcept +and +.Fn fedisableexcept . +The +.Fn feupdateenv +function restores a saved environment similarly to +.Fn fesetenv , +but it also re-raises any floating-point exceptions from the old +environment. +.Pp +The macro +.Dv FE_DFL_ENV +expands to a pointer to the default environment. +.Sh EXAMPLES +The following routine computes the square root function. +It explicitly raises an invalid exception on appropriate inputs using +.Fn feraiseexcept . +It also defers inexact exceptions while it computes intermediate +values, and then it allows an inexact exception to be raised only if +the final answer is inexact. +.Bd -literal -offset indent +#pragma STDC FENV_ACCESS ON +double sqrt(double n) { + double x = 1.0; + fenv_t env; + + if (isnan(n) || n < 0.0) { + feraiseexcept(FE_INVALID); + return (NAN); + } + if (isinf(n) || n == 0.0) + return (n); + feholdexcept(&env); + while (fabs((x * x) - n) > DBL_EPSILON * 2 * x) + x = (x / 2) + (n / (2 * x)); + if (x * x == n) + feclearexcept(FE_INEXACT); + feupdateenv(&env); + return (x); +} +.Ed +.Sh SEE ALSO +.Xr cc 1 , +.Xr feclearexcept 3 , +.Xr fedisableexcept 3 , +.Xr feenableexcept 3 , +.Xr fegetenv 3 , +.Xr fegetexcept 3 , +.Xr fegetexceptflag 3 , +.Xr fegetround 3 , +.Xr feholdexcept 3 , +.Xr feraiseexcept 3 , +.Xr fesetenv 3 , +.Xr fesetexceptflag 3 , +.Xr fesetround 3 , +.Xr fetestexcept 3 , +.Xr feupdateenv 3 , +.Xr fpgetprec 3 , +.Xr fpsetprec 3 +.Sh STANDARDS +Except as noted below, +.In fenv.h +conforms to +.St -isoC-99 . +The +.Fn feenableexcept , +.Fn fedisableexcept , +and +.Fn fegetexcept +routines are extensions. +.Sh HISTORY +The +.In fenv.h +header first appeared in +.Fx 5.3 . +It supersedes the non-standard routines defined in +.In ieeefp.h +and documented in +.Xr fpgetround 3 . +.Sh CAVEATS +The FENV_ACCESS pragma can be enabled with +.Dl "#pragma STDC FENV_ACCESS ON" +and disabled with the +.Dl "#pragma STDC FENV_ACCESS OFF" +directive. +This lexically-scoped annotation tells the compiler that the program +may access the floating-point environment, so optimizations that would +violate strict IEEE-754 semantics are disabled. +If execution reaches a block of code for which +.Dv FENV_ACCESS +is off, the floating-point environment will become undefined. +.Sh BUGS +The +.Dv FENV_ACCESS +pragma is unimplemented in the system compiler. +However, non-constant expressions generally produce the correct +side-effects at low optimization levels. diff --git a/lib/msun/man/floor.3 b/lib/msun/man/floor.3 new file mode 100644 index 000000000000..b295d013035f --- /dev/null +++ b/lib/msun/man/floor.3 @@ -0,0 +1,80 @@ +.\" Copyright (c) 1985, 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 3, 2022 +.Dt FLOOR 3 +.Os +.Sh NAME +.Nm floor , +.Nm floorf , +.Nm floorl +.Nd largest integral value less than or equal to x +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn floor "double x" +.Ft float +.Fn floorf "float x" +.Ft "long double" +.Fn floorl "long double x" +.Sh DESCRIPTION +The +.Fn floor , +.Fn floorf +and +.Fn floorl +functions return the largest integral value +less than or equal to +.Fa x , +expressed as a floating-point number. +.Sh SEE ALSO +.Xr abs 3 , +.Xr ceil 3 , +.Xr fabs 3 , +.Xr ieee 3 , +.Xr math 3 , +.Xr rint 3 , +.Xr round 3 , +.Xr trunc 3 +.Sh STANDARDS +The +.Fn floor +function conforms to +.St -isoC . +The +.Fn floorf +and +.Fn floorl +functions conform to +.St -isoC-99 . +.Sh HISTORY +A +.Fn floor +function first appeared in +.At v5 . diff --git a/lib/msun/man/fma.3 b/lib/msun/man/fma.3 new file mode 100644 index 000000000000..601982fd9ed5 --- /dev/null +++ b/lib/msun/man/fma.3 @@ -0,0 +1,114 @@ +.\" Copyright (c) 2005 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 22, 2005 +.Dt FMA 3 +.Os +.Sh NAME +.Nm fma , +.Nm fmaf , +.Nm fmal +.Nd fused multiply-add +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn fma "double x" "double y" "double z" +.Ft float +.Fn fmaf "float x" "float y" "float z" +.Ft long double +.Fn fmal "long double x" "long double y" "long double z" +.Sh DESCRIPTION +The +.Fn fma , +.Fn fmaf , +and +.Fn fmal +functions return +.No "(x * y) + z" , +computed with only one rounding error. +Using the ordinary multiplication and addition operators, by contrast, +results in two roundings: one for the intermediate product and one for +the final result. +.Pp +For instance, the expression +.No "1.2e100 * 2.0e208 - 1.4e308" +produces \*(If due to overflow in the intermediate product, whereas +.No "fma(1.2e100, 2.0e208, -1.4e308)" +returns approximately 1.0e308. +.Pp +The fused multiply-add operation is often used to improve the +accuracy of calculations such as dot products. +It may also be used to improve performance on machines that implement +it natively. +The macros +.Dv FP_FAST_FMA , +.Dv FP_FAST_FMAF +and +.Dv FP_FAST_FMAL +may be defined in +.In math.h +to indicate that +.Fn fma , +.Fn fmaf , +and +.Fn fmal +(respectively) have comparable or faster speed than a multiply +operation followed by an add operation. +.Sh IMPLEMENTATION NOTES +In general, these routines will behave as one would expect if +.No "x * y + z" +were computed with unbounded precision and range, +then rounded to the precision of the return type. +However, on some platforms, if +.Fa z +is \*(Na, these functions may not raise an exception even +when the computation of +.No "x * y" +would have otherwise generated an invalid exception. +.Sh SEE ALSO +.Xr fenv 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn fma , +.Fn fmaf , +and +.Fn fmal +functions conform to +.St -isoC-99 . +A fused multiply-add operation with virtually identical +characteristics appears in IEEE draft standard 754R. +.Sh HISTORY +The +.Fn fma +and +.Fn fmaf +routines first appeared in +.Fx 5.4 , +and +.Fn fmal +appeared in +.Fx 6.0 . diff --git a/lib/msun/man/fmax.3 b/lib/msun/man/fmax.3 new file mode 100644 index 000000000000..25fc9b6d518a --- /dev/null +++ b/lib/msun/man/fmax.3 @@ -0,0 +1,95 @@ +.\" Copyright (c) 2004 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd June 29, 2004 +.Dt FMAX 3 +.Os +.Sh NAME +.Nm fmax , +.Nm fmaxf , +.Nm fmaxl , +.Nm fmin , +.Nm fminf , +.Nm fminl +.Nd floating-point maximum and minimum functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn fmax "double x" "double y" +.Ft float +.Fn fmaxf "float x" "float y" +.Ft "long double" +.Fn fmaxl "long double x" "long double y" +.Ft double +.Fn fmin "double x" "double y" +.Ft float +.Fn fminf "float x" "float y" +.Ft "long double" +.Fn fminl "long double x" "long double y" +.Sh DESCRIPTION +The +.Fn fmax , +.Fn fmaxf , +and +.Fn fmaxl +functions return the larger of +.Fa x +and +.Fa y , +and likewise, the +.Fn fmin , +.Fn fminf , +and +.Fn fminl +functions return the smaller of +.Fa x +and +.Fa y . +They treat +.Li +0.0 +as being larger than +.Li -0.0 . +If one argument is an \*(Na, then the other argument is returned. +If both arguments are \*(Nas, then the result is an \*(Na. +These routines do not raise any floating-point exceptions. +.Sh SEE ALSO +.Xr fabs 3 , +.Xr fdim 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn fmax , +.Fn fmaxf , +.Fn fmaxl , +.Fn fmin , +.Fn fminf , +and +.Fn fminl +functions conform to +.St -isoC-99 . +.Sh HISTORY +These routines first appeared in +.Fx 5.3 . diff --git a/lib/msun/man/fmod.3 b/lib/msun/man/fmod.3 new file mode 100644 index 000000000000..a7a5ae86df58 --- /dev/null +++ b/lib/msun/man/fmod.3 @@ -0,0 +1,89 @@ +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 3, 2022 +.Dt FMOD 3 +.Os +.Sh NAME +.Nm fmod , +.Nm fmodf , +.Nm fmodl +.Nd floating-point remainder functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn fmod "double x" "double y" +.Ft float +.Fn fmodf "float x" "float y" +.Ft long double +.Fn fmodl "long double x" "long double y" +.Sh DESCRIPTION +The +.Fn fmod , +.Fn fmodf , +and +.Fn fmodl +functions compute the floating-point remainder of +.Fa x Ns / Fa y . +.Sh RETURN VALUES +If +.Fa y +is non-zero, the +.Fn fmod , +.Fn fmodf , +and +.Fn fmodl +functions return the value +.Sm off +.Fa x - Em i * Fa y , +.Sm on +for some integer +.Em i , +such that the result has the same sign as +.Fa x +and magnitude less than the magnitude of +.Fa y . +If +.Fa y +is zero, a \*(Na is produced. +.Sh SEE ALSO +.Xr math 3 +.Sh STANDARDS +The +.Fn fmod , +.Fn fmodf , +and +.Fn fmodl +functions conform to +.St -isoC-99 . +.Sh HISTORY +An +.Fn fmod +function first appeared in +.At v5 . diff --git a/lib/msun/man/hypot.3 b/lib/msun/man/hypot.3 new file mode 100644 index 000000000000..7b8498757955 --- /dev/null +++ b/lib/msun/man/hypot.3 @@ -0,0 +1,142 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd March 30, 2008 +.Dt HYPOT 3 +.Os +.Sh NAME +.Nm hypot , +.Nm hypotf , +.Nm hypotl , +.Nm cabs , +.Nm cabsf , +.Nm cabsl +.Nd Euclidean distance and complex absolute value functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn hypot "double x" "double y" +.Ft float +.Fn hypotf "float x" "float y" +.Ft "long double" +.Fn hypotl "long double x" "long double y" +.In complex.h +.Ft double +.Fn cabs "double complex z" +.Ft float +.Fn cabsf "float complex z" +.Ft "long double" +.Fn cabsl "long double complex z" +.Sh DESCRIPTION +The +.Fn hypot , +.Fn hypotf +and +.Fn hypotl +functions +compute the +sqrt(x*x+y*y) +in such a way that underflow will not happen, and overflow +occurs only if the final result deserves it. +The +.Fn cabs , +.Fn cabsf +and +.Fn cabsl +functions compute the complex absolute value of +.Fa z . +.Pp +.Fn hypot "\*(If" "v" += +.Fn hypot "v" "\*(If" += +\*(If for all +.Fa v , +including \*(Na. +.Sh ERROR (due to Roundoff, etc.) +Below 0.97 +.Em ulps . +Consequently +.Fn hypot "5.0" "12.0" += 13.0 +exactly; +in general, hypot and cabs return an integer whenever an +integer might be expected. +.Sh NOTES +As might be expected, +.Fn hypot "v" "\*(Na" +and +.Fn hypot "\*(Na" "v" +are \*(Na for all +.Em finite +.Fa v . +But programmers +might be surprised at first to discover that +.Fn hypot "\(+-\*(If" "\*(Na" += +\*(If. +This is intentional; it happens because +.Fn hypot "\*(If" "v" += +\*(If +for +.Em all +.Fa v , +finite or infinite. +Hence +.Fn hypot "\*(If" "v" +is independent of +.Fa v . +Unlike the reserved operand fault on a +.Tn VAX , +the +.Tn IEEE +\*(Na is designed to +disappear when it turns out to be irrelevant, as it does in +.Fn hypot "\*(If" "\*(Na" . +.Sh SEE ALSO +.Xr carg 3 , +.Xr math 3 , +.Xr sqrt 3 +.Sh STANDARDS +The +.Fn hypot , +.Fn hypotf , +.Fn hypotl , +.Fn cabs , +.Fn cabsf , +and +.Fn cabsl +functions conform to +.St -isoC-99 . +.Sh HISTORY +Both a +.Fn hypot +function and a +.Fn cabs +function +appeared in +.At v7 . diff --git a/lib/msun/man/ieee.3 b/lib/msun/man/ieee.3 new file mode 100644 index 000000000000..aaf73efe6bf9 --- /dev/null +++ b/lib/msun/man/ieee.3 @@ -0,0 +1,443 @@ +.\" Copyright (c) 1985 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 26, 2005 +.Dt IEEE 3 +.Os +.Sh NAME +.Nm ieee +.Nd IEEE standard 754 for floating-point arithmetic +.Sh DESCRIPTION +The IEEE Standard 754 for Binary Floating-Point Arithmetic +defines representations of floating-point numbers and abstract +properties of arithmetic operations relating to precision, +rounding, and exceptional cases, as described below. +.Ss IEEE STANDARD 754 Floating-Point Arithmetic +Radix: Binary. +.Pp +Overflow and underflow: +.Bd -ragged -offset indent -compact +Overflow goes by default to a signed \*(If. +Underflow is +.Em gradual . +.Ed +.Pp +Zero is represented ambiguously as +0 or \-0. +.Bd -ragged -offset indent -compact +Its sign transforms correctly through multiplication or +division, and is preserved by addition of zeros +with like signs; but x\-x yields +0 for every +finite x. +The only operations that reveal zero's +sign are division by zero and +.Fn copysign x \(+-0 . +In particular, comparison (x > y, x \(>= y, etc.)\& +cannot be affected by the sign of zero; but if +finite x = y then \*(If = 1/(x\-y) \(!= \-1/(y\-x) = \-\*(If. +.Ed +.Pp +Infinity is signed. +.Bd -ragged -offset indent -compact +It persists when added to itself +or to any finite number. +Its sign transforms +correctly through multiplication and division, and +(finite)/\(+-\*(If\0=\0\(+-0 +(nonzero)/0 = \(+-\*(If. +But +\*(If\-\*(If, \*(If\(**0 and \*(If/\*(If +are, like 0/0 and sqrt(\-3), +invalid operations that produce \*(Na. ... +.Ed +.Pp +Reserved operands (\*(Nas): +.Bd -ragged -offset indent -compact +An \*(Na is +.Em ( N Ns ot Em a N Ns umber ) . +Some \*(Nas, called Signaling \*(Nas, trap any floating-point operation +performed upon them; they are used to mark missing +or uninitialized values, or nonexistent elements +of arrays. +The rest are Quiet \*(Nas; they are +the default results of Invalid Operations, and +propagate through subsequent arithmetic operations. +If x \(!= x then x is \*(Na; every other predicate +(x > y, x = y, x < y, ...) is FALSE if \*(Na is involved. +.Ed +.Pp +Rounding: +.Bd -ragged -offset indent -compact +Every algebraic operation (+, \-, \(**, /, +\(sr) +is rounded by default to within half an +.Em ulp , +and when the rounding error is exactly half an +.Em ulp +then +the rounded value's least significant bit is zero. +(An +.Em ulp +is one +.Em U Ns nit +in the +.Em L Ns ast +.Em P Ns lace . ) +This kind of rounding is usually the best kind, +sometimes provably so; for instance, for every +x = 1.0, 2.0, 3.0, 4.0, ..., 2.0**52, we find +(x/3.0)\(**3.0 == x and (x/10.0)\(**10.0 == x and ... +despite that both the quotients and the products +have been rounded. +Only rounding like IEEE 754 can do that. +But no single kind of rounding can be +proved best for every circumstance, so IEEE 754 +provides rounding towards zero or towards ++\*(If or towards \-\*(If +at the programmer's option. +.Ed +.Pp +Exceptions: +.Bd -ragged -offset indent -compact +IEEE 754 recognizes five kinds of floating-point exceptions, +listed below in declining order of probable importance. +.Bl -column -offset indent "Invalid Operation" "Gradual Underflow" +.Em "Exception Default Result" +Invalid Operation \*(Na, or FALSE +Overflow \(+-\*(If +Divide by Zero \(+-\*(If +Underflow Gradual Underflow +Inexact Rounded value +.El +.Pp +NOTE: An Exception is not an Error unless handled +badly. +What makes a class of exceptions exceptional +is that no single default response can be satisfactory +in every instance. +On the other hand, if a default +response will serve most instances satisfactorily, +the unsatisfactory instances cannot justify aborting +computation every time the exception occurs. +.Ed +.Ss Data Formats +Single-precision: +.Bd -ragged -offset indent -compact +Type name: +.Vt float +.Pp +Wordsize: 32 bits. +.Pp +Precision: 24 significant bits, +roughly like 7 significant decimals. +.Pp +If x and x' are consecutive positive single-precision +numbers (they differ by 1 +.Em ulp ) , +then +.Bl -column "XXX" -compact +5.9e\-08 < 0.5**24 < (x'\-x)/x \(<= 0.5**23 < 1.2e\-07. +.El +.Pp +.Bl -column "XXX" -compact +Range: Overflow threshold = 2.0**128 = 3.4e38 + Underflow threshold = 0.5**126 = 1.2e\-38 +.El +.Pp +Underflowed results round to the nearest +integer multiple of +.Bl -column "XXX" -compact +0.5**149 = 1.4e\-45. +.El +.Ed +.Pp +Double-precision: +.Bd -ragged -offset indent -compact +Type name: +.Vt double +.Po On some architectures, +.Vt long double +is the same as +.Vt double +.Pc +.Pp +Wordsize: 64 bits. +.Pp +Precision: 53 significant bits, +roughly like 16 significant decimals. +.Pp +If x and x' are consecutive positive double-precision +numbers (they differ by 1 +.Em ulp ) , +then +.Bl -column "XXX" -compact +1.1e\-16 < 0.5**53 < (x'\-x)/x \(<= 0.5**52 < 2.3e\-16. +.El +.Pp +.Bl -column "XXX" -compact +Range: Overflow threshold = 2.0**1024 = 1.8e308 + Underflow threshold = 0.5**1022 = 2.2e\-308 +.El +.Pp +Underflowed results round to the nearest +integer multiple of +.Bl -column "XXX" -compact +0.5**1074 = 4.9e\-324. +.El +.Ed +.Pp +Extended-precision: +.Bd -ragged -offset indent -compact +Type name: +.Vt long double +(when supported by the hardware) +.Pp +Wordsize: 96 bits. +.Pp +Precision: 64 significant bits, +roughly like 19 significant decimals. +.Pp +If x and x' are consecutive positive extended-precision +numbers (they differ by 1 +.Em ulp ) , +then +.Bl -column "XXX" -compact +1.0e\-19 < 0.5**63 < (x'\-x)/x \(<= 0.5**62 < 2.2e\-19. +.El +.Pp +.Bl -column "XXX" -compact +Range: Overflow threshold = 2.0**16384 = 1.2e4932 + Underflow threshold = 0.5**16382 = 3.4e\-4932 +.El +.Pp +Underflowed results round to the nearest +integer multiple of +.Bl -column "XXX" -compact +0.5**16445 = 5.7e\-4953. +.El +.Ed +.Pp +Quad-extended-precision: +.Bd -ragged -offset indent -compact +Type name: +.Vt long double +(when supported by the hardware) +.Pp +Wordsize: 128 bits. +.Pp +Precision: 113 significant bits, +roughly like 34 significant decimals. +.Pp +If x and x' are consecutive positive quad-extended-precision +numbers (they differ by 1 +.Em ulp ) , +then +.Bl -column "XXX" -compact +9.6e\-35 < 0.5**113 < (x'\-x)/x \(<= 0.5**112 < 2.0e\-34. +.El +.Pp +.Bl -column "XXX" -compact +Range: Overflow threshold = 2.0**16384 = 1.2e4932 + Underflow threshold = 0.5**16382 = 3.4e\-4932 +.El +.Pp +Underflowed results round to the nearest +integer multiple of +.Bl -column "XXX" -compact +0.5**16494 = 6.5e\-4966. +.El +.Ed +.Ss Additional Information Regarding Exceptions +For each kind of floating-point exception, IEEE 754 +provides a Flag that is raised each time its exception +is signaled, and stays raised until the program resets +it. +Programs may also test, save and restore a flag. +Thus, IEEE 754 provides three ways by which programs +may cope with exceptions for which the default result +might be unsatisfactory: +.Bl -enum +.It +Test for a condition that might cause an exception +later, and branch to avoid the exception. +.It +Test a flag to see whether an exception has occurred +since the program last reset its flag. +.It +Test a result to see whether it is a value that only +an exception could have produced. +.Pp +CAUTION: The only reliable ways to discover +whether Underflow has occurred are to test whether +products or quotients lie closer to zero than the +underflow threshold, or to test the Underflow +flag. +(Sums and differences cannot underflow in +IEEE 754; if x \(!= y then x\-y is correct to +full precision and certainly nonzero regardless of +how tiny it may be.) +Products and quotients that +underflow gradually can lose accuracy gradually +without vanishing, so comparing them with zero +(as one might on a VAX) will not reveal the loss. +Fortunately, if a gradually underflowed value is +destined to be added to something bigger than the +underflow threshold, as is almost always the case, +digits lost to gradual underflow will not be missed +because they would have been rounded off anyway. +So gradual underflows are usually +.Em provably +ignorable. +The same cannot be said of underflows flushed to 0. +.El +.Pp +At the option of an implementor conforming to IEEE 754, +other ways to cope with exceptions may be provided: +.Bl -enum +.It +ABORT. +This mechanism classifies an exception in +advance as an incident to be handled by means +traditionally associated with error-handling +statements like "ON ERROR GO TO ...". +Different +languages offer different forms of this statement, +but most share the following characteristics: +.Bl -dash +.It +No means is provided to substitute a value for +the offending operation's result and resume +computation from what may be the middle of an +expression. +An exceptional result is abandoned. +.It +In a subprogram that lacks an error-handling +statement, an exception causes the subprogram to +abort within whatever program called it, and so +on back up the chain of calling subprograms until +an error-handling statement is encountered or the +whole task is aborted and memory is dumped. +.El +.It +STOP. +This mechanism, requiring an interactive +debugging environment, is more for the programmer +than the program. +It classifies an exception in +advance as a symptom of a programmer's error; the +exception suspends execution as near as it can to +the offending operation so that the programmer can +look around to see how it happened. +Quite often +the first several exceptions turn out to be quite +unexceptionable, so the programmer ought ideally +to be able to resume execution after each one as if +execution had not been stopped. +.It +\&... Other ways lie beyond the scope of this document. +.El +.Pp +Ideally, each +elementary function should act as if it were indivisible, or +atomic, in the sense that ... +.Bl -enum +.It +No exception should be signaled that is not deserved by +the data supplied to that function. +.It +Any exception signaled should be identified with that +function rather than with one of its subroutines. +.It +The internal behavior of an atomic function should not +be disrupted when a calling program changes from +one to another of the five or so ways of handling +exceptions listed above, although the definition +of the function may be correlated intentionally +with exception handling. +.El +.Pp +The functions in +.Nm libm +are only approximately atomic. +They signal no inappropriate exception except possibly ... +.Bl -tag -width indent -offset indent -compact +.It Xo +Over/Underflow +.Xc +when a result, if properly computed, might have lain barely within range, and +.It Xo +Inexact in +.Fn cabs , +.Fn cbrt , +.Fn hypot , +.Fn log10 +and +.Fn pow +.Xc +when it happens to be exact, thanks to fortuitous cancellation of errors. +.El +Otherwise, ... +.Bl -tag -width indent -offset indent -compact +.It Xo +Invalid Operation is signaled only when +.Xc +any result but \*(Na would probably be misleading. +.It Xo +Overflow is signaled only when +.Xc +the exact result would be finite but beyond the overflow threshold. +.It Xo +Divide-by-Zero is signaled only when +.Xc +a function takes exactly infinite values at finite operands. +.It Xo +Underflow is signaled only when +.Xc +the exact result would be nonzero but tinier than the underflow threshold. +.It Xo +Inexact is signaled only when +.Xc +greater range or precision would be needed to represent the exact result. +.El +.Sh SEE ALSO +.Xr fenv 3 , +.Xr ieee_test 3 , +.Xr math 3 +.Pp +An explanation of IEEE 754 and its proposed extension p854 +was published in the IEEE magazine MICRO in August 1984 under +the title "A Proposed Radix- and Word-length-independent +Standard for Floating-point Arithmetic" by +.An "W. J. Cody" +et al. +The manuals for Pascal, C and BASIC on the Apple Macintosh +document the features of IEEE 754 pretty well. +Articles in the IEEE magazine COMPUTER vol.\& 14 no.\& 3 (Mar.\& +1981), and in the ACM SIGNUM Newsletter Special Issue of +Oct.\& 1979, may be helpful although they pertain to +superseded drafts of the standard. +.Sh STANDARDS +.St -ieee754 diff --git a/lib/msun/man/ieee_test.3 b/lib/msun/man/ieee_test.3 new file mode 100644 index 000000000000..bae704eb22df --- /dev/null +++ b/lib/msun/man/ieee_test.3 @@ -0,0 +1,86 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd November 6, 2005 +.Dt IEEE_TEST 3 +.Os +.Sh NAME +.Nm scalb , +.Nm scalbf , +.Nm significand , +.Nm significandf +.Nd IEEE test functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn scalb "double x" "double n" +.Ft float +.Fn scalbf "float x" "float n" +.Ft double +.Fn significand "double x" +.Ft float +.Fn significandf "float x" +.Sh DESCRIPTION +These functions allow users to test conformance to +.St -ieee754 . +Their use is not otherwise recommended. +.Pp +.Fn scalb x n +and +.Fn scalbf x n +return +.Fa x Ns \(**(2** Ns Fa n ) +computed by exponent manipulation. +If +.Fa n +is not an integer, \*(Pm\*(If, or an \*(Na, the result is unspecified. +.Pp +.Fn significand x +and +.Fn significandf x +return +.Fa sig , +where +.Fa x +:= +.Fa sig No \(** 2** Ns Fa n +with 1 \(<= +.Fa sig +< 2. +.Fn significand x +and +.Fn significandf x +are not defined when +.Fa x +is 0, \*(Pm\*(If, or \*(Na. +.Sh SEE ALSO +.Xr ieee 3 , +.Xr math 3 +.Sh STANDARDS +.St -ieee754 diff --git a/lib/msun/man/ilogb.3 b/lib/msun/man/ilogb.3 new file mode 100644 index 000000000000..4d4523316afd --- /dev/null +++ b/lib/msun/man/ilogb.3 @@ -0,0 +1,121 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd December 16, 2007 +.Dt ILOGB 3 +.Os +.Sh NAME +.Nm ilogb , +.Nm ilogbf , +.Nm ilogbl , +.Nm logb , +.Nm logbf , +.Nm logbl +.Nd extract exponent +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft int +.Fn ilogb "double x" +.Ft int +.Fn ilogbf "float x" +.Ft int +.Fn ilogbl "long double x" +.Ft double +.Fn logb "double x" +.Ft float +.Fn logbf "float x" +.Ft long double +.Fn logbl "long double x" +.Sh DESCRIPTION +.Fn ilogb , +.Fn ilogbf +and +.Fn ilogbl +return +.Fa x Ns 's exponent +in integer format. +.Fn ilogb \*(Pm\*(If +returns +.Dv INT_MAX , +.Fn ilogb \*(Pm\*(Na +returns +.Dv FP_ILOGBNAN , +and +.Fn ilogb 0 +returns +.Dv FP_ILOGB0 . +.Pp +.Fn logb x , +.Fn logbf x , +and +.Fn logbl x +return +.Fa x Ns 's exponent +in floating\-point format with the same precision as +.Fa x . +.Fn logb \*(Pm\*(If +returns +\*(If, and +.Fn logb 0 +returns -\*(If with a division by zero exception. +.Sh SEE ALSO +.Xr frexp 3 , +.Xr ieee 3 , +.Xr math 3 , +.Xr scalbn 3 +.Sh STANDARDS +The +.Fn ilogb , +.Fn ilogbf , +.Fn ilogbl , +.Fn logb , +.Fn logbf , +and +.Fn logbl +routines conform to +.St -isoC-99 . +The latter three +implement the logb function recommended by +.St -ieee754 . +.Sh HISTORY +.Bl -tag -width "Function " -compact +.It Em Function +.Em "First Appeared In" +.It Fn logb +.Bx 4.3 +.It Fn ilogb +.Fx 1.1.5 +.It Fn ilogbf +.Fx 2.0 +.It Fn logbf +.Fx 2.0 +.It Fn ilogbl +.Fx 5.4 +.It Fn logbl +.Fx 8.0 +.El diff --git a/lib/msun/man/j0.3 b/lib/msun/man/j0.3 new file mode 100644 index 000000000000..a5c58f03977a --- /dev/null +++ b/lib/msun/man/j0.3 @@ -0,0 +1,161 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd March 10, 2015 +.Dt J0 3 +.Os +.Sh NAME +.Nm j0 , +.Nm j0f , +.Nm j1 , +.Nm j1f , +.Nm jn , +.Nm jnf , +.Nm y0 , +.Nm y0f , +.Nm y1 , +.Nm y1f , +.Nm yn , +.Nm ynf +.Nd Bessel functions of first and second kind +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn j0 "double x" +.Ft float +.Fn j0f "float x" +.Ft double +.Fn j1 "double x" +.Ft float +.Fn j1f "float x" +.Ft double +.Fn jn "int n" "double x" +.Ft float +.Fn jnf "int n" "float x" +.Ft double +.Fn y0 "double x" +.Ft float +.Fn y0f "float x" +.Ft double +.Fn y1 "double x" +.Ft float +.Fn y1f "float x" +.Ft double +.Fn yn "int n" "double x" +.Ft float +.Fn ynf "int n" "float x" +.Sh DESCRIPTION +The functions +.Fn j0 , +.Fn j0f , +.Fn j1 , +and +.Fn j1f +compute the Bessel function of the first kind of orders +0 and 1 for the real value +.Fa x ; +the functions +.Fn jn +and +.Fn jnf +compute the Bessel function of the first kind of the integer order +.Fa n +for the real value +.Fa x . +.Pp +The functions +.Fn y0 , +.Fn y0f , +.Fn y1 , +and +.Fn y1f +compute the linearly independent Bessel function of the second kind +of orders 0 and 1 for the positive +.Em real +value +.Fa x ; +the functions +.Fn yn +and +.Fn ynf +compute the Bessel function of the second kind for the integer order +.Fa n +for the positive +.Em real +value +.Fa x . +.Sh RETURN VALUES +These routines return values of their respective Bessel functions. +For large positive inputs, they may underflow and return \*(Pm0. +.Pp +The following applies to +.Fn y0 , +.Fn y0f , +.Fn y1 , +.Fn y1f , +.Fn yn , +and +.Fn ynf . +If +.Fa x +is negative, including -\*(If, these routines will generate an invalid +exception and return \*(Na. +If +.Fa x +is \*(Pm0, these routines +will generate a divide-by-zero exception and return -\*(If. +If +.Fa x +is a sufficiently small positive number, then +.Fn y1 , +.Fn y1f , +.Fn yn , +and +.Fn ynf +will generate an overflow exception and return -\*(If. +.Sh SEE ALSO +.Xr math 3 +.Sh STANDARDS +The +.Fn j0 , +.Fn j1 , +.Fn jn , +.Fn y0 , +.Fn y1 , +and +.Fn yn +functions conform to +.St -p1003.1-2001 . +The +.Ft float +versions are extensions. +.Sh HISTORY +This set of functions +appeared in +.At v7 . diff --git a/lib/msun/man/lgamma.3 b/lib/msun/man/lgamma.3 new file mode 100644 index 000000000000..41d680e41bda --- /dev/null +++ b/lib/msun/man/lgamma.3 @@ -0,0 +1,213 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 12, 2024 +.Dt LGAMMA 3 +.Os +.Sh NAME +.Nm lgamma , +.Nm lgamma_r , +.Nm lgammaf , +.Nm lgammaf_r , +.Nm lgammal , +.Nm lgammal_r , +.Nm gamma , +.Nm gamma_r , +.Nm gammaf , +.Nm gammaf_r , +.Nm tgamma , +.Nm tgammaf , +.Nm tgammal , +.Nd log gamma functions, gamma function +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft extern int +.Fa signgam ; +.sp +.Ft double +.Fn lgamma "double x" +.Ft double +.Fn lgamma_r "double x" "int *signgamp" +.Ft float +.Fn lgammaf "float x" +.Ft float +.Fn lgammaf_r "float x" "int *signgamp" +.Ft "long double" +.Fn lgammal "long double x" +.Ft "long double" +.Fn lgammal_r "long double x" "int *signgamp" +.Ft double +.Fn gamma "double x" +.Ft double +.Fn gamma_r "double x" "int *signgamp" +.Ft float +.Fn gammaf "float x" +.Ft float +.Fn gammaf_r "float x" "int *signgamp" +.Ft "long double" +.Fn tgamma "double x" +.Ft float +.Fn tgammaf "float x" +.Ft "long double" +.Fn tgammal "long double x" +.Sh DESCRIPTION +.Fn lgamma x , +.Fn lgammaf x , +and +.Fn lgammal x +.if t \{\ +return ln\||\(*G(x)| where +.Bd -unfilled -offset indent +\(*G(x) = \(is\d\s8\z0\s10\u\u\s8\(if\s10\d t\u\s8x\-1\s10\d e\u\s8\-t\s10\d dt for x > 0 and +\(*G(x) = \(*p/(\(*G(1\-x)\|sin(\(*px)) for x < 1. +.Ed +.\} +.if n \ +return ln\||\(*G(x)|. +The external integer +.Fa signgam +returns the sign of \(*G(x). +.Pp +.Fn lgamma_r x signgamp , +.Fn lgammaf_r x signgamp , +and +.Fn lgammal_r x signgamp +provide the same functionality as +.Fn lgamma x , +.Fn lgammaf x , +and +.Fn lgammal x , +but the caller must provide an integer to store the sign of \(*G(x). +.Pp +The +.Fn tgamma x , +.Fn tgammaf x , +and +.Fn tgammal x +functions return \(*G(x), with no effect on +.Fa signgam . +.Pp +.Fn gamma , +.Fn gammaf , +.Fn gamma_r , +and +.Fn gammaf_r +are deprecated aliases for +.Fn lgamma , +.Fn lgammaf , +.Fn lgamma_r , +and +.Fn lgammaf_r , +respectively. +.Sh IDIOSYNCRASIES +Do not use the expression +.Dq Li signgam\(**exp(lgamma(x)) +to compute g := \(*G(x). +Instead use a program like this (in C): +.Bd -literal -offset indent +lg = lgamma(x); g = signgam\(**exp(lg); +.Ed +.Pp +Only after +.Fn lgamma +or +.Fn lgammaf +has returned can signgam be correct. +.Pp +For arguments in its range, +.Fn tgamma +is preferred, as for positive arguments +it is accurate to within one unit in the last place. +Exponentiation of +.Fn lgamma +will lose up to 10 significant bits. +.Sh RETURN VALUES +.Fn gamma , +.Fn gammaf , +.Fn gammal , +.Fn gamma_r , +.Fn gammaf_r , +.Fn gammal_r , +.Fn lgamma , +.Fn lgammaf , +.Fn lgammal , +.Fn lgamma_r , +.Fn lgammaf_r , +and +.Fn lgammal_r +return appropriate values unless an argument is out of range. +Overflow will occur for sufficiently large positive values, and +non-positive integers. +For large non-integer negative values, +.Fn tgamma +will underflow. +.Sh SEE ALSO +.Xr math 3 +.Sh STANDARDS +The +.Fn lgamma , +.Fn lgammaf , +.Fn lgammal , +.Fn tgamma , +.Fn tgammaf , +and +.Fn tgammal +functions are expected to conform to +.St -isoC-99 . +.Sh HISTORY +The +.Fn lgamma +function appeared in +.Bx 4.3 . +The +.Fn gamma +function appeared in +.Bx 4.4 +as a function which computed \(*G(x). +This version was used in +.Fx 1.1 . +The name +.Fn gamma +was originally dedicated to the +.Fn lgamma +function, +and that usage was restored by switching to Sun's fdlibm in +.Fx 1.1.5 . +The +.Fn tgamma +function appeared in +.Fx 5.0 . +The 128-bit +.Ft long double +version of +.Fn tgammal +replaced the 80-bit stub version in +version in +.Fx 14.1 , +thanks to an appropriate implementation from Arm. diff --git a/lib/msun/man/log.3 b/lib/msun/man/log.3 new file mode 100644 index 000000000000..9afd82504017 --- /dev/null +++ b/lib/msun/man/log.3 @@ -0,0 +1,146 @@ +.\" Copyright (c) 2008-2010 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd March 22, 2020 +.Dt LOG 3 +.Os +.Sh NAME +.Nm log , +.Nm logf , +.Nm logl , +.Nm log10 , +.Nm log10f , +.Nm log10l , +.Nm log2 , +.Nm log2f , +.Nm log2l , +.Nm log1p , +.Nm log1pf , +.Nm log1pl +.Nd logarithm functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn log "double x" +.Ft float +.Fn logf "float x" +.Ft long double +.Fn logl "long double x" +.Ft double +.Fn log10 "double x" +.Ft float +.Fn log10f "float x" +.Ft long double +.Fn log10l "long double x" +.Ft double +.Fn log2 "double x" +.Ft float +.Fn log2f "float x" +.Ft long double +.Fn log2l "long double x" +.Ft double +.Fn log1p "double x" +.Ft float +.Fn log1pf "float x" +.Ft long double +.Fn log1pl "long double x" +.Sh DESCRIPTION +The +.Fn log , +.Fn logf , +and +.Fn logl +functions compute the natural logarithm of +.Fa x . +.Pp +The +.Fn log10 , +.Fn log10f , +and +.Fn log10l +functions compute the logarithm base 10 of +.Fa x , +while +.Fn log2 , +.Fn log2f , +and +.Fn log2l +compute the logarithm base 2 of +.Fa x . +.Pp +The +.Fn log1p , +.Fn log1pf , +and +.Fn log1pl +functions compute the natural logarithm of +.No "1 + x" . +Computing the natural logarithm as +.Li log1p(x) +is more accurate than computing it as +.Li log(1 + x) +when +.Fa x +is close to zero. +.Sh RETURN VALUES +These functions return the requested logarithm; the logarithm of 1 is +0. +An attempt to take the logarithm of \*(Pm0 results in a divide-by-zero +exception, and -\*(If is returned. +Otherwise, attempting to take the logarithm of a negative number +results in an invalid exception and a return value of \*(Na. +.Sh SEE ALSO +.Xr exp 3 , +.Xr ilogb 3 , +.Xr math 3 , +.Xr pow 3 +.Sh STANDARDS +The +.Fn log , +.Fn logf , +.Fn logl , +.Fn log10 , +.Fn log10f , +.Fn log10l , +.Fn log2 , +.Fn log2f , +.Fn log2l , +.Fn log1p , +.Fn log1pf , +and +.Fn log1pl +functions conform to +.St -isoC-99 . +.Sh HISTORY +The +.Fn log +function first appeared in +.At v1 ; +.Fn log10 +in +.At v7 ; +.Fn log1p +in +.Bx 4.3 . diff --git a/lib/msun/man/lrint.3 b/lib/msun/man/lrint.3 new file mode 100644 index 000000000000..05f82974604e --- /dev/null +++ b/lib/msun/man/lrint.3 @@ -0,0 +1,102 @@ +.\" Copyright (c) 2005 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 13, 2008 +.Dt LRINT 3 +.Os +.Sh NAME +.Nm llrint , +.Nm llrintf , +.Nm llrintl , +.Nm lrint , +.Nm lrintf , +.Nm lrintl +.Nd "convert to integer" +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft "long long" +.Fn llrint "double x" +.Ft "long long" +.Fn llrintf "float x" +.Ft "long long" +.Fn llrintl "long double x" +.Ft long +.Fn lrint "double x" +.Ft long +.Fn lrintf "float x" +.Ft long +.Fn lrintl "long double x" +.Sh DESCRIPTION +The +.Fn lrint +function returns the integer nearest to its argument +.Fa x +according to the current rounding mode. +If the rounded result is too large to be represented as a +.Vt long +value, an invalid exception is raised and the return value is undefined. +Otherwise, if +.Fa x +is not an integer, +.Fn lrint +raises an inexact exception. +When the rounded result is representable as a +.Vt long , +the expression +.Fn lrint x +is equivalent to +.Po Vt long Pc Ns Fn rint x +(although the former may be more efficient). +.Pp +The +.Fn llrint , +.Fn llrintf , +.Fn llrintl , +.Fn lrintf , +and +.Fn lrintl +functions differ from +.Fn lrint +only in their input and output types. +.Sh SEE ALSO +.Xr lround 3 , +.Xr math 3 , +.Xr rint 3 , +.Xr round 3 +.Sh STANDARDS +These functions conform to +.St -isoC-99 . +.Sh HISTORY +The +.Fn llrint , +.Fn llrintf , +.Fn lrint , +and +.Fn lrintf +routines first appeared in +.Fx 5.4 . +The long double variants were introduced in +.Fx 8.0 . diff --git a/lib/msun/man/lround.3 b/lib/msun/man/lround.3 new file mode 100644 index 000000000000..2d53053d84f9 --- /dev/null +++ b/lib/msun/man/lround.3 @@ -0,0 +1,110 @@ +.\" Copyright (c) 2005 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 7, 2005 +.Dt LROUND 3 +.Os +.Sh NAME +.Nm llround , +.Nm llroundf , +.Nm llroundl , +.Nm lround , +.Nm lroundf , +.Nm lroundl +.Nd "convert to nearest integral value" +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft "long long" +.Fn llround "double x" +.Ft "long long" +.Fn llroundf "float x" +.Ft "long long" +.Fn llroundl "long double x" +.Ft long +.Fn lround "double x" +.Ft long +.Fn lroundf "float x" +.Ft long +.Fn lroundl "long double x" +.Sh DESCRIPTION +The +.Fn lround +function returns the integer nearest to its argument +.Fa x , +rounding away from zero in halfway cases. +If the rounded result is too large to be represented as a +.Vt long +value, an invalid exception is raised and the return value is undefined. +Otherwise, if +.Fa x +is not an integer, +.Fn lround +may raise an inexact exception. +When the rounded result is representable as a +.Vt long , +the expression +.Fn lround x +is equivalent to +.Po Vt long Pc Ns Fn round x +(although the former may be more efficient). +.Pp +The +.Fn llround , +.Fn llroundf , +.Fn llroundl , +.Fn lroundf +and +.Fn lroundl +functions differ from +.Fn lround +only in their input and output types. +.Sh SEE ALSO +.Xr lrint 3 , +.Xr math 3 , +.Xr rint 3 , +.Xr round 3 +.Sh STANDARDS +The +.Fn llround , +.Fn llroundf , +.Fn llroundl , +.Fn lround , +.Fn lroundf , +and +.Fn lroundl +functions conform to +.St -isoC-99 . +.Sh HISTORY +The +.Vt float +and +.Vt double +versions of these routines first appeared in +.Fx 5.4 . +The +.Vt "long double" +versions appeared in +.Fx 6.0 . diff --git a/lib/msun/man/math.3 b/lib/msun/man/math.3 new file mode 100644 index 000000000000..47353298bb54 --- /dev/null +++ b/lib/msun/man/math.3 @@ -0,0 +1,246 @@ +.\" Copyright (c) 1985 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd December 7, 2017 +.Dt MATH 3 +.Os +.Sh NAME +.Nm math +.Nd "floating-point mathematical library" +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Sh DESCRIPTION +The math library includes the following components: +.Bl -column "<complex.h>" "polymorphic (type-generic) versions of functions" -compact -offset indent +.In math.h Ta basic routines and real-valued functions +.In complex.h Ta complex number support +.In tgmath.h Ta polymorphic (type-generic) versions of functions +.In fenv.h Ta routines to control rounding and exceptions +.El +The rest of this manual page describes the functions provided by +.In math.h . +Please consult +.Xr complex 3 , +.Xr tgmath 3 , +and +.Xr fenv 3 +for information on the other components. +.Sh "LIST OF FUNCTIONS" +Each of the following +.Vt double +functions has a +.Vt float +counterpart with an +.Ql f +appended to the name and a +.Vt "long double" +counterpart with an +.Ql l +appended. +As an example, the +.Vt float +and +.Vt "long double" +counterparts of +.Ft double +.Fn acos "double x" +are +.Ft float +.Fn acosf "float x" +and +.Ft "long double" +.Fn acosl "long double x" , +respectively. +The classification macros and silent order predicates are type generic and +should not be suffixed with +.Ql f +or +.Ql l . +.de Cl +.Bl -column "isgreaterequal" "bessel function of the second kind of the order 0" +.Em "Name Description" +.. +.Ss Algebraic Functions +.Cl +cbrt cube root +fma fused multiply-add +hypot Euclidean distance +sqrt square root +.El +.Ss Classification Macros +.Cl +fpclassify classify a floating-point value +isfinite determine whether a value is finite +isinf determine whether a value is infinite +isnan determine whether a value is \*(Na +isnormal determine whether a value is normalized +.El +.Ss Exponent Manipulation Functions +.Cl +frexp extract exponent and mantissa +ilogb extract exponent +ldexp multiply by power of 2 +logb extract exponent +scalbln adjust exponent +scalbn adjust exponent +.El +.Ss Extremum- and Sign-Related Functions +.Cl +copysign copy sign bit +fabs absolute value +fdim positive difference +fmax maximum function +fmin minimum function +signbit extract sign bit +.El +.Ss Not a Number Functions +.Cl +nan generate a quiet \*(Na +.El +.Ss Residue and Rounding Functions +.Cl +ceil integer no less than +floor integer no greater than +fmod positive remainder +llrint round to integer in fixed-point format +llround round to nearest integer in fixed-point format +lrint round to integer in fixed-point format +lround round to nearest integer in fixed-point format +modf extract integer and fractional parts +nearbyint round to integer (silent) +nextafter next representable value +nexttoward next representable value +remainder remainder +remquo remainder with partial quotient +rint round to integer +round round to nearest integer +trunc integer no greater in magnitude than +.El +.Pp +The +.Fn ceil , +.Fn floor , +.Fn llround , +.Fn lround , +.Fn round , +and +.Fn trunc +functions round in predetermined directions, whereas +.Fn llrint , +.Fn lrint , +and +.Fn rint +round according to the current (dynamic) rounding mode. +For more information on controlling the dynamic rounding mode, see +.Xr fenv 3 +and +.Xr fesetround 3 . +.Ss Silent Order Predicates +.Cl +isgreater greater than relation +isgreaterequal greater than or equal to relation +isless less than relation +islessequal less than or equal to relation +islessgreater less than or greater than relation +isunordered unordered relation +.El +.Ss Transcendental Functions +.Cl +acos inverse cosine +acosh inverse hyperbolic cosine +asin inverse sine +asinh inverse hyperbolic sine +atan inverse tangent +atanh inverse hyperbolic tangent +atan2 atan(y/x); complex argument +cos cosine +cosh hyperbolic cosine +erf error function +erfc complementary error function +exp exponential base e +exp2 exponential base 2 +expm1 exp(x)\-1 +j0 Bessel function of the first kind of the order 0 +j1 Bessel function of the first kind of the order 1 +jn Bessel function of the first kind of the order n +lgamma log gamma function +log natural logarithm +log10 logarithm to base 10 +log1p log(1+x) +log2 base 2 logarithm +pow exponential x**y +sin trigonometric function +sinh hyperbolic function +tan trigonometric function +tanh hyperbolic function +tgamma gamma function +y0 Bessel function of the second kind of the order 0 +y1 Bessel function of the second kind of the order 1 +yn Bessel function of the second kind of the order n +.El +.Pp +The routines +in this section might not produce a result that is correctly rounded, +so reproducible results cannot be guaranteed across platforms. +For most of these functions, however, incorrect rounding occurs +rarely, and then only in very-close-to-halfway cases. +.Sh SEE ALSO +.Xr complex 3 , +.Xr fenv 3 , +.Xr ieee 3 , +.Xr qmath 3 , +.Xr tgmath 3 +.Sh HISTORY +A math library with many of the present functions appeared in +.At v7 . +The library was substantially rewritten for +.Bx 4.3 +to provide +better accuracy and speed on machines supporting either VAX +or IEEE 754 floating-point. +Most of this library was replaced with FDLIBM, developed at Sun +Microsystems, in +.Fx 1.1.5 . +Additional routines, including ones for +.Vt float +and +.Vt long double +values, were written for or imported into subsequent versions of FreeBSD. +.Sh BUGS +Many of the routines to compute transcendental functions produce +inaccurate results in other than the default rounding mode. +.Pp +On the i386 platform, trigonometric argument reduction is not +performed accurately for huge arguments, resulting in +large errors +for such arguments to +.Fn cos , +.Fn sin , +and +.Fn tan . diff --git a/lib/msun/man/nan.3 b/lib/msun/man/nan.3 new file mode 100644 index 000000000000..3650b84df09e --- /dev/null +++ b/lib/msun/man/nan.3 @@ -0,0 +1,97 @@ +.\" Copyright (c) 2007 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd December 16, 2007 +.Dt NAN 3 +.Os +.Sh NAME +.Nm nan , +.Nm nanf , +.Nm nanl +.Nd quiet \*(Nas +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn nan "const char *s" +.Ft float +.Fn nanf "const char *s" +.Ft long double +.Fn nanl "const char *s" +.Sh DESCRIPTION +The +.Dv NAN +macro expands to a quiet \*(Na (Not A Number). +Similarly, each of the +.Fn nan , +.Fn nanf , +and +.Fn nanl +functions generate a quiet \*(Na value without raising an invalid exception. +The argument +.Fa s +should point to either an empty string or a hexadecimal representation +of a non-negative integer (e.g., "0x1234".) +In the latter case, the integer is encoded in some free bits in the +representation of the \*(Na, which sometimes store +machine-specific information about why a particular \*(Na was generated. +There are 22 such bits available for +.Vt float +variables, 51 bits for +.Vt double +variables, and at least 51 bits for a +.Vt long double . +If +.Fa s +is improperly formatted or represents an integer that is too large, +then the particular encoding of the quiet \*(Na that is returned +is indeterminate. +.Sh COMPATIBILITY +Calling these functions with a non-empty string isn't portable. +Another operating system may translate the string into a different +\*(Na encoding, and furthermore, the meaning of a given \*(Na encoding +varies across machine architectures. +If you understood the innards of a particular platform well enough to +know what string to use, then you would have no need for these functions +anyway, so don't use them. +Use the +.Dv NAN +macro instead. +.Sh SEE ALSO +.Xr fenv 3 , +.Xr ieee 3 , +.Xr isnan 3 , +.Xr math 3 , +.Xr strtod 3 +.Sh STANDARDS +The +.Fn nan , +.Fn nanf , +and +.Fn nanl +functions and the +.Dv NAN +macro conform to +.St -isoC-99 . diff --git a/lib/msun/man/nextafter.3 b/lib/msun/man/nextafter.3 new file mode 100644 index 000000000000..3282050f1d2e --- /dev/null +++ b/lib/msun/man/nextafter.3 @@ -0,0 +1,93 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd May 4, 2005 +.Dt NEXTAFTER 3 +.Os +.Sh NAME +.Nm nextafter , +.Nm nextafterf , +.Nm nextafterl , +.Nm nexttoward , +.Nm nexttowardf , +.Nm nexttowardl +.Nd next representable value +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn nextafter "double x" "double y" +.Ft float +.Fn nextafterf "float x" "float y" +.Ft long double +.Fn nextafterl "long double x" "long double y" +.Ft double +.Fn nexttoward "double x" "long double y" +.Ft float +.Fn nexttowardf "float x" "long double y" +.Ft long double +.Fn nexttowardl "long double x" "long double y" +.Sh DESCRIPTION +These functions +return the next machine representable number from +.Fa x +in direction +.Fa y . +.Sh SEE ALSO +.Xr ieee 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn nextafter , +.Fn nextafterf , +.Fn nextafterl , +.Fn nexttoward , +.Fn nexttowardf , +and +.Fn nexttowardl +routines conform to +.St -isoC-99 . +They implement the Nextafter function recommended by +.St -ieee754 , +with the extension that +.Fn nextafter "+0.0" "-0.0" +returns +.Li -0.0 , +and +.Fn nextafter "-0.0" "+0.0" +returns +.Li +0.0 . +.Sh HISTORY +The +.Fn nextafter +function appeared in +.Bx 4.3 , +and +.Fn nextafterf +appeared in +.Fx 2.0 . diff --git a/lib/msun/man/remainder.3 b/lib/msun/man/remainder.3 new file mode 100644 index 000000000000..9c2d92f5e90c --- /dev/null +++ b/lib/msun/man/remainder.3 @@ -0,0 +1,156 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd March 30, 2008 +.Dt REMAINDER 3 +.Os +.Sh NAME +.Nm remainder , +.Nm remainderf , +.Nm remainderl , +.Nm remquo , +.Nm remquof , +.Nm remquol +.Nd minimal residue functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn remainder "double x" "double y" +.Ft float +.Fn remainderf "float x" "float y" +.Ft long double +.Fn remainderl "long double x" "long double y" +.Ft double +.Fn remquo "double x" "double y" "int *quo" +.Ft float +.Fn remquof "float x" "float y" "int *quo" +.Ft long double +.Fn remquol "long double x" "long double y" "int *quo" +.Sh DESCRIPTION +.Fn remainder , +.Fn remainderf , +.Fn remainderl , +.Fn remquo , +.Fn remquof , +and +.Fn remquol +return the remainder +.Fa r +:= +.Fa x +\- +.Fa n\(**y +where +.Fa n +is the integer nearest the exact value of +.Bk -words +.Fa x Ns / Ns Fa y ; +.Ek +moreover if +.Pf \*(Ba Fa n +\- +.Sm off +.Fa x No / Fa y No \*(Ba +.Sm on += +1/2 +then +.Fa n +is even. +Consequently +the remainder is computed exactly and +.Sm off +.Pf \*(Ba Fa r No \*(Ba +.Sm on +\*(Le +.Sm off +.Pf \*(Ba Fa y No \*(Ba/2 . +.Sm on +But attempting to take the remainder when +.Fa y +is 0 or +.Fa x +is \*(Pm\*(If is an invalid operation that produces a \*(Na. +.Pp +The +.Fn remquo , +.Fn remquof , +and +.Fn remquol +functions also store the last +.Va k +bits of +.Fa n +in the location pointed to by +.Fa quo , +provided that +.Fa n +exists. +The number of bits +.Va k +is platform-specific, but is guaranteed to be at least 3. +.Sh SEE ALSO +.Xr fmod 3 , +.Xr ieee 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn remainder , +.Fn remainderf , +.Fn remainderl , +.Fn remquo , +.Fn remquof , +and +.Fn remquol +routines conform to +.St -isoC-99 . +The remainder is as defined in +.St -ieee754 . +.Sh HISTORY +The +.Fn remainder +and +.Fn remainderf +functions appeared in +.Bx 4.3 +and +.Fx 2.0 , +respectively. +The +.Fn remquo +and +.Fn remquof +functions were added in +.Fx 6.0 , +and +.Fn remainderl +and +.Fn remquol +were added in +.Fx 8.0 . diff --git a/lib/msun/man/rint.3 b/lib/msun/man/rint.3 new file mode 100644 index 000000000000..399a0720b324 --- /dev/null +++ b/lib/msun/man/rint.3 @@ -0,0 +1,100 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 13, 2008 +.Dt RINT 3 +.Os +.Sh NAME +.Nm nearbyint , +.Nm nearbyintf , +.Nm nearbyintl , +.Nm rint , +.Nm rintf , +.Nm rintl +.Nd round to integral value in floating-point format +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn nearbyint "double x" +.Ft float +.Fn nearbyintf "float x" +.Ft long double +.Fn nearbyintl "long double x" +.Ft double +.Fn rint "double x" +.Ft float +.Fn rintf "float x" +.Ft long double +.Fn rintl "long double x" +.Sh DESCRIPTION +The +.Fn rint , +.Fn rintf , +and +.Fn rintl +functions return the integral value nearest to +.Fa x +according to the prevailing rounding mode. +These functions raise an inexact exception when the original argument +is not an exact integer. +.Pp +The +.Fn nearbyint , +.Fn nearbyintf , +and +.Fn nearbyintl +functions perform the same operation, except that they do not raise +an inexact exception. +.Sh SEE ALSO +.Xr abs 3 , +.Xr ceil 3 , +.Xr fabs 3 , +.Xr fenv 3 , +.Xr floor 3 , +.Xr ieee 3 , +.Xr lrint 3 , +.Xr lround 3 , +.Xr math 3 , +.Xr round 3 +.Sh STANDARDS +These functions conform to +.St -isoC-99 . +.Sh HISTORY +A +.Fn rint +function appeared in +.At v6 . +The +.Fn nearbyint +and +.Fn nearbyintf +functions appeared in +.Fx 5.3 , +and the long double variants were first available in +.Fx 8.0 . diff --git a/lib/msun/man/round.3 b/lib/msun/man/round.3 new file mode 100644 index 000000000000..b63a9f6ce7a5 --- /dev/null +++ b/lib/msun/man/round.3 @@ -0,0 +1,78 @@ +.\" Copyright (c) 2003, Steven G. Kargl +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 7, 2005 +.Dt ROUND 3 +.Os +.Sh NAME +.Nm round , +.Nm roundf , +.Nm roundl +.Nd round to nearest integral value +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn round "double x" +.Ft float +.Fn roundf "float x" +.Ft "long double" +.Fn roundl "long double x" +.Sh DESCRIPTION +The +.Fn round , +.Fn roundf , +and +.Fn roundl +functions return the nearest integral value to +.Fa x ; +if +.Fa x +lies halfway between two integral values, then these +functions return the integral value with the larger +absolute value (i.e., they round away from zero). +.Sh SEE ALSO +.Xr ceil 3 , +.Xr floor 3 , +.Xr ieee 3 , +.Xr lrint 3 , +.Xr lround 3 , +.Xr math 3 , +.Xr rint 3 , +.Xr trunc 3 +.Sh STANDARDS +These functions conform to +.St -isoC-99 . +.Sh HISTORY +The +.Fn round +and +.Fn roundf +functions appeared in +.Fx 5.3 . +The +.Fn roundl +function appeared in +.Fx 6.0 . diff --git a/lib/msun/man/scalbn.3 b/lib/msun/man/scalbn.3 new file mode 100644 index 000000000000..9b14e1fcb3d4 --- /dev/null +++ b/lib/msun/man/scalbn.3 @@ -0,0 +1,88 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd March 4, 2005 +.Dt SCALBN 3 +.Os +.Sh NAME +.Nm scalbln , +.Nm scalblnf , +.Nm scalblnl , +.Nm scalbn , +.Nm scalbnf , +.Nm scalbnl +.Nd adjust exponent +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn scalbln "double x" "long n" +.Ft float +.Fn scalblnf "float x" "long n" +.Ft long double +.Fn scalblnl "long double x" "long n" +.Ft double +.Fn scalbn "double x" "int n" +.Ft float +.Fn scalbnf "float x" "int n" +.Ft long double +.Fn scalbnl "long double x" "int n" +.Sh DESCRIPTION +These routines return +.Fa x Ns \(**(2** Ns Fa n ) +computed by exponent manipulation. +.Sh SEE ALSO +.Xr ieee 3 , +.Xr math 3 +.Sh STANDARDS +These routines conform to +.St -isoC-99 , +and they implement the Scalb function recommended by +.St -ieee754 . +.Sh HISTORY +The +.Fn scalbn +and +.Fn scalbnf +functions appeared in +.Bx 4.3 +and +.Fx 2.0 , +respectively. +The +.Fn scalbln +and +.Fn scalblnf +functions first appeared in +.Fx 5.3 , +and +.Fn scalblnl +and +.Fn scalbln +in +.Fx 6.0 . diff --git a/lib/msun/man/signbit.3 b/lib/msun/man/signbit.3 new file mode 100644 index 000000000000..b90c338b1c01 --- /dev/null +++ b/lib/msun/man/signbit.3 @@ -0,0 +1,55 @@ +.\" Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd July 18, 2004 +.Dt SIGNBIT 3 +.Os +.Sh NAME +.Nm signbit +.Nd "determine whether a floating-point number's sign is negative" +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft int +.Fn signbit "real-floating x" +.Sh DESCRIPTION +The +.Fn signbit +macro takes an argument of +.Fa x +and returns non-zero if the value of its sign is negative, otherwise 0. +.Sh SEE ALSO +.Xr fpclassify 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn signbit +macro conforms to +.St -isoC-99 . +.Sh HISTORY +The +.Fn signbit +macro was added in +.Fx 5.1 . diff --git a/lib/msun/man/sin.3 b/lib/msun/man/sin.3 new file mode 100644 index 000000000000..376fc706dd2b --- /dev/null +++ b/lib/msun/man/sin.3 @@ -0,0 +1,82 @@ +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 1, 2020 +.Dt SIN 3 +.Os +.Sh NAME +.Nm sin , +.Nm sinf , +.Nm sinl +.Nd sine functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn sin "double x" +.Ft float +.Fn sinf "float x" +.Ft long double +.Fn sinl "long double x" +.Sh DESCRIPTION +The +.Fn sin , +.Fn sinf , +and +.Fn sinl +functions compute the sine of +.Fa x +(measured in radians). +A large magnitude argument may yield a result with little +or no significance. +.Sh RETURN VALUES +The +.Fn sin , +.Fn sinf , +and +.Fn sinl +functions return the sine value. +.Sh SEE ALSO +.Xr acos 3 , +.Xr asin 3 , +.Xr atan 3 , +.Xr atan2 3 , +.Xr cos 3 , +.Xr cosh 3 , +.Xr csin 3 , +.Xr math 3 , +.Xr sinh 3 , +.Xr tan 3 , +.Xr tanh 3 +.Sh STANDARDS +These functions conform to +.St -isoC-99 . +.Sh HISTORY +The +.Fn sin +function first appeared in +.At v1 . diff --git a/lib/msun/man/sincos.3 b/lib/msun/man/sincos.3 new file mode 100644 index 000000000000..0a9f20e60d55 --- /dev/null +++ b/lib/msun/man/sincos.3 @@ -0,0 +1,80 @@ +.\" Copyright (c) 2011 Steven G. Kargl. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd March 12, 2011 +.Dt SINCOS 3 +.Os +.Sh NAME +.Nm sincos , +.Nm sincosf , +.Nm sincosl +.Nd sine and cosine functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft void +.Fn sincos "double x" "double *s" "double *c" +.Ft void +.Fn sincosf "float x" "float *s" "float *c" +.Ft void +.Fn sincosl "long double x" "long double *s" "long double *c" +.Sh DESCRIPTION +The +.Fn sincos , +.Fn sincosf , +and +.Fn sincosl +functions compute the sine and cosine of +.Fa x . +Using these functions allows argument reduction to occur only +once instead of twice with individual invocations of +.Fn sin +and +.Fn cos . +Like +.Fn sin +and +.Fn cos , +a large magnitude argument may yield a result with little +or no significance. +.Sh RETURN VALUES +Upon returning from +.Fn sincos , +.Fn sincosf , +and +.Fn sincosl , +the memory pointed to by +.Fa "*s" +and +.Fa "*c" +are assigned the values of sine and cosine, respectively. +.Sh SEE ALSO +.Xr cos 3 , +.Xr sin 3 +.Sh HISTORY +These functions were added to +.Fx 11.2 +to aid in writing various complex function contained in +.St -isoC-99 . + diff --git a/lib/msun/man/sinh.3 b/lib/msun/man/sinh.3 new file mode 100644 index 000000000000..7fb928028371 --- /dev/null +++ b/lib/msun/man/sinh.3 @@ -0,0 +1,75 @@ +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 3, 2022 +.Dt SINH 3 +.Os +.Sh NAME +.Nm sinh , +.Nm sinhf , +.Nm sinhl +.Nd hyperbolic sine function +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn sinh "double x" +.Ft float +.Fn sinhf "float x" +.Ft long double +.Fn sinhl "long double x" +.Sh DESCRIPTION +The +.Fn sinh , +.Fn sinhf , +and +.Fn sinhl +functions compute the hyperbolic sine of +.Fa x . +.Sh SEE ALSO +.Xr acos 3 , +.Xr asin 3 , +.Xr atan 3 , +.Xr atan2 3 , +.Xr cos 3 , +.Xr cosh 3 , +.Xr csinh 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr tan 3 , +.Xr tanh 3 +.Sh STANDARDS +The +.Fn sinh +function conforms to +.St -isoC . +.Sh HISTORY +The +.Fn sinh +function first appeared in +.At v7 . diff --git a/lib/msun/man/sinpi.3 b/lib/msun/man/sinpi.3 new file mode 100644 index 000000000000..63a1e3010de5 --- /dev/null +++ b/lib/msun/man/sinpi.3 @@ -0,0 +1,96 @@ +.\" Copyright (c) 2017 Steven G. Kargl <kargl@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 1, 2017 +.Dt SINPI 3 +.Os +.Sh NAME +.Nm sinpi , +.Nm sinpif , +.Nm sinpil +.Nd half\(encycle sine functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn sinpi "double x" +.Ft float +.Fn sinpif "float x" +.Ft long double +.Fn sinpil "long double x" +.Sh DESCRIPTION +The +.Fn sinpi , +.Fn sinpif , +and +.Fn sinpil +functions compute the sine of +.Fa "\(*p \(mu x" . +and measure angles in half-cycles. +.Sh RETURN VALUES +The +.Fn sinpi , +.Fn sinpif , +and +.Fn sinpil +functions returns +.Fn sin "\(*p \(mu x" . +If \*(Bax\*(Ba \*(Ge 2^(p - 1) +where p is the floating\(enpoint precision of +.Ar x , +then the returned value is \*(Pm0 and it has no significance. +.Sh SPECIAL VALUES +.Bl -tag -width "sinpi(NaN)" +.It Fn sinpi \*(Pm0 +returns \*(Pm0. +.It Fn sinpi \*(Pmn +returns \*(Pm0 for positive integers +.Ar n . +.It Fn sinpi \*(Pm\(if +return an \*(Na and raises an FE_INVALID exception. +.It Fn sinpi \*(Na +return an \*(Na and raises an FE_INVALID exception. +.El +.Sh SEE ALSO +.Xr cos 3 , +.Xr cospi 3 , +.Xr fenv 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr tan 3 , +.Xr tanpi 3 +.Sh AUTHORS +The half\(encycle trignometric functions were written by +.An Steven G. Kargl Aq Mt kargl@FreeBSD.org . +.Sh STANDARDS +These functions conform to +IEEE Std 754\(tm\(en2008 , +\(dqIEEE Standard for Floating-Point Arithmetic\(dq +and to +ISO/IEC TS 18661-4 , +\(dqInformation technology \(em Programming languages, their environments, +and system software interfaces \(em Floating\(enpoint extensions for +C\(dq \(em Part 4: Supplementary functions. + diff --git a/lib/msun/man/sqrt.3 b/lib/msun/man/sqrt.3 new file mode 100644 index 000000000000..f4a217353af0 --- /dev/null +++ b/lib/msun/man/sqrt.3 @@ -0,0 +1,122 @@ +.\" Copyright (c) 1985, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd February 15, 2020 +.Dt SQRT 3 +.Os +.Sh NAME +.Nm cbrt , +.Nm cbrtf , +.Nm cbrtl , +.Nm sqrt , +.Nm sqrtf , +.Nm sqrtl +.Nd cube root and square root functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn cbrt "double x" +.Ft float +.Fn cbrtf "float x" +.Ft long double +.Fn cbrtl "long double x" +.Ft double +.Fn sqrt "double x" +.Ft float +.Fn sqrtf "float x" +.Ft long double +.Fn sqrtl "long double x" +.Sh DESCRIPTION +The +.Fn cbrt , +.Fn cbrtf , +and +.Fn cbrtl +functions compute +the cube root of +.Fa x . +.Pp +The +.Fn sqrt , +.Fn sqrtf , +and +.Fn sqrtl +functions compute the +non-negative square root of +.Fa x . +.Sh RETURN VALUES +The +.Fn cbrt , +.Fn cbrtf , +and +.Fn cbrtl +functions return the requested cube root. +The +.Fn sqrt , +.Fn sqrtf , +and +.Fn sqrtl +functions return the requested square root +unless an error occurs. +An attempt to take the +.Fn sqrt +of negative +.Fa x +raises an invalid exception and causes an \*(Na to be returned +(except that the square root of -0 is valid and equal to -0.) +.Sh SEE ALSO +.Xr fenv 3 , +.Xr math 3 +.Sh STANDARDS +The +.Fn cbrt , +.Fn cbrtf , +.Fn cbrtl , +.Fn sqrt , +.Fn sqrtf , +and +.Fn sqrtl +functions conform to +.St -isoC-99 . +.Sh HISTORY +The +.Fn cbrt +function appeared in +.Bx 4.3 . +The +.Fn sqrt +function appeared in +.At v2 . +.Fn sqrtl +function appeared in +.Fx 8.0 . +The +.Fn cbrtl +function appeared in +.Fx 9.0 . diff --git a/lib/msun/man/tan.3 b/lib/msun/man/tan.3 new file mode 100644 index 000000000000..8714d2429c2a --- /dev/null +++ b/lib/msun/man/tan.3 @@ -0,0 +1,80 @@ +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 24, 2008 +.Dt TAN 3 +.Os +.Sh NAME +.Nm tan , +.Nm tanf , +.Nm tanl +.Nd tangent functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn tan "double x" +.Ft float +.Fn tanf "float x" +.Ft long double +.Fn tanl "long double x" +.Sh DESCRIPTION +The +.Fn tan , +.Fn tanf , +and +.Fn tanl +functions compute the tangent of +.Fa x +(measured in radians). +A large magnitude argument may yield a result +with little or no significance. +For a discussion of error due to roundoff, see +.Xr math 3 . +.Sh RETURN VALUES +The +.Fn tan , +.Fn tanf , +and +.Fn tanl +functions return the tangent value. +.Sh SEE ALSO +.Xr acos 3 , +.Xr asin 3 , +.Xr atan 3 , +.Xr atan2 3 , +.Xr cos 3 , +.Xr cosh 3 , +.Xr ctan 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr sinh 3 , +.Xr tanh 3 +.Sh STANDARDS +These functions conform to +.St -isoC-99 . diff --git a/lib/msun/man/tanh.3 b/lib/msun/man/tanh.3 new file mode 100644 index 000000000000..e795d0e7eba6 --- /dev/null +++ b/lib/msun/man/tanh.3 @@ -0,0 +1,84 @@ +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 3, 2022 +.Dt TANH 3 +.Os +.Sh NAME +.Nm tanh , +.Nm tanhf , +.Nm tanhl +.Nd hyperbolic tangent functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn tanh "double x" +.Ft float +.Fn tanhf "float x" +.Ft long double +.Fn tanhl "long double x" +.Sh DESCRIPTION +The +.Fn tanh , +.Fn tanhf , +and +.Fn tanhl +functions compute the hyperbolic tangent of +.Fa x . +For a discussion of error due to roundoff, see +.Xr math 3 . +.Sh RETURN VALUES +The +.Fn tanh , +.Fn tanhf , +and the +.Fn tanhl +functions return the hyperbolic tangent value. +.Sh SEE ALSO +.Xr acos 3 , +.Xr asin 3 , +.Xr atan 3 , +.Xr atan2 3 , +.Xr cos 3 , +.Xr cosh 3 , +.Xr ctanh 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr sinh 3 , +.Xr tan 3 +.Sh STANDARDS +The +.Fn tanh +function conforms to +.St -isoC . +.Sh HISTORY +The +.Fn tanh +function first appeared in +.At v7 . diff --git a/lib/msun/man/tanpi.3 b/lib/msun/man/tanpi.3 new file mode 100644 index 000000000000..b11d54031b71 --- /dev/null +++ b/lib/msun/man/tanpi.3 @@ -0,0 +1,99 @@ +.\" Copyright (c) 2017 Steven G. Kargl <kargl@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 1, 2017 +.Dt TANPI 3 +.Os +.Sh NAME +.Nm tanpi , +.Nm tanpif , +.Nm tanpil +.Nd half\(encycle tangent functions +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn tanpi "double x" +.Ft float +.Fn tanpif "float x" +.Ft long double +.Fn tanpil "long double x" +.Sh DESCRIPTION +The +.Fn tanpi , +.Fn tanpif , +and +.Fn tanpil +functions compute the tangent of +.Fa "\(*p \(mu x" +and measure angles in half-cycles. +.Sh RETURN VALUES +The +.Fn tanpi , +.Fn tanpif , +and +.Fn tanpil +functions returns +.Fn tan "\(*p \(mu x" . +If \*(Bax\*(Ba \*(Ge 2^(p - 1) +where p is the floating\(enpoint precision of +.Ar x , +then the returned value is \*(Pm0 and it has no significance. +.Sh SPECIAL VALUES +.Bl -tag -width "tanpi(+n/2)" +.It Fn tanpi \*(Pm0 +returns \*(Pm0. +.It Fn tanpi \*(Pmn +returns \*(Pm0 for positive integers +.Ar n . +.It Fn tanpi \*(Pmn/2 +returns \*(Na for n > 0 and raises an FE_INVALID exception. +.It Fn tanpi \*(Pm\(if +return an \*(Na and raises an FE_INVALID exception. +.It Fn tanpi \*(Na +return an \*(Na and raises an FE_INVALID exception. +.El +.Sh SEE ALSO +.Xr cos 3 , +.Xr cospi 3 , +.Xr fenv 3 , +.Xr math 3 , +.Xr sin 3 , +.Xr sinpi 3 , +.Xr tan 3 +.Sh AUTHORS +The half\(encycle trignometric functions were written by +.An Steven G. Kargl Aq Mt kargl@FreeBSD.org . +.Sh STANDARDS +These functions conform to +IEEE Std 754\(tm\(en2008 , +\(dqIEEE Standard for Floating-Point Arithmetic\(dq +and to +ISO/IEC TS 18661-4 , +\(dqInformation technology \(em Programming languages, their environments, +and system software interfaces \(em Floating\(enpoint extensions for +C\(dq \(em Part 4: Supplementary functions. + + diff --git a/lib/msun/man/trunc.3 b/lib/msun/man/trunc.3 new file mode 100644 index 000000000000..7846dd11bc1f --- /dev/null +++ b/lib/msun/man/trunc.3 @@ -0,0 +1,78 @@ +.\" Copyright (c) 2004, 2005 David Schultz <das@FreeBSD.org> +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd April 16, 2005 +.Dt TRUNC 3 +.Os +.Sh NAME +.Nm trunc , +.Nm truncf , +.Nm truncl +.Nd nearest integral value with magnitude less than or equal to |x| +.Sh LIBRARY +.Lb libm +.Sh SYNOPSIS +.In math.h +.Ft double +.Fn trunc "double x" +.Ft float +.Fn truncf "float x" +.Ft "long double" +.Fn truncl "long double x" +.Sh DESCRIPTION +The +.Fn trunc , +.Fn truncf , +and +.Fn truncl +functions return the nearest integral value with magnitude less than +or equal to +.Pf | Fa x Ns | . +They are equivalent to +.Fn rint , +.Fn rintf , +and +.Fn rintl , +respectively, in the +.Dv FE_TOWARDZERO +rounding mode. +.Sh SEE ALSO +.Xr ceil 3 , +.Xr fesetround 3 , +.Xr floor 3 , +.Xr math 3 , +.Xr nextafter 3 , +.Xr rint 3 , +.Xr round 3 +.Sh STANDARDS +The +.Fn trunc , +.Fn truncf , +and +.Fn truncl +functions conform to +.St -isoC-99 . +.Sh HISTORY +These routines first appeared in +.Fx 5.3 . |