From fff4c0295e4d7fa9aaf4eaf66cb92a2f161e8352 Mon Sep 17 00:00:00 2001 From: "William F. Jolitz" Date: Thu, 2 May 1991 04:10:09 -0800 Subject: [PATCH] 386BSD 0.0 development Work on file usr/src/lib/libm/common_source/atan.3 Work on file usr/src/lib/libm/common_source/acos.3 Work on file usr/src/lib/libm/common_source/asin.3 Work on file usr/src/lib/libm/common_source/atan2.3 Work on file usr/src/lib/libm/common_source/cos.3 Work on file usr/src/lib/libm/common_source/ceil.3 Work on file usr/src/lib/libm/common_source/cosh.3 Work on file usr/src/lib/libm/common_source/fabs.3 Work on file usr/src/lib/libm/common_source/fmod.3 Work on file usr/src/lib/libm/common_source/rint.3 Work on file usr/src/lib/libm/common_source/tan.3 Work on file usr/src/lib/libm/common_source/tanh.3 Co-Authored-By: Lynne Greer Jolitz Synthesized-from: 386BSD-0.0/src --- usr/src/lib/libm/common_source/acos.3 | 88 ++++++++++++ usr/src/lib/libm/common_source/asin.3 | 90 ++++++++++++ usr/src/lib/libm/common_source/atan.3 | 74 ++++++++++ usr/src/lib/libm/common_source/atan2.3 | 188 +++++++++++++++++++++++++ usr/src/lib/libm/common_source/ceil.3 | 65 +++++++++ usr/src/lib/libm/common_source/cos.3 | 73 ++++++++++ usr/src/lib/libm/common_source/cosh.3 | 74 ++++++++++ usr/src/lib/libm/common_source/fabs.3 | 66 +++++++++ usr/src/lib/libm/common_source/fmod.3 | 75 ++++++++++ usr/src/lib/libm/common_source/rint.3 | 115 +++++++++++++++ usr/src/lib/libm/common_source/tan.3 | 73 ++++++++++ usr/src/lib/libm/common_source/tanh.3 | 70 +++++++++ 12 files changed, 1051 insertions(+) create mode 100644 usr/src/lib/libm/common_source/acos.3 create mode 100644 usr/src/lib/libm/common_source/asin.3 create mode 100644 usr/src/lib/libm/common_source/atan.3 create mode 100644 usr/src/lib/libm/common_source/atan2.3 create mode 100644 usr/src/lib/libm/common_source/ceil.3 create mode 100644 usr/src/lib/libm/common_source/cos.3 create mode 100644 usr/src/lib/libm/common_source/cosh.3 create mode 100644 usr/src/lib/libm/common_source/fabs.3 create mode 100644 usr/src/lib/libm/common_source/fmod.3 create mode 100644 usr/src/lib/libm/common_source/rint.3 create mode 100644 usr/src/lib/libm/common_source/tan.3 create mode 100644 usr/src/lib/libm/common_source/tanh.3 diff --git a/usr/src/lib/libm/common_source/acos.3 b/usr/src/lib/libm/common_source/acos.3 new file mode 100644 index 0000000000..ce30cf331b --- /dev/null +++ b/usr/src/lib/libm/common_source/acos.3 @@ -0,0 +1,88 @@ +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. 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. +.\" +.\" @(#)acos.3 5.1 (Berkeley) 5/2/91 +.\" +.Dd May 2, 1991 +.Dt ACOS 3 +.Os +.Sh NAME +.Nm acos +.Nd arc cosine function +.Sh SYNOPSIS +.Fd #include +.Ft double +.Fn acos "double x" +.Sh DESCRIPTION +The +.Fn acos +function computes the principal value of the arc cosine of +.Fa x . +A domain error occurs for arguments not in the range [-1, +1]. +For a discussion of error due to roundoff, see +.Xr math 3 . +.Sh RETURN VALUES +The +.Fn acos +function returns the arc cosine in the range +.Bq 0 , \*(Pi +radians. +On the +.Tn VAX +and +.Tn Tahoe , +if: +.Bd -unfilled -offset indent +.Pf \&| Ns Ar x Ns \&| > 1 , +.Ed +.Pp +.Fn acos x +sets the global variable +.Va errno +to +.Dv EDOM +and a reserved operand fault is generated. +.Sh SEE ALSO +.Xr sin 3 , +.Xr cos 3 , +.Xr tan 3 , +.Xr asin 3 , +.Xr atan 3 , +.Xr atan2 3 , +.Xr sinh 3 , +.Xr cosh 3 , +.Xr tanh 3 , +.Xr math 3 , +.Sh STANDARDS +The +.Fn acos +function conforms to +.St -ansiC . diff --git a/usr/src/lib/libm/common_source/asin.3 b/usr/src/lib/libm/common_source/asin.3 new file mode 100644 index 0000000000..0331754d14 --- /dev/null +++ b/usr/src/lib/libm/common_source/asin.3 @@ -0,0 +1,90 @@ +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. 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. +.\" +.\" @(#)asin.3 5.1 (Berkeley) 5/2/91 +.\" +.Dd May 2, 1991 +.Dt ASIN 3 +.Os +.Sh NAME +.Nm asin +.Nd arc sine function +.Sh SYNOPSIS +.Fd #include +.Ft double +.Fn asin "double x" +.Sh DESCRIPTION +The +.Fn asin +function computes the principal value of the arc sine of +.Fa x . +A domain error occurs for arguments not in the range [-1, +1]. +For a discussion of error due to roundoff, see +.Xr math 3 . +.Sh RETURN VALUES +The +.Fn asin +function returns the arc sine in the range +.Bk -words +.Bq -\*(Pi/2, +\*(Pi/2 +.Ek +radians. +On the +.Tn VAX , +and Tahoe , +if: +.Bd -unfilled -offset indent +.Pf \&| Ns Ar x Ns \&| > 1 +.Ed +.Pp +the +global variable +.Va errno +is set to +.Er EDOM +and +a reserved operand fault generated. +.Sh SEE ALSO +.Xr acos 3 , +.Xr atan 3 , +.Xr atan2 3 , +.Xr cos 3 , +.Xr cosh 3 , +.Xr sin 3 , +.Xr sinh 3 , +.Xr tan 3 , +.Xr tanh 3 , +.Xr math 3 , +.Sh STANDARDS +The +.Fn asin +function conforms to +.St -ansiC . diff --git a/usr/src/lib/libm/common_source/atan.3 b/usr/src/lib/libm/common_source/atan.3 new file mode 100644 index 0000000000..565204169d --- /dev/null +++ b/usr/src/lib/libm/common_source/atan.3 @@ -0,0 +1,74 @@ +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. 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. +.\" +.\" @(#)atan.3 5.1 (Berkeley) 5/2/91 +.\" +.Dd May 2, 1991 +.Dt ATAN 3 +.Os +.Sh NAME +.Nm atan +.Nd arc tangent function of one variable +.Sh SYNOPSIS +.Fd #include +.Ft double +.Fn atan "double x" +.Sh DESCRIPTION +The +.Fn atan +function computes the principal value of the arc tangent of +.Fa x . +For a discussion of error due to roundoff, see +.Xr math 3 . +.Sh RETURN VALUES +The +.Fn atan +function returns 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 sin 3 , +.Xr sinh 3 , +.Xr tan 3 , +.Xr tanh 3 , +.Xr math 3 , +.Sh STANDARDS +The +.Fn atan +function conforms to +.St -ansiC . diff --git a/usr/src/lib/libm/common_source/atan2.3 b/usr/src/lib/libm/common_source/atan2.3 new file mode 100644 index 0000000000..5ae4ab9c82 --- /dev/null +++ b/usr/src/lib/libm/common_source/atan2.3 @@ -0,0 +1,188 @@ +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. 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. +.\" +.\" @(#)atan2.3 5.1 (Berkeley) 5/2/91 +.\" +.Dd May 2, 1991 +.Dt ATAN2 3 +.Os +.Sh NAME +.Nm atan2 +.Nd arc tangent function of two variables +.Sh SYNOPSIS +.Fd #include +.Ft double +.Fn atan2 "double y" "double x" +.Sh DESCRIPTION +The +.Xr atan2 +function computes the principal value of the arc tangent of +.Ar y/ Ns Ar x , +using the signs of both arguments to determine the quadrant of +the return value. +.Sh RETURN VALUES +The +.Xr atan2 +function, if successful, +returns the arc tangent of +.Ar y/ Ns Ar x +in the range +.Bk -words +.Bq \&- Ns \*(Pi , \&+ Ns \*(Pi +.Ek +radians. +If both +.Ar x +and +.Ar y +are zero, the global variable +.Va errno +is set to +.Er EDOM . +On the +.Tn VAX : +.Bl -column atan_(y,x)_:=____ sign(y)_(Pi_atan2(Xy_xX))___ +.It Fn atan2 y x No := Ta +.Fn atan y/x Ta +if +.Ar x +> 0, +.It Ta sign( Ns Ar y Ns )*(\*(Pi - +.Fn atan "\\*(Bay/x\\*(Ba" ) Ta +if +.Ar x +< 0, +.It Ta +.No 0 Ta +if x = y = 0, or +.It Ta +.Pf sign( Ar y Ns )*\\*(Pi/2 Ta +if +.Ar x += 0 \*(!= +.Ar y . +.El +.Sh NOTES +The function +.Fn atan2 +defines "if x > 0," +.Fn atan2 0 0 += 0 on a +.Tn VAX +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) +on a VAX. 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 cos 3 , +.Xr cosh 3 , +.Xr sin 3 , +.Xr sinh 3 , +.Xr tan 3 , +.Xr tanh 3 , +.Xr math 3 , +.Sh STANDARDS +The +.Fn atan2 +function conforms to +.St -ansiC . diff --git a/usr/src/lib/libm/common_source/ceil.3 b/usr/src/lib/libm/common_source/ceil.3 new file mode 100644 index 0000000000..0db530e46f --- /dev/null +++ b/usr/src/lib/libm/common_source/ceil.3 @@ -0,0 +1,65 @@ +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. 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. +.\" +.\" @(#)ceil.3 5.1 (Berkeley) 5/2/91 +.\" +.Dd May 2, 1991 +.Dt CEIL 3 +.Os +.Sh NAME +.Nm ceil +.Nd smallest integral value not greater than x +.Sh SYNOPSIS +.Fd #include +.Ft double +.Fn ceil "double x" +.Sh DESCRIPTION +The +.Fn ceil +function computes the smallest integral value not less than +.Fa x . +.Sh RETURN VALUES +The +.Fn ceil +function returns the smallest integral value +expressed as a double. +.Sh SEE ALSO +.Xr abs 3 , +.Xr fabs 3 , +.Xr floor 3 , +.Xr rint 3 , +.Xr ieee 3 , +.Xr math.3 +.Sh STANDARDS +The +.Fn ceil +function conforms to +.St -ansiC . diff --git a/usr/src/lib/libm/common_source/cos.3 b/usr/src/lib/libm/common_source/cos.3 new file mode 100644 index 0000000000..e4cffce68b --- /dev/null +++ b/usr/src/lib/libm/common_source/cos.3 @@ -0,0 +1,73 @@ +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. 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. +.\" +.\" @(#)cos.3 5.1 (Berkeley) 5/2/91 +.\" +.Dd May 2, 1991 +.Dt COS 3 +.Os +.Sh NAME +.Nm cos +.Nd cosine function +.Sh SYNOPSIS +.Fd #include +.Ft double +.Fn cos "double x" +.Sh DESCRIPTION +The +.Fn cos +function computes 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 +function returns the cosine value. +.Sh SEE ALSO +.Xr sin 3 , +.Xr tan 3 , +.Xr asin 3 , +.Xr acos 3 , +.Xr atan 3 , +.Xr atan2 3 , +.Xr sinh 3 , +.Xr cosh 3 , +.Xr tanh 3 , +.Xr math 3 , +.Sh STANDARDS +The +.Fn acos +function conforms to +.St -ansiC . diff --git a/usr/src/lib/libm/common_source/cosh.3 b/usr/src/lib/libm/common_source/cosh.3 new file mode 100644 index 0000000000..0fda8b8861 --- /dev/null +++ b/usr/src/lib/libm/common_source/cosh.3 @@ -0,0 +1,74 @@ +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. 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. +.\" +.\" @(#)cosh.3 5.1 (Berkeley) 5/2/91 +.\" +.Dd May 2, 1991 +.Dt COSH 3 +.Os +.Sh NAME +.Nm cosh +.Nd hyperbolic cosine function +.Sh SYNOPSIS +.Fd #include +.Ft double +.Fn cosh "double x" +.Sh DESCRIPTION +The +.Fn cosh +function computes the hyperbolic cosine of +.Fa x . +.Sh RETURN VALUES +The +.Fn cosh +function returns the hyperbolic cosine unless the magnitude +of +.Fa x +is too large; in this event, the global variable +.Va errno +is set to +.Er ERANGE . +.Sh SEE ALSO +.Xr acos 3 , +.Xr asin 3 , +.Xr atan 3 , +.Xr atan2 3 , +.Xr cos 3 , +.Xr sin 3 , +.Xr sinh 3 , +.Xr tan 3 , +.Xr tanh 3 , +.Xr math 3 , +.Sh STANDARDS +The +.Fn cosh +function conforms to +.St -ansiC . diff --git a/usr/src/lib/libm/common_source/fabs.3 b/usr/src/lib/libm/common_source/fabs.3 new file mode 100644 index 0000000000..74cd23e7da --- /dev/null +++ b/usr/src/lib/libm/common_source/fabs.3 @@ -0,0 +1,66 @@ +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" @(#)fabs.3 5.1 (Berkeley) 5/2/91 +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. 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. +.\" +.\" @(#)fabs.3 5.1 (Berkeley) 5/2/91 +.\" +.Dd May 2, 1991 +.Dt FABS 3 +.Os +.Sh NAME +.Nm fabs +.Nd floating-point absolute value function +.Sh SYNOPSIS +.Fd #include +.Ft double +.Fn fabs "double x" +.Sh DESCRIPTION +The +.Fn fabs +function computes the absolute value of a floating-point number +.Fa x . +.Sh RETURN VALUES +The +.Fn fabs +function returns the absolute value of +.Fa x . +.Sh SEE ALSO +.Xr abs 3 , +.Xr ceil 3 , +.Xr floor 3 , +.Xr rint 3 , +.Xr ieee 3 , +.Xr math.3 +.Sh STANDARDS +The +.Fn fabs +function conforms to +.St -ansiC . diff --git a/usr/src/lib/libm/common_source/fmod.3 b/usr/src/lib/libm/common_source/fmod.3 new file mode 100644 index 0000000000..982880d712 --- /dev/null +++ b/usr/src/lib/libm/common_source/fmod.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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. 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. +.\" +.\" @(#)fmod.3 5.1 (Berkeley) 5/2/91 +.\" +.Dd May 2, 1991 +.Dt FMOD 3 +.Os +.Sh NAME +.Nm fmod +.Nd floating-point remainder function +.Sh SYNOPSIS +.Fd #include +.Ft double +.Fn fmod "double x" "double y" +.Sh DESCRIPTION +The +.Fn fmod +function computes the floating-point remainder of +.Fa x Ns / Fa y . +.Sh RETURN VALUES +The +.Fn fmod +function returns the value +.Sm off +.Fa x - Em i * Fa y , +.Sm on +for some integer +.Em i +such that, if +.Fa y +is non-zero, the result has the same sign as +.Fa x +and magnitude less than the magnitude of +.Fa y . +If +.Fa y +is zero, whether a domain error occurs or the +.Fn fmod +function returns zero is implementation-defined. +.Sh SEE ALSO +.Xr math 3 +.Sh STANDARDS +The +.Fn fmod +function conforms to +.St -ansiC . diff --git a/usr/src/lib/libm/common_source/rint.3 b/usr/src/lib/libm/common_source/rint.3 new file mode 100644 index 0000000000..a9fb416fcd --- /dev/null +++ b/usr/src/lib/libm/common_source/rint.3 @@ -0,0 +1,115 @@ +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. 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. +.\" +.\" @(#)rint.3 5.1 (Berkeley) 5/2/91 +.\" +.Dd May 2, 1991 +.Dt RINT 3 +.Os +.Sh NAME +.Nm rint +.Nd and round-to-closest integer functions +.Sh SYNOPSIS +.Fd #include +.Ft double +.Fn rint "double x" +.Sh DESCRIPTION +The +.Fn rint +function finds the integer (represented as a double precision number) +nearest to +.Fa x +in the direction of the prevailing rounding mode. +.Sh NOTES +On a +.Tn VAX , +.Fn rint x +is equivalent to adding half to the magnitude +and then rounding towards zero. +.Pp +In the default rounding mode, to nearest, +on a machine that conforms to +.Tn IEEE +754, +.Fn rint x +is the integer nearest +.Fa x +with the additional stipulation +that if +.Li |rint(x)\-x|=1/2 +then +.Fn rint x +is even. +Other rounding modes can make +.Fn rint +act like +.Fn floor , +or like +.Fn ceil , +or round towards zero. +.Pp +Another way to obtain an integer near +.Fa x +is to declare (in C) +.Bd -literal -offset indent +double x;\0\0\0\0 int k;\0\0\0\0k\0=\0x; +.Ed +.Pp +Most C compilers round +.Fa x +towards 0 to get the integer +.Fa k , +but +some do otherwise. +If in doubt, use +.Fn floor , +.Fn ceil , +or +.Fn rint +first, whichever you intend. +Also note that, if x is larger than +.Fa k +can accommodate, the value of +.Fa k +and the presence or absence of an integer overflow are hard to +predict. +.Sh SEE ALSO +.Xr abs 3 , +.Xr fabs 3 , +.Xr ceil 3 , +.Xr floor 3 , +.Xr ieee 3 , +.Xr math 3 +.Sh HISTORY +A +.Fn rint +function appeared in +.At v6 . diff --git a/usr/src/lib/libm/common_source/tan.3 b/usr/src/lib/libm/common_source/tan.3 new file mode 100644 index 0000000000..1fc2ae9fee --- /dev/null +++ b/usr/src/lib/libm/common_source/tan.3 @@ -0,0 +1,73 @@ +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. 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. +.\" +.\" @(#)tan.3 5.1 (Berkeley) 5/2/91 +.\" +.Dd May 2, 1991 +.Dt TAN 3 +.Os +.Sh NAME +.Nm tan +.Nd tangent function +.Sh SYNOPSIS +.Fd #include +.Ft double +.Fn tan "double x" +.Sh DESCRIPTION +The +.Fn tan +function computes 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 +function returns 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 sin 3 , +.Xr sinh 3 , +.Xr tanh 3 , +.Xr math 3 , +.Sh STANDARDS +The +.Fn tan +function conforms to +.St -ansiC . diff --git a/usr/src/lib/libm/common_source/tanh.3 b/usr/src/lib/libm/common_source/tanh.3 new file mode 100644 index 0000000000..139b747554 --- /dev/null +++ b/usr/src/lib/libm/common_source/tanh.3 @@ -0,0 +1,70 @@ +.\" 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. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. 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. +.\" +.\" @(#)tanh.3 5.1 (Berkeley) 5/2/91 +.\" +.Dd May 2, 1991 +.Dt TANH 3 +.Os +.Sh NAME +.Nm tanh +.Nd hyperbolic tangent function +.Sh SYNOPSIS +.Fd #include +.Ft double +.Fn tanh "double x" +.Sh DESCRIPTION +The +.Fn tanh +function computes the hyperbolic tangent of +.Fa x . +For a discussion of error due to roundoff, see +.Xr math 3 . +.Sh RETURN VALUES +The +.Fn tanh +function returns 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 sin 3 , +.Xr sinh 3 , +.Xr tan 3 , +.Xr math 3 , +.Sh STANDARDS +The +.Fn tanh +function conforms to +.St -ansiC . -- 2.20.1