diff --git a/lib/msun/i387/s_ceil.S b/lib/msun/i387/s_ceil.S index 7e099b04f136..71019ec6090f 100644 --- a/lib/msun/i387/s_ceil.S +++ b/lib/msun/i387/s_ceil.S @@ -1,60 +1,60 @@ /* * Copyright (c) 1993,94 Winning Strategies, Inc. * 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 Winning Strategies, Inc. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include __FBSDID("$FreeBSD$") ENTRY(ceil) pushl %ebp movl %esp,%ebp subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ movw -4(%ebp),%dx orw $0x0800,%dx /* round towards +oo */ andw $0xfbff,%dx movw %dx,-8(%ebp) - fldcw -8(%ebp) /* load modfied control word */ + fldcw -8(%ebp) /* load modified control word */ fldl 8(%ebp); /* round */ frndint fldcw -4(%ebp) /* restore original control word */ leave ret END(ceil) .section .note.GNU-stack,"",%progbits diff --git a/lib/msun/i387/s_ceilf.S b/lib/msun/i387/s_ceilf.S index e9009c33e736..44480dededac 100644 --- a/lib/msun/i387/s_ceilf.S +++ b/lib/msun/i387/s_ceilf.S @@ -1,32 +1,32 @@ /* * Written by J.T. Conklin . * Public domain. */ #include __FBSDID("$FreeBSD$"); /* RCSID("$NetBSD: s_ceilf.S,v 1.3 1995/05/08 23:52:44 jtc Exp $") */ ENTRY(ceilf) pushl %ebp movl %esp,%ebp subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ movw -4(%ebp),%dx orw $0x0800,%dx /* round towards +oo */ andw $0xfbff,%dx movw %dx,-8(%ebp) - fldcw -8(%ebp) /* load modfied control word */ + fldcw -8(%ebp) /* load modified control word */ flds 8(%ebp); /* round */ frndint fldcw -4(%ebp) /* restore original control word */ leave ret END(ceilf) .section .note.GNU-stack,"",%progbits diff --git a/lib/msun/i387/s_ceill.S b/lib/msun/i387/s_ceill.S index 184ef1812db4..8ed48aa1e603 100644 --- a/lib/msun/i387/s_ceill.S +++ b/lib/msun/i387/s_ceill.S @@ -1,30 +1,30 @@ /* * Based on code written by J.T. Conklin . * Public domain. */ #include __FBSDID("$FreeBSD$") ENTRY(ceill) pushl %ebp movl %esp,%ebp subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ movw -4(%ebp),%dx orw $0x0800,%dx /* round towards +oo */ andw $0xfbff,%dx movw %dx,-8(%ebp) - fldcw -8(%ebp) /* load modfied control word */ + fldcw -8(%ebp) /* load modified control word */ fldt 8(%ebp) /* round */ frndint fldcw -4(%ebp) /* restore original control word */ leave ret END(ceill) .section .note.GNU-stack,"",%progbits diff --git a/lib/msun/i387/s_floor.S b/lib/msun/i387/s_floor.S index a06c66e4f206..f9d1ab976897 100644 --- a/lib/msun/i387/s_floor.S +++ b/lib/msun/i387/s_floor.S @@ -1,60 +1,60 @@ /* * Copyright (c) 1993,94 Winning Strategies, Inc. * 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 Winning Strategies, Inc. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * 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. */ /* * Written by: * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. */ #include __FBSDID("$FreeBSD$") ENTRY(floor) pushl %ebp movl %esp,%ebp subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ movw -4(%ebp),%dx orw $0x0400,%dx /* round towards -oo */ andw $0xf7ff,%dx movw %dx,-8(%ebp) - fldcw -8(%ebp) /* load modfied control word */ + fldcw -8(%ebp) /* load modified control word */ fldl 8(%ebp); /* round */ frndint fldcw -4(%ebp) /* restore original control word */ leave ret END(floor) .section .note.GNU-stack,"",%progbits diff --git a/lib/msun/i387/s_floorf.S b/lib/msun/i387/s_floorf.S index e758d0576fa4..ecd9307f7b3d 100644 --- a/lib/msun/i387/s_floorf.S +++ b/lib/msun/i387/s_floorf.S @@ -1,32 +1,32 @@ /* * Written by J.T. Conklin . * Public domain. */ #include __FBSDID("$FreeBSD$"); /* RCSID("$NetBSD: s_floorf.S,v 1.3 1995/05/09 00:04:32 jtc Exp $") */ ENTRY(floorf) pushl %ebp movl %esp,%ebp subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ movw -4(%ebp),%dx orw $0x0400,%dx /* round towards -oo */ andw $0xf7ff,%dx movw %dx,-8(%ebp) - fldcw -8(%ebp) /* load modfied control word */ + fldcw -8(%ebp) /* load modified control word */ flds 8(%ebp); /* round */ frndint fldcw -4(%ebp) /* restore original control word */ leave ret END(floorf) .section .note.GNU-stack,"",%progbits diff --git a/lib/msun/i387/s_floorl.S b/lib/msun/i387/s_floorl.S index cbb05f0fc5ea..ae9e91baf216 100644 --- a/lib/msun/i387/s_floorl.S +++ b/lib/msun/i387/s_floorl.S @@ -1,30 +1,30 @@ /* * Based on code written by J.T. Conklin . * Public domain. */ #include __FBSDID("$FreeBSD$") ENTRY(floorl) pushl %ebp movl %esp,%ebp subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ movw -4(%ebp),%dx orw $0x0400,%dx /* round towards -oo */ andw $0xf7ff,%dx movw %dx,-8(%ebp) - fldcw -8(%ebp) /* load modfied control word */ + fldcw -8(%ebp) /* load modified control word */ fldt 8(%ebp) /* round */ frndint fldcw -4(%ebp) /* restore original control word */ leave ret END(floorl) .section .note.GNU-stack,"",%progbits diff --git a/lib/msun/i387/s_trunc.S b/lib/msun/i387/s_trunc.S index 0a9ad41a705c..61bbc537556a 100644 --- a/lib/msun/i387/s_trunc.S +++ b/lib/msun/i387/s_trunc.S @@ -1,29 +1,29 @@ /* * Based on code written by J.T. Conklin . * Public domain. */ #include __FBSDID("$FreeBSD$") ENTRY(trunc) pushl %ebp movl %esp,%ebp subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ movw -4(%ebp),%dx orw $0x0c00,%dx /* round towards -oo */ movw %dx,-8(%ebp) - fldcw -8(%ebp) /* load modfied control word */ + fldcw -8(%ebp) /* load modified control word */ fldl 8(%ebp) /* round */ frndint fldcw -4(%ebp) /* restore original control word */ leave ret END(trunc) .section .note.GNU-stack,"",%progbits diff --git a/lib/msun/i387/s_truncf.S b/lib/msun/i387/s_truncf.S index 0583dc8fd680..4c6c3f1f2cab 100644 --- a/lib/msun/i387/s_truncf.S +++ b/lib/msun/i387/s_truncf.S @@ -1,29 +1,29 @@ /* * Based on code written by J.T. Conklin . * Public domain. */ #include __FBSDID("$FreeBSD$") ENTRY(truncf) pushl %ebp movl %esp,%ebp subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ movw -4(%ebp),%dx orw $0x0c00,%dx /* round towards -oo */ movw %dx,-8(%ebp) - fldcw -8(%ebp) /* load modfied control word */ + fldcw -8(%ebp) /* load modified control word */ flds 8(%ebp) /* round */ frndint fldcw -4(%ebp) /* restore original control word */ leave ret END(truncf) .section .note.GNU-stack,"",%progbits diff --git a/lib/msun/i387/s_truncl.S b/lib/msun/i387/s_truncl.S index c3815ad61a68..a52471966b90 100644 --- a/lib/msun/i387/s_truncl.S +++ b/lib/msun/i387/s_truncl.S @@ -1,29 +1,29 @@ /* * Based on code written by J.T. Conklin . * Public domain. */ #include __FBSDID("$FreeBSD$") ENTRY(truncl) pushl %ebp movl %esp,%ebp subl $8,%esp fstcw -4(%ebp) /* store fpu control word */ movw -4(%ebp),%dx orw $0x0c00,%dx /* round towards -oo */ movw %dx,-8(%ebp) - fldcw -8(%ebp) /* load modfied control word */ + fldcw -8(%ebp) /* load modified control word */ fldt 8(%ebp) /* round */ frndint fldcw -4(%ebp) /* restore original control word */ leave ret END(truncl) .section .note.GNU-stack,"",%progbits diff --git a/lib/msun/man/clog.3 b/lib/msun/man/clog.3 index 753ce4369993..d971a5c901a3 100644 --- a/lib/msun/man/clog.3 +++ b/lib/msun/man/clog.3 @@ -1,101 +1,101 @@ .\" Copyright (c) 2017 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 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. .\" .\" $FreeBSD$ .\" .Dd June 6, 2018 .Dt CLOG 3 .Os .Sh NAME .Nm clog , -.Nm clogf , +.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/cospi.3 b/lib/msun/man/cospi.3 index b76e1858ed33..4349756b610c 100644 --- a/lib/msun/man/cospi.3 +++ b/lib/msun/man/cospi.3 @@ -1,111 +1,111 @@ .\" Copyright (c) 2017 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. .\" .\" $FreeBSD$ .\" .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 +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 .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 , +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/sinpi.3 b/lib/msun/man/sinpi.3 index 4ae162bd1c74..909c6f341998 100644 --- a/lib/msun/man/sinpi.3 +++ b/lib/msun/man/sinpi.3 @@ -1,102 +1,102 @@ .\" Copyright (c) 2017 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. .\" .\" $FreeBSD$ .\" .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 +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 .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 , +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/tanpi.3 b/lib/msun/man/tanpi.3 index 9cbbf4efaf23..41fd0cbd81d4 100644 --- a/lib/msun/man/tanpi.3 +++ b/lib/msun/man/tanpi.3 @@ -1,106 +1,106 @@ .\" Copyright (c) 2017 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. .\" .\" $FreeBSD$ .\" .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" +.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 +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 .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 , +.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 , +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/src/e_lgamma_r.c b/lib/msun/src/e_lgamma_r.c index be70767ec5c0..48da493fe1d2 100644 --- a/lib/msun/src/e_lgamma_r.c +++ b/lib/msun/src/e_lgamma_r.c @@ -1,303 +1,303 @@ /* @(#)e_lgamma_r.c 1.3 95/01/18 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #include __FBSDID("$FreeBSD$"); /* __ieee754_lgamma_r(x, signgamp) * Reentrant version of the logarithm of the Gamma function * with user provide pointer for the sign of Gamma(x). * * Method: * 1. Argument Reduction for 0 < x <= 8 * Since gamma(1+s)=s*gamma(s), for x in [0,8], we may * reduce x to a number in [1.5,2.5] by * lgamma(1+s) = log(s) + lgamma(s) * for example, * lgamma(7.3) = log(6.3) + lgamma(6.3) * = log(6.3*5.3) + lgamma(5.3) * = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3) * 2. Polynomial approximation of lgamma around its - * minimun ymin=1.461632144968362245 to maintain monotonicity. + * minimum ymin=1.461632144968362245 to maintain monotonicity. * On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use * Let z = x-ymin; * lgamma(x) = -1.214862905358496078218 + z^2*poly(z) * where * poly(z) is a 14 degree polynomial. * 2. Rational approximation in the primary interval [2,3] * We use the following approximation: * s = x-2.0; * lgamma(x) = 0.5*s + s*P(s)/Q(s) * with accuracy * |P/Q - (lgamma(x)-0.5s)| < 2**-61.71 * Our algorithms are based on the following observation * * zeta(2)-1 2 zeta(3)-1 3 * lgamma(2+s) = s*(1-Euler) + --------- * s - --------- * s + ... * 2 3 * * where Euler = 0.5771... is the Euler constant, which is very * close to 0.5. * * 3. For x>=8, we have * lgamma(x)~(x-0.5)log(x)-x+0.5*log(2pi)+1/(12x)-1/(360x**3)+.... * (better formula: * lgamma(x)~(x-0.5)*(log(x)-1)-.5*(log(2pi)-1) + ...) * Let z = 1/x, then we approximation * f(z) = lgamma(x) - (x-0.5)(log(x)-1) * by * 3 5 11 * w = w0 + w1*z + w2*z + w3*z + ... + w6*z * where * |w - f(z)| < 2**-58.74 * * 4. For negative x, since (G is gamma function) * -x*G(-x)*G(x) = pi/sin(pi*x), * we have * G(x) = pi/(sin(pi*x)*(-x)*G(-x)) * since G(-x) is positive, sign(G(x)) = sign(sin(pi*x)) for x<0 * Hence, for x<0, signgam = sign(sin(pi*x)) and * lgamma(x) = log(|Gamma(x)|) * = log(pi/(|x*sin(pi*x)|)) - lgamma(-x); * Note: one should avoid compute pi*(-x) directly in the * computation of sin(pi*(-x)). * * 5. Special Cases * lgamma(2+s) ~ s*(1-Euler) for tiny s * lgamma(1) = lgamma(2) = 0 * lgamma(x) ~ -log(|x|) for tiny x * lgamma(0) = lgamma(neg.integer) = inf and raise divide-by-zero * lgamma(inf) = inf * lgamma(-inf) = inf (bug for bug compatible with C99!?) */ #include #include "math.h" #include "math_private.h" static const volatile double vzero = 0; static const double zero= 0.00000000000000000000e+00, half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ a0 = 7.72156649015328655494e-02, /* 0x3FB3C467, 0xE37DB0C8 */ a1 = 3.22467033424113591611e-01, /* 0x3FD4A34C, 0xC4A60FAD */ a2 = 6.73523010531292681824e-02, /* 0x3FB13E00, 0x1A5562A7 */ a3 = 2.05808084325167332806e-02, /* 0x3F951322, 0xAC92547B */ a4 = 7.38555086081402883957e-03, /* 0x3F7E404F, 0xB68FEFE8 */ a5 = 2.89051383673415629091e-03, /* 0x3F67ADD8, 0xCCB7926B */ a6 = 1.19270763183362067845e-03, /* 0x3F538A94, 0x116F3F5D */ a7 = 5.10069792153511336608e-04, /* 0x3F40B6C6, 0x89B99C00 */ a8 = 2.20862790713908385557e-04, /* 0x3F2CF2EC, 0xED10E54D */ a9 = 1.08011567247583939954e-04, /* 0x3F1C5088, 0x987DFB07 */ a10 = 2.52144565451257326939e-05, /* 0x3EFA7074, 0x428CFA52 */ a11 = 4.48640949618915160150e-05, /* 0x3F07858E, 0x90A45837 */ tc = 1.46163214496836224576e+00, /* 0x3FF762D8, 0x6356BE3F */ tf = -1.21486290535849611461e-01, /* 0xBFBF19B9, 0xBCC38A42 */ /* tt = -(tail of tf) */ tt = -3.63867699703950536541e-18, /* 0xBC50C7CA, 0xA48A971F */ t0 = 4.83836122723810047042e-01, /* 0x3FDEF72B, 0xC8EE38A2 */ t1 = -1.47587722994593911752e-01, /* 0xBFC2E427, 0x8DC6C509 */ t2 = 6.46249402391333854778e-02, /* 0x3FB08B42, 0x94D5419B */ t3 = -3.27885410759859649565e-02, /* 0xBFA0C9A8, 0xDF35B713 */ t4 = 1.79706750811820387126e-02, /* 0x3F9266E7, 0x970AF9EC */ t5 = -1.03142241298341437450e-02, /* 0xBF851F9F, 0xBA91EC6A */ t6 = 6.10053870246291332635e-03, /* 0x3F78FCE0, 0xE370E344 */ t7 = -3.68452016781138256760e-03, /* 0xBF6E2EFF, 0xB3E914D7 */ t8 = 2.25964780900612472250e-03, /* 0x3F6282D3, 0x2E15C915 */ t9 = -1.40346469989232843813e-03, /* 0xBF56FE8E, 0xBF2D1AF1 */ t10 = 8.81081882437654011382e-04, /* 0x3F4CDF0C, 0xEF61A8E9 */ t11 = -5.38595305356740546715e-04, /* 0xBF41A610, 0x9C73E0EC */ t12 = 3.15632070903625950361e-04, /* 0x3F34AF6D, 0x6C0EBBF7 */ t13 = -3.12754168375120860518e-04, /* 0xBF347F24, 0xECC38C38 */ t14 = 3.35529192635519073543e-04, /* 0x3F35FD3E, 0xE8C2D3F4 */ u0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */ u1 = 6.32827064025093366517e-01, /* 0x3FE4401E, 0x8B005DFF */ u2 = 1.45492250137234768737e+00, /* 0x3FF7475C, 0xD119BD6F */ u3 = 9.77717527963372745603e-01, /* 0x3FEF4976, 0x44EA8450 */ u4 = 2.28963728064692451092e-01, /* 0x3FCD4EAE, 0xF6010924 */ u5 = 1.33810918536787660377e-02, /* 0x3F8B678B, 0xBF2BAB09 */ v1 = 2.45597793713041134822e+00, /* 0x4003A5D7, 0xC2BD619C */ v2 = 2.12848976379893395361e+00, /* 0x40010725, 0xA42B18F5 */ v3 = 7.69285150456672783825e-01, /* 0x3FE89DFB, 0xE45050AF */ v4 = 1.04222645593369134254e-01, /* 0x3FBAAE55, 0xD6537C88 */ v5 = 3.21709242282423911810e-03, /* 0x3F6A5ABB, 0x57D0CF61 */ s0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */ s1 = 2.14982415960608852501e-01, /* 0x3FCB848B, 0x36E20878 */ s2 = 3.25778796408930981787e-01, /* 0x3FD4D98F, 0x4F139F59 */ s3 = 1.46350472652464452805e-01, /* 0x3FC2BB9C, 0xBEE5F2F7 */ s4 = 2.66422703033638609560e-02, /* 0x3F9B481C, 0x7E939961 */ s5 = 1.84028451407337715652e-03, /* 0x3F5E26B6, 0x7368F239 */ s6 = 3.19475326584100867617e-05, /* 0x3F00BFEC, 0xDD17E945 */ r1 = 1.39200533467621045958e+00, /* 0x3FF645A7, 0x62C4AB74 */ r2 = 7.21935547567138069525e-01, /* 0x3FE71A18, 0x93D3DCDC */ r3 = 1.71933865632803078993e-01, /* 0x3FC601ED, 0xCCFBDF27 */ r4 = 1.86459191715652901344e-02, /* 0x3F9317EA, 0x742ED475 */ r5 = 7.77942496381893596434e-04, /* 0x3F497DDA, 0xCA41A95B */ r6 = 7.32668430744625636189e-06, /* 0x3EDEBAF7, 0xA5B38140 */ w0 = 4.18938533204672725052e-01, /* 0x3FDACFE3, 0x90C97D69 */ w1 = 8.33333333333329678849e-02, /* 0x3FB55555, 0x5555553B */ w2 = -2.77777777728775536470e-03, /* 0xBF66C16C, 0x16B02E5C */ w3 = 7.93650558643019558500e-04, /* 0x3F4A019F, 0x98CF38B6 */ w4 = -5.95187557450339963135e-04, /* 0xBF4380CB, 0x8C0FE741 */ w5 = 8.36339918996282139126e-04, /* 0x3F4B67BA, 0x4CDAD5D1 */ w6 = -1.63092934096575273989e-03; /* 0xBF5AB89D, 0x0B9E43E4 */ /* * Compute sin(pi*x) without actually doing the pi*x multiplication. * sin_pi(x) is only called for x < 0 and |x| < 2**(p-1) where p is * the precision of x. */ static double sin_pi(double x) { volatile double vz; double y,z; int n; y = -x; vz = y+0x1p52; /* depend on 0 <= y < 0x1p52 */ z = vz-0x1p52; /* rint(y) for the above range */ if (z == y) return zero; vz = y+0x1p50; GET_LOW_WORD(n,vz); /* bits for rounded y (units 0.25) */ z = vz-0x1p50; /* y rounded to a multiple of 0.25 */ if (z > y) { z -= 0.25; /* adjust to round down */ n--; } n &= 7; /* octant of y mod 2 */ y = y - z + n * 0.25; /* y mod 2 */ switch (n) { case 0: y = __kernel_sin(pi*y,zero,0); break; case 1: case 2: y = __kernel_cos(pi*(0.5-y),zero); break; case 3: case 4: y = __kernel_sin(pi*(one-y),zero,0); break; case 5: case 6: y = -__kernel_cos(pi*(y-1.5),zero); break; default: y = __kernel_sin(pi*(y-2.0),zero,0); break; } return -y; } double __ieee754_lgamma_r(double x, int *signgamp) { double nadj,p,p1,p2,p3,q,r,t,w,y,z; int32_t hx; int i,ix,lx; EXTRACT_WORDS(hx,lx,x); /* purge +-Inf and NaNs */ *signgamp = 1; ix = hx&0x7fffffff; if(ix>=0x7ff00000) return x*x; /* purge +-0 and tiny arguments */ *signgamp = 1-2*((uint32_t)hx>>31); if(ix<0x3c700000) { /* |x|<2**-56, return -log(|x|) */ if((ix|lx)==0) return one/vzero; return -__ieee754_log(fabs(x)); } /* purge negative integers and start evaluation for other x < 0 */ if(hx<0) { *signgamp = 1; if(ix>=0x43300000) /* |x|>=2**52, must be -integer */ return one/vzero; t = sin_pi(x); if(t==zero) return one/vzero; /* -integer */ nadj = __ieee754_log(pi/fabs(t*x)); if(t=0x3FE76944) {y = one-x; i= 0;} else if(ix>=0x3FCDA661) {y= x-(tc-one); i=1;} else {y = x; i=2;} } else { r = zero; if(ix>=0x3FFBB4C3) {y=2.0-x;i=0;} /* [1.7316,2] */ else if(ix>=0x3FF3B4C4) {y=x-tc;i=1;} /* [1.23,1.73] */ else {y=x-one;i=2;} } switch(i) { case 0: z = y*y; p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10)))); p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11))))); p = y*p1+p2; r += p-y/2; break; case 1: z = y*y; w = z*y; p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */ p2 = t1+w*(t4+w*(t7+w*(t10+w*t13))); p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); p = z*p1-(tt-w*(p2+y*p3)); r += tf + p; break; case 2: p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); r += p1/p2-y/2; } } /* x < 8.0 */ else if(ix<0x40200000) { i = x; y = x-i; p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6)))))); q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6))))); r = y/2+p/q; z = one; /* lgamma(1+s) = log(s) + lgamma(s) */ switch(i) { case 7: z *= (y+6); /* FALLTHRU */ case 6: z *= (y+5); /* FALLTHRU */ case 5: z *= (y+4); /* FALLTHRU */ case 4: z *= (y+3); /* FALLTHRU */ case 3: z *= (y+2); /* FALLTHRU */ r += __ieee754_log(z); break; } /* 8.0 <= x < 2**56 */ } else if (ix < 0x43700000) { t = __ieee754_log(x); z = one/x; y = z*z; w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); r = (x-half)*(t-one)+w; } else /* 2**56 <= x <= inf */ r = x*(__ieee754_log(x)-one); if(hx<0) r = nadj - r; return r; } #if (LDBL_MANT_DIG == 53) __weak_reference(lgamma_r, lgammal_r); #endif