From 8cecb502baf1c800a7b4984d0df70ca1b755b1e3 Mon Sep 17 00:00:00 2001 From: John Marino Date: Wed, 21 Dec 2011 23:34:17 +0100 Subject: [PATCH] libm: Man page updates These are the man page updates required as a consequence of adding FreeBSD functions to libm. --- lib/libm/complex/Makefile.inc | 10 +- lib/libm/complex/cabs.3 | 53 -------- lib/libm/complex/carg.3 | 4 +- lib/libm/complex/csqrt.3 | 4 +- lib/libm/man/Makefile.inc | 55 +++++--- lib/libm/man/acos.3 | 54 ++++---- lib/libm/man/acosh.3 | 35 +++-- lib/libm/man/asin.3 | 56 ++++---- lib/libm/man/asinh.3 | 20 ++- lib/libm/man/atan.3 | 39 +++--- lib/libm/man/atan2.3 | 62 ++++----- lib/libm/man/atanh.3 | 38 +++--- lib/libm/man/ceil.3 | 46 ++++--- lib/libm/man/copysign.3 | 101 +++++++------- lib/libm/man/cos.3 | 31 +++-- lib/libm/man/cosh.3 | 17 +-- lib/libm/man/erf.3 | 19 ++- lib/libm/man/exp.3 | 134 ++++++++++++------ lib/libm/man/fabs.3 | 32 +++-- lib/libm/man/fdim.3 | 4 +- lib/libm/man/floor.3 | 31 +++-- lib/libm/man/fma.3 | 108 +++++++++++++++ lib/libm/man/fmod.3 | 47 ++++--- lib/libm/man/frexp.3 | 4 +- lib/libm/man/hypot.3 | 72 +++++----- lib/libm/man/ilogb.3 | 163 +++++++++++----------- lib/libm/man/j0.3 | 73 ++++++---- lib/libm/man/lgamma.3 | 135 ++++++++++++++----- lib/libm/man/log.3 | 170 ++++++++--------------- lib/libm/man/{trunc.3 => lrint.3} | 103 ++++++++------ lib/libm/man/{trunc.3 => lround.3} | 107 ++++++++++----- lib/libm/man/math.3 | 4 +- lib/libm/man/nextafter.3 | 146 ++++++++------------ lib/libm/man/pow.3 | 80 ----------- lib/libm/man/remainder.3 | 210 +++++++++++++++-------------- lib/libm/man/rint.3 | 44 ++++-- lib/libm/man/round.3 | 28 ++-- lib/libm/man/scalbn.3 | 138 +++++++++---------- lib/libm/man/sin.3 | 34 +++-- lib/libm/man/sinh.3 | 13 +- lib/libm/man/sqrt.3 | 85 ++++++++---- lib/libm/man/tan.3 | 31 +++-- lib/libm/man/tanh.3 | 46 ++----- lib/libm/man/trunc.3 | 43 +++--- 44 files changed, 1478 insertions(+), 1251 deletions(-) delete mode 100644 lib/libm/complex/cabs.3 create mode 100644 lib/libm/man/fma.3 copy lib/libm/man/{trunc.3 => lrint.3} (54%) copy lib/libm/man/{trunc.3 => lround.3} (53%) delete mode 100644 lib/libm/man/pow.3 diff --git a/lib/libm/complex/Makefile.inc b/lib/libm/complex/Makefile.inc index 6027cdb047..34d6133165 100644 --- a/lib/libm/complex/Makefile.inc +++ b/lib/libm/complex/Makefile.inc @@ -26,15 +26,17 @@ SRCS+= casinh.c casinhf.c SRCS+= cacosh.c cacoshf.c SRCS+= catanh.c catanhf.c -MAN+= cabs.3 cacos.3 cacosh.3 carg.3 casin.3 casinh.3 catan.3 catanh.3 +MAN+= cacos.3 cacosh.3 carg.3 casin.3 casinh.3 catan.3 catanh.3 MAN+= ccos.3 ccosh.3 cexp.3 cimag.3 clog.3 conj.3 cpow.3 cproj.3 creal.3 MAN+= csin.3 csinh.3 csqrt.3 ctan.3 ctanh.3 -MLINKS+= cabs.3 cabsf.3 cacos.3 cacosf.3 cacosh.3 cacoshf.3 -MLINKS+= carg.3 cargf.3 casin.3 casinf.3 casinh.3 casinhf.3 +MLINKS+= cacos.3 cacosf.3 cacosh.3 cacoshf.3 +MLINKS+= carg.3 cargf.3 carg.3 cargl.3 +MLINKS+= casin.3 casinf.3 casinh.3 casinhf.3 MLINKS+= catan.3 catanf.3 catanh.3 catanhf.3 ccos.3 ccosf.3 MLINKS+= ccosh.3 ccoshf.3 cexp.3 cexpf.3 cimag.3 cimagf.3 cimag.3 cimagl.3 MLINKS+= clog.3 clogf.3 conj.3 conjf.3 conj.3 conjl.3 cpow.3 cpowf.3 MLINKS+= cproj.3 cprojf.3 cproj.3 cprojl.3 MLINKS+= creal.3 crealf.3 creal.3 creall.3 csin.3 csinf.3 csinh.3 csinhf.3 -MLINKS+= csqrt.3 csqrtf.3 ctan.3 ctanf.3 ctanh.3 ctanhf.3 +MLINKS+= csqrt.3 csqrtf.3 csqrt.3 csqrtl.3 +MLINKS+= ctan.3 ctanf.3 ctanh.3 ctanhf.3 diff --git a/lib/libm/complex/cabs.3 b/lib/libm/complex/cabs.3 deleted file mode 100644 index 9ee409093e..0000000000 --- a/lib/libm/complex/cabs.3 +++ /dev/null @@ -1,53 +0,0 @@ -.\" $NetBSD: cabs.3,v 1.1 2008/02/20 09:55:38 drochner Exp $ -.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved -.TH "CABS" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual" -.\" cabs -.SH NAME -cabs, cabsf \- return a complex absolute value -.SH SYNOPSIS -.LP -\fB#include -.br -.sp -double cabs(double complex\fP \fIz\fP\fB); -.br -float cabsf(float complex\fP \fIz\fP\fB); -.br -\fP -.SH DESCRIPTION -.LP -These functions compute the complex absolute value (also called -norm, modulus, or magnitude) of \fIz\fP. -.SH RETURN VALUE -.LP -These functions return the complex absolute value. -.SH ERRORS -.LP -No errors are defined. -.LP -\fIThe following sections are informative.\fP -.SH EXAMPLES -.LP -None. -.SH APPLICATION USAGE -.LP -None. -.SH RATIONALE -.LP -None. -.SH FUTURE DIRECTIONS -.LP -None. -.SH SEE ALSO -.LP -The Base Definitions volume of IEEE\ Std\ 1003.1-2001, \fI\fP -.SH COPYRIGHT -Portions of this text are reprinted and reproduced in electronic form -from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology --- Portable Operating System Interface (POSIX), The Open Group Base -Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of -Electrical and Electronics Engineers, Inc and The Open Group. In the -event of any discrepancy between this version and the original IEEE and -The Open Group Standard, the original IEEE and The Open Group Standard -is the referee document. The original Standard can be obtained online at -http://www.opengroup.org/unix/online.html . diff --git a/lib/libm/complex/carg.3 b/lib/libm/complex/carg.3 index f60bbb1d15..4e3516f59f 100644 --- a/lib/libm/complex/carg.3 +++ b/lib/libm/complex/carg.3 @@ -3,7 +3,7 @@ .TH "CARG" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual" .\" carg .SH NAME -carg, cargf \- complex argument functions +carg, cargf, cargl \- complex argument functions .SH SYNOPSIS .LP \fB#include @@ -13,6 +13,8 @@ double carg(double complex\fP \fIz\fP\fB); .br float cargf(float complex\fP \fIz\fP\fB); .br +long double cargl(long double complex\fP \fIz\fP\fB); +.br \fP .SH DESCRIPTION .LP diff --git a/lib/libm/complex/csqrt.3 b/lib/libm/complex/csqrt.3 index 132daf9997..5eb62d9334 100644 --- a/lib/libm/complex/csqrt.3 +++ b/lib/libm/complex/csqrt.3 @@ -3,7 +3,7 @@ .TH "CSQRT" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual" .\" csqrt .SH NAME -csqrt, csqrtf \- complex square root functions +csqrt, csqrtf, csqrtl \- complex square root functions .SH SYNOPSIS .LP \fB#include @@ -13,6 +13,8 @@ double complex csqrt(double complex\fP \fIz\fP\fB); .br float complex csqrtf(float complex\fP \fIz\fP\fB); .br +long double complex csqrtl(long double complex\fP \fIz\fP\fB); +.br \fP .SH DESCRIPTION .LP diff --git a/lib/libm/man/Makefile.inc b/lib/libm/man/Makefile.inc index 7edd236e71..94f0bc507c 100644 --- a/lib/libm/man/Makefile.inc +++ b/lib/libm/man/Makefile.inc @@ -5,23 +5,25 @@ MAN+= acos.3 acosh.3 asin.3 asinh.3 atan.3 atan2.3 atanh.3 ceil.3 \ fegetenv.3 fegetround.3 fenv.3 floor.3 fmax.3 fmod.3 hypot.3 \ ieee_test.3 j0.3 lgamma.3 math.3 rint.3 round.3 sin.3 \ sinh.3 sqrt.3 tan.3 tanh.3 trunc.3 -MAN+= copysign.3 frexp.3 ilogb.3 log.3 scalbn.3 pow.3 nextafter.3 remainder.3 \ +MAN+= copysign.3 frexp.3 ilogb.3 log.3 scalbn.3 nextafter.3 remainder.3 \ finite.3 +MAN+= fma.3 lrint.3 lround.3 -MLINKS+=acos.3 acosf.3 +MLINKS+=acos.3 acosf.3 acos.3 acosl.3 MLINKS+=acosh.3 acoshf.3 -MLINKS+=asin.3 asinf.3 +MLINKS+=asin.3 asinf.3 asin.3 asinl.3 MLINKS+=asinh.3 asinhf.3 -MLINKS+=atan.3 atanf.3 -MLINKS+=atan2.3 atan2f.3 +MLINKS+=atan.3 atanf.3 atan.3 atanl.3 +MLINKS+=atan2.3 atan2f.3 atan2.3 atan2l.3 MLINKS+=atanh.3 atanhf.3 -MLINKS+=ceil.3 ceilf.3 -MLINKS+=cos.3 cosf.3 +MLINKS+=ceil.3 ceilf.3 ceil.3 ceill.3 +MLINKS+=cos.3 cosf.3 cos.3 cosl.3 MLINKS+=cosh.3 coshf.3 MLINKS+=erf.3 erff.3 erf.3 erfc.3 erf.3 erfcf.3 MLINKS+=log.3 logf.3 log.3 log10.3 log.3 log10f.3 log.3 log1p.3 log.3 log1pf.3 \ - log.3 log2.3 log.3 log2f.3 -MLINKS+=exp.3 expf.3 exp.3 exp2.3 exp.3 exp2f.3 exp.3 expm1.3 exp.3 expm1f.3 + log.3 log2.3 log.3 log2f.3 log.3 logl.3 +MLINKS+=exp.3 expf.3 exp.3 exp2.3 exp.3 exp2f.3 exp.3 expm1.3 exp.3 expmlf.3 +MLINKS+=exp.3 powf.3 exp.3 pow.3 exp.3 exp2l.3 MLINKS+=fabs.3 fabsf.3 fabs.3 fabsl.3 MLINKS+=fdim.3 fdimf.3 fdim.3 fdiml.3 @@ -30,11 +32,12 @@ MLINKS+=feclearexcept.3 fegetexceptflag.3 feclearexcept.3 feraiseexcept.3 \ MLINKS+=feenableexcept.3 fedisableexcept.3 feenableexcept.3 fegetexcept.3 MLINKS+=fegetenv.3 feholdexcept.3 fegetenv.3 fesetenv.3 fegetenv.3 feupdateenv.3 MLINKS+=fegetround.3 fesetround.3 -MLINKS+=floor.3 floorf.3 +MLINKS+=floor.3 floorf.3 floor.3 floorl.3 MLINKS+=fmax.3 fmaxf.3 fmax.3 fmaxl.3 \ fmax.3 fmin.3 fmax.3 fminf.3 fmax.3 fminl.3 -MLINKS+=fmod.3 fmodf.3 -MLINKS+=hypot.3 hypotf.3 hypot.3 cabs.3 hypot.3 cabsf.3 +MLINKS+=fmod.3 fmodf.3 fmod.3 fmodl.3 +MLINKS+=hypot.3 hypotf.3 hypot.3 hypotl.3 +MLINKS+=hypot.3 cabs.3 hypot.3 cabsf.3 hypot.3 cabsl.3 MLINKS+=ieee_test.3 logb.3 ieee_test.3 logbf.3 ieee_test.3 scalb.3 \ ieee_test.3 scalbf.3 ieee_test.3 significand.3 \ ieee_test.3 significandf.3 @@ -42,20 +45,32 @@ MLINKS+=j0.3 j0f.3 j0.3 j1.3 j0.3 j1f.3 j0.3 jn.3 j0.3 jnf.3 j0.3 y0.3 \ j0.3 y0f.3 j0.3 y1.3 j0.3 y1f.3 j0.3 yn.3 j0.3 ynf.3 MLINKS+=lgamma.3 lgammaf.3 lgamma.3 lgamma_r.3 lgamma.3 lgammaf_r.3 \ lgamma.3 gamma.3 lgamma.3 gammaf.3 lgamma.3 gamma_r.3 \ - lgamma.3 gammaf_r.3 -MLINKS+=rint.3 nearbyint.3 rint.3 nearbyintf.3 rint.3 rintf.3 -MLINKS+=round.3 roundf.3 -MLINKS+=sin.3 sinf.3 + lgamma.3 gammaf_r.3 lgamma.3 tgamma.3 lgamma.3 tgammaf.3 +MLINKS+=rint.3 nearbyint.3 rint.3 nearbyintf.3 rint.3 nearbyintl.3 +MLINKS+=rint.3 rintf.3 rint.3 rintl.3 +MLINKS+=round.3 roundf.3 round.3 roundl.3 +MLINKS+=sin.3 sinf.3 sin.3 sinl.3 MLINKS+=sinh.3 sinhf.3 -MLINKS+=sqrt.3 cbrt.3 sqrt.3 cbrtf.3 sqrt.3 sqrtf.3 -MLINKS+=tan.3 tanf.3 +MLINKS+=sqrt.3 cbrtf.3 sqrt.3 cbrtl.3 sqrt.3 cbrt.3 +MLINKS+=sqrt.3 sqrtf.3 sqrt.3 sqrtl.3 +MLINKS+=tan.3 tanf.3 tan.3 tanl.3 MLINKS+=tanh.3 tanhf.3 MLINKS+=trunc.3 truncf.3 MLINKS+=copysign.3 copysignf.3 copysign.3 copysignl.3 MLINKS+=scalbn.3 scalbnf.3 scalbn.3 scalbnl.3 +MLINKS+=scalbn.3 scalbln.3 scalbn.3 scalblnf.3 scalbn.3 scalblnl.3 +MLINKS+=scalbn.3 ldexp.3 scalbn.3 ldexpf.3 scalbn.3 ldexpl.3 MLINKS+=pow.3 powf.3 MLINKS+=frexp.3 frexpf.3 frexp.3 frexpl.3 +MLINKS+=ilogb.3 logb.3 ilogb.3 logbf.3 logb.3 logbl.3 MLINKS+=ilogb.3 ilogbf.3 ilogb.3 ilogbl.3 -MLINKS+=nextafter.3 nextafterf.3 nextafter.3 nextafterl.3 nextafter.3 nexttoward.3 -MLINKS+=remainder.3 remainderf.3 remainder.3 remquo.3 remainder.3 remquof.3 +MLINKS+=nextafter.3 nextafterf.3 nextafter.3 nextafterl.3 +MLINKS+=nextafter.3 nexttoward.3 nextafter.3 nexttowardf.3 +MLINKS+=remainder.3 remainderf.3 remainder.3 remainderl.3 +MLINKS+=remainder.3 remquo.3 remainder.3 remquof.3 remainder.3 remquol.3 MLINKS+=finite.3 finitef.3 +MLINKS+=fma.3 fmaf.3 fma.3 fmal.3 +MLINKS+=lrint.3 lintf.3 lrint.3 lrintl.3 +MLINKS+=lrint.3 llrint.3 lrint.3 llrintf.3 lrint.3 llrintl.3 +MLINKS+=lround.3 lroundf.3 lround.3 lroundl.3 +MLINKS+=lround.3 llround.3 lround.3 llroundf.3 lround.3 llroundl.3 diff --git a/lib/libm/man/acos.3 b/lib/libm/man/acos.3 index a112433189..eb854748d9 100644 --- a/lib/libm/man/acos.3 +++ b/lib/libm/man/acos.3 @@ -26,16 +26,16 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)acos.3 5.1 (Berkeley) 5/2/91 -.\" $NetBSD: acos.3,v 1.16 2003/08/07 16:44:46 agc Exp $ -.\" $DragonFly: src/lib/libm/man/acos.3,v 1.2 2005/12/28 13:35:02 swildner Exp $ +.\" FreeBSD SVN: 181074 (2008-07-31) .\" -.Dd May 2, 1991 +.Dd December 21, 2011 .Dt ACOS 3 .Os .Sh NAME .Nm acos , -.Nm acosf -.Nd arc cosine function +.Nm acosf , +.Nm acosl +.Nd arc cosine functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -44,42 +44,44 @@ .Fn acos "double x" .Ft float .Fn acosf "float x" +.Ft long double +.Fn acosl "long double x" .Sh DESCRIPTION The -.Fn acos +.Fn acos , +.Fn acosf , and -.Fn acosf +.Fn acosl functions compute the principal value of the arc cosine of -.Fa x -in the range -.Bq 0 , \*(Pi . +.Fa x . .Sh RETURN VALUES -If |x|\*[Gt]1, -.Fn acos "x" -and -.Fn acosf "x" -.\" POSIX_MODE -set the global variable -.Va errno -to -.Er EDOM . -.\" SYSV_MODE -.\" call -.\" .Xr matherr 3 . +These functions return the arc cosine in the range +.Bq 0 , \*(Pi +radians. +If: +.Bd -unfilled -offset indent +.Pf \&| Ns Ar 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 -.\" .Xr matherr 3 .Sh STANDARDS The -.Fn acos -function conforms to -.St -ansiC . +.Fn acos , +.Fn acosf , +and +.Fn acosl +functions conform to +.St -isoC-99 . diff --git a/lib/libm/man/acosh.3 b/lib/libm/man/acosh.3 index 9a833f3e8a..ed078d5516 100644 --- a/lib/libm/man/acosh.3 +++ b/lib/libm/man/acosh.3 @@ -26,16 +26,15 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)acosh.3 5.2 (Berkeley) 5/6/91 -.\" $NetBSD: acosh.3,v 1.15 2003/08/07 16:44:46 agc Exp $ -.\" $DragonFly: src/lib/libm/man/acosh.3,v 1.2 2005/12/28 13:35:02 swildner Exp $ +.\" FreeBSD SVN: 165906 (2007-01-09) .\" -.Dd May 6, 1991 +.Dd January 14, 2005 .Dt ACOSH 3 .Os .Sh NAME .Nm acosh , .Nm acoshf -.Nd inverse hyperbolic cosine function +.Nd inverse hyperbolic cosine functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -47,31 +46,31 @@ .Sh DESCRIPTION The .Fn acosh -and +and the .Fn acoshf functions compute the inverse hyperbolic cosine of the real argument .Ar x . +For a discussion of error due to roundoff, see +.Xr math 3 . .Sh RETURN VALUES -.\" POSIX_MODE -If x is less than one, -.Fn acosh "x" -and -.Fn acoshf "x" -return NaN and set the global variable -.Va errno -to -.Er EDOM . -.\" SVR4_MODE -.\" call -.\" .Xr matherr 3 . +The +.Fn acosh +and the +.Fn acoshf +functions +return the inverse hyperbolic cosine of +.Ar 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 -.\" .Xr matherr 3 .Sh HISTORY The .Fn acosh diff --git a/lib/libm/man/asin.3 b/lib/libm/man/asin.3 index 05d198f3f9..86beed0e92 100644 --- a/lib/libm/man/asin.3 +++ b/lib/libm/man/asin.3 @@ -26,16 +26,16 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)asin.3 5.1 (Berkeley) 5/2/91 -.\" $NetBSD: asin.3,v 1.16 2003/08/07 16:44:46 agc Exp $ -.\" $DragonFly: src/lib/libm/man/asin.3,v 1.2 2005/12/28 13:35:02 swildner Exp $ +.\" FreeBSD: 181074 (2008-07-31) .\" -.Dd May 2, 1991 +.Dd December 21, 2011 .Dt ASIN 3 .Os .Sh NAME .Nm asin , -.Nm asinf -.Nd arc sine function +.Nm asinf , +.Nm asinl +.Nd arc sine functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -44,44 +44,46 @@ .Fn asin "double x" .Ft float .Fn asinf "float x" +.Ft long double +.Fn asinl "long double x" .Sh DESCRIPTION The -.Fn asin +.Fn asin , +.Fn asinf , and -.Fn asinf +.Fn asinl functions compute the principal value of the arc sine of -.Fa x -in the range +.Fa x . +.Sh RETURN VALUES +These functions return the arc sine in the range .Bk -words -.Bq -\*(Pi/2, +\*(Pi/2 . +.Bq -\*(Pi/2 , +\*(Pi/2 .Ek -.Sh RETURN VALUES -.\" POSIX_MODE -If |x|\*[Gt]1, -.Fn asin "x" -and -.Fn asinf "x" -return NaN and set the global variable -.Va errno -to -.Er EDOM . -.\" SYSV_MODE -.\" call -.\" .Xr matherr 3 . +radians. +If: +.Bd -unfilled -offset indent +.Pf \&| Ns Ar 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 -.\" .Xr matherr 3 .Sh STANDARDS The -.Fn asin -function conforms to -.St -ansiC . +.Fn asin , +.Fn asinf , +and +.Fn asinl +functions conform to +.St -isoC-99 . diff --git a/lib/libm/man/asinh.3 b/lib/libm/man/asinh.3 index 9d8dcb14d8..40b5b58474 100644 --- a/lib/libm/man/asinh.3 +++ b/lib/libm/man/asinh.3 @@ -26,8 +26,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)asinh.3 6.4 (Berkeley) 5/6/91 -.\" $NetBSD: asinh.3,v 1.15 2003/08/07 16:44:46 agc Exp $ -.\" $DragonFly: src/lib/libm/man/asinh.3,v 1.1 2005/07/26 21:15:20 joerg Exp $ +.\" $FreeBSD$ .\" .Dd May 6, 1991 .Dt ASINH 3 @@ -35,7 +34,7 @@ .Sh NAME .Nm asinh , .Nm asinhf -.Nd inverse hyperbolic sine function +.Nd inverse hyperbolic sine functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -47,28 +46,27 @@ .Sh DESCRIPTION The .Fn asinh -and +and the .Fn asinhf functions compute the inverse hyperbolic sine of the real argument +.Ar x . +For a discussion of error due to roundoff, see +.Xr math 3 . .Sh RETURN VALUES The .Fn asinh -and +and the .Fn asinhf -functions return the inverse hyperbolic sine of +functions +return the inverse hyperbolic sine of .Ar x . -.\" SYSV_MODE -.\" .Sh RETURN VALUES -.\" Exceptional cases are handled by -.\" .Xr matherr 3 . .Sh SEE ALSO .Xr acosh 3 , .Xr atanh 3 , .Xr exp 3 , .Xr math 3 -.\" .Xr matherr 3 .Sh HISTORY The .Fn asinh diff --git a/lib/libm/man/atan.3 b/lib/libm/man/atan.3 index 144e106547..0aac319166 100644 --- a/lib/libm/man/atan.3 +++ b/lib/libm/man/atan.3 @@ -26,16 +26,16 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)atan.3 5.1 (Berkeley) 5/2/91 -.\" $NetBSD: atan.3,v 1.16 2003/08/07 16:44:46 agc Exp $ -.\" $DragonFly: src/lib/libm/man/atan.3,v 1.1 2005/07/26 21:15:20 joerg Exp $ +.\" $FreeBSD$ .\" -.Dd May 2, 1991 +.Dd December 21, 2011 .Dt ATAN 3 .Os .Sh NAME .Nm atan , -.Nm atanf -.Nd arc tangent function of one variable +.Nm atanf , +.Nm atanl +.Nd arc tangent functions of one variable .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -44,21 +44,22 @@ .Fn atan "double x" .Ft float .Fn atanf "float x" +.Ft long double +.Fn atanl "long double x" .Sh DESCRIPTION The -.Fn atan +.Fn atan , +.Fn atanf , and -.Fn atanf +.Fn atanl functions compute the principal value of the arc tangent of -.Fa x -in the range +.Fa x . +.Sh RETURN VALUES +These functions return the arc tangent in the range .Bk -words -.Bq -\*(Pi/2 , +\*(Pi/2 . +.Bq -\*(Pi/2 , +\*(Pi/2 .Ek -.\" SYSV_MODE -.\" .Sh RETURN VALUES -.\" Exceptional cases are handled by -.\" .Xr matherr 3 . +radians. .Sh SEE ALSO .Xr acos 3 , .Xr asin 3 , @@ -70,9 +71,11 @@ in the range .Xr sinh 3 , .Xr tan 3 , .Xr tanh 3 -.\" .Xr matherr 3 .Sh STANDARDS The -.Fn atan -functions conforms to -.St -ansiC . +.Fn atan , +.Fn atanf , +and +.Fn atanl +functions conform to +.St -isoC-99 . diff --git a/lib/libm/man/atan2.3 b/lib/libm/man/atan2.3 index ad5d8c21ea..a716d028bf 100644 --- a/lib/libm/man/atan2.3 +++ b/lib/libm/man/atan2.3 @@ -26,15 +26,15 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)atan2.3 5.1 (Berkeley) 5/2/91 -.\" $NetBSD: atan2.3,v 1.16 2003/08/07 16:44:46 agc Exp $ -.\" $DragonFly: src/lib/libm/man/atan2.3,v 1.2 2005/12/10 00:22:29 swildner Exp $ +.\" $FreeBSD$ .\" -.Dd May 2, 1991 +.Dd December 21, 2011 .Dt ATAN2 3 .Os .Sh NAME .Nm atan2 , -.Nm atan2f +.Nm atan2f , +.Nm atan2l .Nd arc tangent function of two variables .Sh LIBRARY .Lb libm @@ -44,36 +44,33 @@ .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" .Sh DESCRIPTION The -.Fn atan2 +.Fn atan2 , +.Fn atan2f , and -.Fn atan2f +.Fn atan2l functions compute the principal value of the arc tangent of -.Ar y/ Ns Ar x , +.Fa y/ Ns Ar x , using the signs of both arguments to determine the quadrant of the return value. .Sh RETURN VALUES The -.Fn atan2 -function, if successful, -returns the arc tangent of -.Ar y/ Ns Ar x +.Fn atan2 , +.Fn atan2f , +and +.Fn atan2l +functions, if successful, +return the arc tangent of +.Fa 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 : +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 @@ -100,9 +97,7 @@ The function .Fn atan2 defines "if x \*[Gt] 0," .Fn atan2 0 0 -= 0 on a -.Tn VAX -despite that previously += 0 despite that previously .Fn atan2 0 0 may have generated an error message. The reasons for assigning a value to @@ -137,11 +132,11 @@ r\(**sin\(*h. These equations are satisfied when (x=0,y=0) is mapped to .if n \ -(r=0,theta=0) +(r=0,theta=0). .if t \ -(r=0,\(*h=0) -on a VAX. -In general, conversions to polar coordinates should be computed thus: +(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) @@ -179,6 +174,8 @@ r := \(sr(x\(**x+y\(**y);\0\0if r = 0 then x := copysign(1,x); .Xr acos 3 , .Xr asin 3 , .Xr atan 3 , +.Xr cabs 3 , +.Xr carg 3 , .Xr cos 3 , .Xr cosh 3 , .Xr math 3 , @@ -188,6 +185,9 @@ r := \(sr(x\(**x+y\(**y);\0\0if r = 0 then x := copysign(1,x); .Xr tanh 3 .Sh STANDARDS The -.Fn atan2 -function conforms to -.St -ansiC . +.Fn atan2 , +.Fn atan2f , +and +.Fn atan2l +functions conform to +.St -isoC-99 . diff --git a/lib/libm/man/atanh.3 b/lib/libm/man/atanh.3 index e882ae5711..cc5342dcee 100644 --- a/lib/libm/man/atanh.3 +++ b/lib/libm/man/atanh.3 @@ -26,16 +26,15 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)atanh.3 5.2 (Berkeley) 5/6/91 -.\" $NetBSD: atanh.3,v 1.15 2003/08/07 16:44:46 agc Exp $ -.\" $DragonFly: src/lib/libm/man/atanh.3,v 1.2 2005/12/28 13:35:02 swildner Exp $ +.\" $FreeBSD$ .\" -.Dd May 6, 1991 +.Dd January 14, 2005 .Dt ATANH 3 .Os .Sh NAME .Nm atanh , .Nm atanhf -.Nd inverse hyperbolic tangent function +.Nd inverse hyperbolic tangent functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -47,31 +46,34 @@ .Sh DESCRIPTION The .Fn atanh -and +and the .Fn atanhf functions compute the inverse hyperbolic tangent of the real argument .Ar x . +For a discussion of error due to roundoff, see +.Xr math 3 . .Sh RETURN VALUES -If |x|\*[Ge]1, -.Fn atanh "x" -and -.Fn atanhf "x" -.\" POSIX_MODE -return +inf, -inf or NaN, and sets the global variable -.Va errno -to -.Er EDOM . -.\" SYSV_MODE -.\" call -.\" .Xr matherr 3 . +The +.Fn atanh +and the +.Fn atanhf +functions +return the inverse hyperbolic tangent of +.Ar x +if successful. +If the argument has absolute value 1, a divide-by-zero exception +is raised and an infinity is returned. +If +.Ar |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 -.\" .Xr matherr 3 .Sh HISTORY The .Fn atanh diff --git a/lib/libm/man/ceil.3 b/lib/libm/man/ceil.3 index 948ed940bd..9b4e0c6b60 100644 --- a/lib/libm/man/ceil.3 +++ b/lib/libm/man/ceil.3 @@ -26,17 +26,16 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)ceil.3 5.1 (Berkeley) 5/2/91 -.\" $NetBSD: ceil.3,v 1.19 2011/09/18 05:33:13 jruoho Exp $ +.\" $FreeBSD$ .\" -.Dd September 18, 2011 +.Dd December 21, 2011 .Dt CEIL 3 .Os .Sh NAME .Nm ceil , .Nm ceilf , -.Nm floor , -.Nm floorf -.Nd ceiling and floor +.Nm ceill +.Nd smallest integral value greater than or equal to x .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -45,31 +44,34 @@ .Fn ceil "double x" .Ft float .Fn ceilf "float x" -.Ft double -.Fn floor "double x" -.Ft float -.Fn floorf "float x" +.Ft "long double" +.Fn ceill "long double x" .Sh DESCRIPTION The -.Fn ceil -and +.Fn ceil , .Fn ceilf +and +.Fn ceill functions return the smallest integral value greater than or equal to -.Fa x . -Conversely, the -.Fn floor -and -.Fn floorf -functions return the largest integral value -less than or equal to -.Fa x . +.Fa x , +expressed as a floating-point number. .Sh SEE ALSO .Xr abs 3 , .Xr fabs 3 , +.Xr floor 3 , .Xr math 3 , -.Xr nextafter 3 , -.Xr rint 3 +.Xr rint 3 , +.Xr round 3 , +.Xr trunc 3 .Sh STANDARDS -The described functions conform to +The +.Fn ceil +function conforms to +.St -isoC . +The +.Fn ceilf +and +.Fn ceill +functions conform to .St -isoC-99 . diff --git a/lib/libm/man/copysign.3 b/lib/libm/man/copysign.3 index 39c7c2d68d..d8cd44ed90 100644 --- a/lib/libm/man/copysign.3 +++ b/lib/libm/man/copysign.3 @@ -1,6 +1,4 @@ -.\" $NetBSD: copysign.3,v 1.1 2011/04/13 04:57:10 jruoho Exp $ -.\" -.\" Copyright (c) 2011 Jukka Ruohonen +.\" Copyright (c) 1985, 1991 Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -11,27 +9,33 @@ .\" 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. +.\" 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. .\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 +.\" $FreeBSD$ .\" -.Dd April 13, 2011 +.Dd December 21, 2011 .Dt COPYSIGN 3 .Os .Sh NAME .Nm copysign , .Nm copysignf , .Nm copysignl -.Nd functions to manipulate signs +.Nd copy sign .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -45,46 +49,37 @@ .Sh DESCRIPTION The .Fn copysign , -.Fn copysignf , +.Fn copysignf and .Fn copysignl -functions return a value whose absolute value matches -.Fa x , -but whose sign bit is taken from -.Fa y . -.Sh RETURN VALUES -Upon successful completion, -all three functions return a value with the magnitude of +functions +return .Fa x -and the sign of -.Fa y . -If -.Fa x -is -\*(Na , -the functions return a -\*(Na -with the sign of -.Fa y . +with its sign changed to +.Fa y Ns 's . .Sh SEE ALSO -.Xr math 3 , -.Xr signbit 3 +.Xr fabs 3 , +.Xr fdim 3 , +.Xr math 3 .Sh STANDARDS -The described functions conform to +The +.Fn copysign , +.Fn copysignf , +and +.Fn copysignl +routines conform to .St -isoC-99 . -.\" -.\" XXX: Verify this. -.\" -.\" The functions are also recommended by -.\" .St -ieee754 -.\" -.\" .Sh HISTORY -.\" -.\" XXX: Fill this. -.\" -.\" These functions first appeared in ???. -.\" -.Sh CAVEATS -Note that on implementations that represent a signed zero -but do not treat negative zero consistently in arithmetic operations, -these functions may regard the sign of zero as positive. +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 +.Dx 2.3 , +respectively. diff --git a/lib/libm/man/cos.3 b/lib/libm/man/cos.3 index 41fd88fa1c..15a0bf2ee7 100644 --- a/lib/libm/man/cos.3 +++ b/lib/libm/man/cos.3 @@ -26,16 +26,16 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)cos.3 5.1 (Berkeley) 5/2/91 -.\" $NetBSD: cos.3,v 1.15 2003/08/07 16:44:47 agc Exp $ -.\" $DragonFly: src/lib/libm/man/cos.3,v 1.1 2005/07/26 21:15:20 joerg Exp $ +.\" $FreeBSD$ .\" -.Dd May 2, 1991 +.Dd December 21, 2011 .Dt COS 3 .Os .Sh NAME .Nm cos , -.Nm cosf -.Nd cosine function +.Nm cosf , +.Nm cosl +.Nd cosine functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -44,11 +44,14 @@ .Fn cos "double x" .Ft float .Fn cosf "float x" +.Ft long double +.Fn cosl "long double x" .Sh DESCRIPTION The -.Fn cos +.Fn cos , +.Fn cosf , and -.Fn cosf +.Fn cosl functions compute the cosine of .Fa x (measured in radians). @@ -58,13 +61,17 @@ For a discussion of error due to roundoff, see .Xr math 3 . .Sh RETURN VALUES The -.Fn cos -function returns the cosine value. +.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 , @@ -72,7 +79,5 @@ function returns the cosine value. .Xr tan 3 , .Xr tanh 3 .Sh STANDARDS -The -.Fn cos -function conforms to -.St -ansiC . +These functions conform to +.St -isoC-99 . diff --git a/lib/libm/man/cosh.3 b/lib/libm/man/cosh.3 index 0d730fbe57..16f7f6af8e 100644 --- a/lib/libm/man/cosh.3 +++ b/lib/libm/man/cosh.3 @@ -26,16 +26,15 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)cosh.3 5.1 (Berkeley) 5/2/91 -.\" $NetBSD: cosh.3,v 1.15 2003/08/07 16:44:47 agc Exp $ -.\" $DragonFly: src/lib/libm/man/cosh.3,v 1.2 2005/12/28 13:35:02 swildner Exp $ +.\" $FreeBSD$ .\" -.Dd May 2, 1991 +.Dd January 14, 2005 .Dt COSH 3 .Os .Sh NAME .Nm cosh , .Nm coshf -.Nd hyperbolic cosine function +.Nd hyperbolic cosine functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -47,7 +46,7 @@ .Sh DESCRIPTION The .Fn cosh -and +and the .Fn coshf functions compute the hyperbolic cosine of .Fa x . @@ -56,28 +55,24 @@ If the magnitude of x is too large, .Fn cosh "x" and .Fn coshf "x" -.\" POSIX_MODE return Inf and sets the global variable .Va errno to .Er ERANGE . -.\" SYSV_MODE -.\" call -.\" .Xr matherr 3 . .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 -.\" .Xr matherr 3 .Sh STANDARDS The .Fn cosh function conforms to -.St -ansiC . +.St -isoC . diff --git a/lib/libm/man/erf.3 b/lib/libm/man/erf.3 index f0283d532a..6d234e85a0 100644 --- a/lib/libm/man/erf.3 +++ b/lib/libm/man/erf.3 @@ -26,8 +26,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)erf.3 6.4 (Berkeley) 4/20/91 -.\" $NetBSD: erf.3,v 1.12 2003/08/07 16:44:47 agc Exp $ -.\" $DragonFly: src/lib/libm/man/erf.3,v 1.1 2005/07/26 21:15:20 joerg Exp $ +.\" $FreeBSD$ .\" .Dd April 20, 1991 .Dt ERF 3 @@ -56,18 +55,24 @@ These functions calculate the error function of .Pp The .Fn erf -calculates the error function of x; where -.Bd -filled -offset indent +and the +.Fn erff +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. \} +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. \} +(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 -function calculates the complementary error function of +and the +.Fn erfcf +functions calculate the complementary error function of .Fa x ; that is .Fn erfc diff --git a/lib/libm/man/exp.3 b/lib/libm/man/exp.3 index aae31f3819..e9307e9250 100644 --- a/lib/libm/man/exp.3 +++ b/lib/libm/man/exp.3 @@ -26,10 +26,9 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)exp.3 6.12 (Berkeley) 7/31/91 -.\" $FreeBSD: src/lib/msun/man/exp.3,v 1.24 2008/01/18 21:43:00 das Exp $ -.\" $NetBSD: exp.3,v 1.28 2011/09/17 10:52:52 jruoho Exp $ +.\" $FreeBSD$ .\" -.Dd September 13, 2011 +.Dd December 21, 2011 .Dt EXP 3 .Os .Sh NAME @@ -38,10 +37,12 @@ .\" The sorting error is intentional. exp and expf should be adjacent. .Nm exp2 , .Nm exp2f , -.\" .Nm exp2l , +.Nm exp2l , .Nm expm1 , .Nm expm1f , -.Nd exponential functions +.Nm pow , +.Nm powf +.Nd exponential and power functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -54,12 +55,16 @@ .Fn exp2 "double x" .Ft float .Fn exp2f "float x" -.\" .Ft long double -.\" .Fn exp2l "long double x" +.Ft long double +.Fn exp2l "long double x" .Ft double .Fn expm1 "double x" .Ft float .Fn expm1f "float x" +.Ft double +.Fn pow "double x" "double y" +.Ft float +.Fn powf "float x" "float y" .Sh DESCRIPTION The .Fn exp @@ -72,11 +77,9 @@ exponential value of the given argument .Pp The .Fn exp2 , +.Fn exp2f , and -.Fn exp2f -.\" .Fn exp2f , -.\" and -.\" .Fn exp2l +.Fn exp2l functions compute the base 2 exponential of the given argument .Fa x . .Pp @@ -84,44 +87,91 @@ The .Fn expm1 and the .Fn expm1f -functions computes the value exp(x)\-1 accurately even for tiny argument +functions compute the value exp(x)\-1 accurately even for tiny argument .Fa x . +.Pp +The +.Fn pow +and the +.Fn powf +functions compute the value +of +.Ar x +to the exponent +.Ar 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 exp +.Fn pow x y and -.Fn expm1 -detect if the computed value will overflow, -set the global variable -.Va errno -to -.Er ERANGE -and cause a reserved operand fault on a -.Tn VAX . +.Fn powf 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 fenv 3 , +.Xr ldexp 3 , +.Xr log 3 , .Xr math 3 .Sh STANDARDS -The -.Fn exp -functions conform to -.St -ansiC . -The -.Fn exp2 , -.Fn exp2f , -.Fn expf , -.Fn expm1 , -and -.Fn expm1f -functions conform to +These functions conform to .St -isoC-99 . -.Sh HISTORY -The -.Fn exp -functions appeared in -.At v6 . -The -.Fn expm1 -function appeared in -.Bx 4.3 . diff --git a/lib/libm/man/fabs.3 b/lib/libm/man/fabs.3 index 4590ef7b6e..3b4fd02f86 100644 --- a/lib/libm/man/fabs.3 +++ b/lib/libm/man/fabs.3 @@ -1,6 +1,7 @@ .\" 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: @@ -26,15 +27,16 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)fabs.3 5.1 (Berkeley) 5/2/91 -.\" $NetBSD: fabs.3,v 1.15 2011/09/13 07:11:43 njoly Exp $ +.\" $FreeBSD$ .\" -.Dd May 2, 1991 +.Dd December 21, 2011 .Dt FABS 3 .Os .Sh NAME .Nm fabs , -.Nm fabsf -.Nd floating-point absolute value function +.Nm fabsf , +.Nm fabsl +.Nd floating-point absolute value functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -43,17 +45,23 @@ .Fn fabs "double x" .Ft float .Fn fabsf "float x" +.Ft long double +.Fn fabsl "long double x" .Sh DESCRIPTION The -.Fn fabs -and +.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 -function returns the absolute value of +.Fn fabs , +.Fn fabsf +and +.Fn fabsl +functions return the absolute value of .Fa x . .Sh SEE ALSO .Xr abs 3 , @@ -65,4 +73,10 @@ function returns the absolute value of The .Fn fabs function conforms to -.St -ansiC . +.St -isoC . +The +.Fn fabsf +and +.Fn fabsl +functions conform to +.St -isoC-99 . diff --git a/lib/libm/man/fdim.3 b/lib/libm/man/fdim.3 index ccd4f25b4c..3aff734f24 100644 --- a/lib/libm/man/fdim.3 +++ b/lib/libm/man/fdim.3 @@ -22,6 +22,8 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" +.\" $FreeBSD$ +.\" .Dd June 1, 2009 .Dt FDIM 3 .Os @@ -63,7 +65,7 @@ is an \*(Na, then an \*(Na is returned. Otherwise, the result is .Li +0.0 . .Pp -Overflow or underflow may occur iff the exact result is not +Overflow or underflow may occur if the exact result is not representable in the return type. No other exceptions are raised. .Sh SEE ALSO diff --git a/lib/libm/man/floor.3 b/lib/libm/man/floor.3 index 9ff1d48ca2..d05b6ae55f 100644 --- a/lib/libm/man/floor.3 +++ b/lib/libm/man/floor.3 @@ -26,15 +26,16 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)floor.3 6.5 (Berkeley) 4/19/91 -.\" $NetBSD: floor.3,v 1.14 2003/08/07 16:44:47 agc Exp $ +.\" $FreeBSD$ .\" -.Dd March 10, 1994 +.Dd December 21, 2011 .Dt FLOOR 3 .Os .Sh NAME .Nm floor , -.Nm floorf -.Nd round to largest integral value not greater than x +.Nm floorf , +.Nm floorl +.Nd largest integral value less than or equal to x .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -43,22 +44,34 @@ .Fn floor "double x" .Ft float .Fn floorf "float x" +.Ft "long double" +.Fn floorl "long double x" .Sh DESCRIPTION The -.Fn floor -and +.Fn floor , .Fn floorf +and +.Fn floorl functions return the largest integral value less than or equal to -.Fa x . +.Fa x , +expressed as a floating-point number. .Sh SEE ALSO .Xr abs 3 , .Xr ceil 3 , .Xr fabs 3 , .Xr math 3 , -.Xr rint 3 +.Xr rint 3 , +.Xr round 3 , +.Xr trunc 3 .Sh STANDARDS The .Fn floor function conforms to -.St -ansiC . +.St -isoC . +The +.Fn floorf +and +.Fn floorl +functions conform to +.St -isoC-99 . diff --git a/lib/libm/man/fma.3 b/lib/libm/man/fma.3 new file mode 100644 index 0000000000..6ffa6d08ee --- /dev/null +++ b/lib/libm/man/fma.3 @@ -0,0 +1,108 @@ +.\" Copyright (c) 2005 David Schultz +.\" 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 SVN: 152755 (2005-11-24) +.\" +.Dd December 21, 2011 +.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 routines first appeared in +.Dx 2.13 . diff --git a/lib/libm/man/fmod.3 b/lib/libm/man/fmod.3 index 0a592d0306..f01aa959e0 100644 --- a/lib/libm/man/fmod.3 +++ b/lib/libm/man/fmod.3 @@ -26,16 +26,16 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)fmod.3 5.1 (Berkeley) 5/2/91 -.\" $NetBSD: fmod.3,v 1.11 2003/08/07 16:44:47 agc Exp $ -.\" $DragonFly: src/lib/libm/man/fmod.3,v 1.1 2005/07/26 21:15:20 joerg Exp $ +.\" $FreeBSD$ .\" -.Dd May 2, 1991 +.Dd June 19, 2008 .Dt FMOD 3 .Os .Sh NAME .Nm fmod , -.Nm fmodf -.Nd floating-point remainder function +.Nm fmodf , +.Nm fmodl +.Nd floating-point remainder functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -44,37 +44,44 @@ .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 -function computes the floating-point remainder of +.Fn fmod , +.Fn fmodf , +and +.Fn fmodl +functions compute the floating-point remainder of .Fa x Ns / Fa y . .Sh RETURN VALUES -The -.Fn fmod +If +.Fa y +is non-zero, the +.Fn fmod , +.Fn fmodf , and -.Fn fmodf +.Fn fmodl functions return 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 +.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, whether a domain error occurs or the -.Fn fmod -function returns zero is implementation-defined. +is zero, a \*(Na is produced. .Sh SEE ALSO .Xr math 3 .Sh STANDARDS The -.Fn fmod -function conforms to -.St -ansiC . +.Fn fmod , +.Fn fmodf , +and +.Fn fmodl +functions conform to +.St -isoC-99 . diff --git a/lib/libm/man/frexp.3 b/lib/libm/man/frexp.3 index 4b1124d7ce..9802202d61 100644 --- a/lib/libm/man/frexp.3 +++ b/lib/libm/man/frexp.3 @@ -33,7 +33,7 @@ .\" .\" @(#)frexp.3 8.1 (Berkeley) 6/4/93 .\" -.Dd March 21, 2006 +.Dd December 21, 2011 .Dt FREXP 3 .Os .Sh NAME @@ -47,6 +47,8 @@ .Fn frexp "double value" "int *exp" .Ft float .Fn frexpf "float value" "int *exp" +.Ft long double +.Fn frexpf "long double value" "int *exp" .Sh DESCRIPTION The .Fn frexp diff --git a/lib/libm/man/hypot.3 b/lib/libm/man/hypot.3 index bc56ea820a..84e1d70bd0 100644 --- a/lib/libm/man/hypot.3 +++ b/lib/libm/man/hypot.3 @@ -26,17 +26,18 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)hypot.3 6.7 (Berkeley) 5/6/91 -.\" $NetBSD: hypot.3,v 1.16 2003/11/02 11:17:16 wiz Exp $ -.\" $DragonFly: src/lib/libm/man/hypot.3,v 1.1 2005/07/26 21:15:20 joerg Exp $ +.\" $FreeBSD$ .\" -.Dd May 6, 1991 +.Dd December 21, 2011 .Dt HYPOT 3 .Os .Sh NAME .Nm hypot , .Nm hypotf , +.Nm hypotl , .Nm cabs , -.Nm cabsf +.Nm cabsf , +.Nm cabsl .Nd Euclidean distance and complex absolute value functions .Sh LIBRARY .Lb libm @@ -46,28 +47,41 @@ .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 "struct complex { double x; double y; } z" +.Fn cabs "double complex z" .Ft float -.Fn cabsf "struct complex { float x; float y; } z" +.Fn cabsf "float complex z" +.Ft "long double" +.Fn cabsl "long double complex z" .Sh DESCRIPTION The -.Fn hypot +.Fn hypot , +.Fn hypotf and -.Fn cabs +.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 -.Ar v , +.Fa v , including \*(Na. -.Sh ERRORS +.Sh ERROR (due to Roundoff, etc.) Below 0.97 .Em ulps . Consequently @@ -76,11 +90,6 @@ Consequently exactly; in general, hypot and cabs return an integer whenever an integer might be expected. -.Pp -The same cannot be said for the shorter and faster version of hypot -and cabs that is provided in the comments in cabs.c; its error can -exceed 1.2 -.Em ulps . .Sh NOTES As might be expected, .Fn hypot "v" "\*(Na" @@ -88,13 +97,8 @@ and .Fn hypot "\*(Na" "v" are \*(Na for all .Em finite -.Ar v ; -with "reserved operand" in place of "\*(Na", the -same is true on a -.Tn VAX . -But programmers on machines other than a -.Tn VAX -(it has no \*(If) +.Fa v . +But programmers might be surprised at first to discover that .Fn hypot "\(+-\*(If" "\*(Na" = +\*(If. @@ -103,12 +107,12 @@ This is intentional; it happens because = +\*(If for .Em all -.Ar v , +.Fa v , finite or infinite. Hence .Fn hypot "\*(If" "v" is independent of -.Ar v . +.Fa v . Unlike the reserved operand fault on a .Tn VAX , the @@ -117,8 +121,20 @@ the 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 @@ -127,11 +143,3 @@ function and a function appeared in .At v7 . -.Sh BUGS -The -.Fn cabs -and -.Fn cabsf -functions use structures that are not defined in any header and need to -be defined by the user. -As such they cannot be prototyped properly. diff --git a/lib/libm/man/ilogb.3 b/lib/libm/man/ilogb.3 index 6398720095..9405d46a1b 100644 --- a/lib/libm/man/ilogb.3 +++ b/lib/libm/man/ilogb.3 @@ -1,6 +1,3 @@ -.\" $NetBSD: ilogb.3,v 1.3 2011/08/02 10:15:03 wiz Exp $ -.\" -.\" Copyright (c) 2011 Jukka Ruohonen .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -11,27 +8,36 @@ .\" 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. +.\" 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. .\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 +.\" $FreeBSD$ .\" -.Dd July 29, 2011 +.Dd December 21, 2011 .Dt ILOGB 3 .Os .Sh NAME .Nm ilogb , .Nm ilogbf , -.Nm ilogbl -.Nd an unbiased exponent +.Nm ilogbl , +.Nm logb , +.Nm logbf , +.Nm logbl +.Nd extract exponent .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -42,70 +48,75 @@ .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 -The .Fn ilogb , -.Fn ilogbf , +.Fn ilogbf and .Fn ilogbl -functions return the exponent of the non-zero real floating-point number -.Fa x -as a signed integer value. -Formally the return value is the integral part of -.Bd -ragged -offset indent -log_r | -.Va x | , -.Ed -.Pp -where -.Fa r -is the radix of the machine's floating-point arithmetic defined by the -.Dv FLT_RADIX -constant in -.In float.h . -.Sh RETURN VALUES -As described above, upon successful completion, -the functions return the exponent. -Functionally this is the same as calling the corresponding -.Xr logb 3 -function and casting the return value to -.Vt int . +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 -The following special cases may occur: -.Bl -enum -offset indent -.It -If -.Fa x -is zero, the value of -.Dv FP_ILOGB0 -is returned and a domain error occurs. -.It -If -.Fa x -is infinite, a domain error occurs and the value of -.Dv INT_MAX -is returned. -.It -If -.Fa x -is \*(Na, a domain error is raised and the value of -.Dv FP_ILOGBNAN -is returned. -.It -If the correct value is outside the range of the return type, -a domain error occurs but an unspecified value is returned. -.El +.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 ilog2 3 , -.Xr logb 3 , -.Xr math 3 +.Xr frexp 3 , +.Xr math 3 , +.Xr scalbn 3 .Sh STANDARDS -The described functions conform to +The +.Fn ilogb , +.Fn ilogbf , +.Fn ilogbl , +.Fn logb , +.Fn logbf , +and +.Fn logbl +routines conform to .St -isoC-99 . -.Sh BUGS -Neither -.Dv FP_ILOGB0 -nor -.Dv FP_ILOGBNAN -is defined currently in -.Nx . +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 +.Dx 2.13 +.It Fn logbl +.Dx 2.13 +.El diff --git a/lib/libm/man/j0.3 b/lib/libm/man/j0.3 index 1dd591b781..bea06c5070 100644 --- a/lib/libm/man/j0.3 +++ b/lib/libm/man/j0.3 @@ -26,10 +26,9 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)j0.3 6.7 (Berkeley) 4/19/91 -.\" $NetBSD: j0.3,v 1.16 2003/08/07 16:44:48 agc Exp $ -.\" $DragonFly: src/lib/libm/man/j0.3,v 1.1 2005/07/26 21:15:20 joerg Exp $ +.\" $FreeBSD$ .\" -.Dd April 19, 1991 +.Dd February 18, 2008 .Dt J0 3 .Os .Sh NAME @@ -94,7 +93,8 @@ the functions and .Fn jnf compute the -.Em Bessel function of the first kind of the integer order +.Em Bessel function of the first kind of the integer +.Em order .Fa n for the real value .Fa x . @@ -102,7 +102,7 @@ for the real value The functions .Fn y0 , .Fn y0f , -.Fn y1 +.Fn y1 , and .Fn y1f compute the linearly independent @@ -112,42 +112,57 @@ compute the linearly independent 1, respectively, for the positive -.Em integer +.Em real value -.Fa x -(expressed as a double); +.Fa x ; the functions .Fn yn and .Fn ynf compute the -.Em Bessel function of the second kind for the integer order +.Em Bessel function of the second kind for the integer +.Em order .Fa n for the positive -.Em integer +.Em real value -.Fa x -(expressed as a double). +.Fa x . .Sh RETURN VALUES -If these functions are successful, -the computed value is returned, otherwise -the global -variable -.Va errno -is set to -.Er EDOM -and a reserve operand fault is generated. -.\" On the -.\" .Tn VAX -.\" and -.\" .Tn Tahoe -.\" architectures, a negative -.\" .Fa x -.\" value -.\" results in an error. +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, these routines will generate an invalid exception and +return \*(Na. +If +.Fa x +is 0 or a sufficiently small positive number, these routines +will generate an overflow exception and return -\*(If. .Sh SEE ALSO .Xr math 3 -.\" .Xr matherr 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 diff --git a/lib/libm/man/lgamma.3 b/lib/libm/man/lgamma.3 index b26f74462d..bee4be0994 100644 --- a/lib/libm/man/lgamma.3 +++ b/lib/libm/man/lgamma.3 @@ -26,22 +26,23 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)lgamma.3 6.6 (Berkeley) 12/3/92 -.\" $NetBSD: lgamma.3,v 1.21 2003/08/07 16:44:48 agc Exp $ -.\" $DragonFly: src/lib/libm/man/lgamma.3,v 1.1 2005/07/26 21:15:20 joerg Exp $ +.\" FreeBSD SVN: 176388 (2008-02-18) .\" -.Dd December 3, 1992 +.Dd December 21, 2011 .Dt LGAMMA 3 .Os .Sh NAME .Nm lgamma , -.Nm lgammaf , .Nm lgamma_r , +.Nm lgammaf , .Nm lgammaf_r , .Nm gamma , -.Nm gammaf , .Nm gamma_r , -.Nm gammaf_r -.Nd log gamma function +.Nm gammaf , +.Nm gammaf_r , +.Nm tgamma , +.Nm tgammaf +.Nd log gamma functions, gamma function .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -51,46 +52,69 @@ .sp .Ft double .Fn lgamma "double x" +.Ft double +.Fn lgamma_r "double x" "int *signgamp" .Ft float .Fn lgammaf "float x" -.Ft double -.Fn lgamma_r "double x" "int *sign" .Ft float -.Fn lgammaf_r "float x" "int *sign" +.Fn lgammaf_r "float 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 double -.Fn gamma_r "double x" "int *sign" +.Fn tgamma "double x" .Ft float -.Fn gammaf_r "float x" "int *sign" +.Fn tgammaf "float x" .Sh DESCRIPTION .Fn lgamma x +and +.Fn lgammaf x .if t \{\ -returns ln\||\(*G(x)| where +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 \*[Gt] 0 and -.br +\(*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 \*[Lt] 1. .Ed .\} .if n \ -returns ln\||\(*G(x)|. -.Pp +return ln\||\(*G(x)|. The external integer .Fa signgam returns the sign of \(*G(x). .Pp -.Fn lgamma_r -is a reentrant interface that performs identically to +.Fn lgamma_r x signgamp +and +.Fn lgammaf_r x signgamp +provide the same functionality as +.Fn lgamma x +and +.Fn lgammaf x +but the caller must provide an integer to store the sign of \(*G(x). +.Pp +The +.Fn tgamma x +and +.Fn tgammaf 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 , -differing in that the sign of \(*G(x) is stored in the location -pointed to by the -.Fa sign -argument and -.Fa signgam -is not modified. +.Fn lgammaf , +.Fn lgamma_r , +and +.Fn lgammaf_r , +respectively. .Sh IDIOSYNCRASIES Do not use the expression .Dq Li signgam\(**exp(lgamma(x)) @@ -102,23 +126,64 @@ lg = lgamma(x); g = signgam\(**exp(lg); .Pp Only after .Fn lgamma +or +.Fn lgammaf has returned can signgam be correct. -.Sh RETURN VALUES +.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 -returns appropriate values unless an argument is out of range. +will lose up to 10 significant bits. +.Sh RETURN VALUES +.Fn gamma , +.Fn gamma_r , +.Fn gammaf , +.Fn gammaf_r , +.Fn lgamma , +.Fn lgamma_r , +.Fn lgammaf , +and +.Fn lgammaf_r +return appropriate values unless an argument is out of range. Overflow will occur for sufficiently large positive values, and non-positive integers. -On the -.Tn VAX , -the reserved operator is returned, -and -.Va errno -is set to -.Er ERANGE . +For large non-integer negative values, +.Fn tgamma +will underflow. .Sh SEE ALSO .Xr math 3 +.Sh STANDARDS +The +.Fn lgamma , +.Fn lgammaf , +.Fn tgamma , +and +.Fn tgammaf +functions are expected to conform to +.St -isoC-99 . .Sh HISTORY The -.Nm lgamma +.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 +.Dx 2.13 . diff --git a/lib/libm/man/log.3 b/lib/libm/man/log.3 index 3a0ae493b6..163e782d94 100644 --- a/lib/libm/man/log.3 +++ b/lib/libm/man/log.3 @@ -1,6 +1,4 @@ -.\" $NetBSD: log.3,v 1.3 2011/09/13 08:51:32 wiz Exp $ -.\" -.\" Copyright (c) 2011 Jukka Ruohonen +.\" Copyright (c) 2008-2010 David Schultz .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -12,30 +10,33 @@ .\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +.\" 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 September 13, 2011 +.Dd December 21, 2011 .Dt LOG 3 .Os .Sh NAME .Nm log , .Nm logf , +.Nm logl , .Nm log10 , .Nm log10f , -.Nm log1p , -.Nm log1pf .Nm log2 , .Nm log2f , +.Nm log1p , +.Nm log1pf .Nd logarithm functions .Sh LIBRARY .Lb libm @@ -50,121 +51,68 @@ .Ft float .Fn log10f "float x" .Ft double -.Fn log1p "double x" -.Ft float -.Fn log1pf "float x" -.Ft double .Fn log2 "double x" .Ft float .Fn log2f "float x" +.Ft double +.Fn log1p "double x" +.Ft float +.Fn log1pf "float x" .Sh DESCRIPTION -The following functions compute logarithms: -.Bl -bullet -offset 2n -.It The .Fn log and .Fn logf -functions return the natural logarithm. -.It +functions compute the natural logarithm of +.Fa x . +.Pp The .Fn log10 and .Fn log10f -functions return the base 10 logarithm. -.It -The -.Fn log1p -and -.Fn log1pf -functions return the natural logarithm of (1.0 + -.Fa x ) -accurately even for very small values of -.Fa x . -.It -The +functions compute the logarithm base 10 of +.Fa x , +while .Fn log2 and .Fn log2f -functions return the base 2 logarithm. -.El -.Sh RETURN VALUES -Upon successful completion, the functions return the logarithm of -.Fa x -as descibed above. -Otherwise the following may occur: -.Bl -enum -offset indent -.It -If -.Fa x -is \*(Na, all functions return \*(Na. -.It -If -.Fa x -is positive infinity, all functions return +compute the logarithm base 2 of .Fa x . -If -.Fa x -is negative infinity, all functions return \*(Na. -.It -If -.Fa x -is +0.0 or -0.0, the -.Fn log , -.Fn log10 , -and -.Fn log2 -families return either -.Dv -HUGE_VAL , -.Dv -HUGE_VALF , -or -.Dv -HUGE_VALL , -whereas the -.Fn log1p -family returns -.Fa x . -.It -If -.Fa x -is +1.0, the -.Fn log , -.Fn log10 , -and -.Fn log2 -families return +0.0. -If -.Fa x -is -1.0, the -.Fn log1p -family returns -.Dv -HUGE_VAL , -.Dv -HUGE_VALF , -or -.Dv -HUGE_VALL . -.El .Pp -In addition, on a -.Tn VAX , -.Va errno -is set to -.Er EDOM -and the reserved operand is returned -by -.Fn log -unless -.Fa x -\*[Gt] 0, by +The .Fn log1p -unless +and +.Fn log1pf +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 -\*[Gt] \-1. +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 math 3 , +.Xr pow 3 .Sh STANDARDS -The described functions conform to +The +.Fn log , +.Fn logf , +.Fn log10 , +.Fn log10f , +.Fn log2 , +.Fn log2f , +.Fn log1p , +and +.Fn log1pf +functions conform to .St -isoC-99 . -.Sh HISTORY -The history of the logarithm functions dates back to -.At v6 . diff --git a/lib/libm/man/trunc.3 b/lib/libm/man/lrint.3 similarity index 54% copy from lib/libm/man/trunc.3 copy to lib/libm/man/lrint.3 index bf6c8eb6a2..26f0750042 100644 --- a/lib/libm/man/trunc.3 +++ b/lib/libm/man/lrint.3 @@ -1,4 +1,4 @@ -.\" Copyright (c) 2004, 2005 David Schultz +.\" Copyright (c) 2005 David Schultz .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -22,58 +22,83 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $NetBSD: trunc.3,v 1.5 2006/04/04 20:26:33 wiz Exp $ -.\" $FreeBSD: src/lib/msun/man/trunc.3,v 1.3 2005/06/15 19:04:04 ru Exp $ -.\" $DragonFly: src/lib/libm/man/trunc.3,v 1.1 2007/06/17 06:26:18 pavalos Exp $ +.\" $FreeBSD$ .\" -.Dd March 31, 2006 -.Dt TRUNC 3 +.Dd December 21, 2011 +.Dt LRINT 3 .Os .Sh NAME -.Nm trunc , -.Nm truncf -.\" .Nm truncl -.Nd "nearest integral value with magnitude less than or equal to |x|" +.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 double -.Fn trunc "double x" -.Ft float -.Fn truncf "float x" -.\" .Ft "long double" -.\" .Fn truncl "long double x" +.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 trunc -and -.Fn truncf -.\" .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 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 rintf -.\" .Fn rintl -respectively, in the -.Dv FP_RZ -rounding mode. +.Fn lrintl +functions differ from +.Fn lrint +only in their input and output types. .Sh SEE ALSO -.Xr ceil 3 , -.Xr floor 3 , -.Xr fpsetround 3 , +.Xr lround 3 , .Xr math 3 , -.Xr nextafter 3 , .Xr rint 3 , .Xr round 3 .Sh STANDARDS +These functions conform to +.St -isoC-99 . +.Sh HISTORY The -.Fn trunc +.Fn llrint , +.Fn llrintf , +.Fn lrint , and -.Fn truncf -.\" .Fn truncl -functions conform to -.St -isoC-99 . +.Fn lrintf +routines first appeared in +.Dx 1.3 . +The long double variants were introduced in +.Dx 2.13 . diff --git a/lib/libm/man/trunc.3 b/lib/libm/man/lround.3 similarity index 53% copy from lib/libm/man/trunc.3 copy to lib/libm/man/lround.3 index bf6c8eb6a2..ccbae2473c 100644 --- a/lib/libm/man/trunc.3 +++ b/lib/libm/man/lround.3 @@ -1,4 +1,4 @@ -.\" Copyright (c) 2004, 2005 David Schultz +.\" Copyright (c) 2005 David Schultz .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -22,58 +22,91 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $NetBSD: trunc.3,v 1.5 2006/04/04 20:26:33 wiz Exp $ -.\" $FreeBSD: src/lib/msun/man/trunc.3,v 1.3 2005/06/15 19:04:04 ru Exp $ -.\" $DragonFly: src/lib/libm/man/trunc.3,v 1.1 2007/06/17 06:26:18 pavalos Exp $ +.\" $FreeBSD$ .\" -.Dd March 31, 2006 -.Dt TRUNC 3 +.Dd December 21, 2011 +.Dt LROUND 3 .Os .Sh NAME -.Nm trunc , -.Nm truncf -.\" .Nm truncl -.Nd "nearest integral value with magnitude less than or equal to |x|" +.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 double -.Fn trunc "double x" -.Ft float -.Fn truncf "float x" -.\" .Ft "long double" -.\" .Fn truncl "long double x" +.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 trunc -and -.Fn truncf -.\" .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 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 rintf -.\" .Fn rintl -respectively, in the -.Dv FP_RZ -rounding mode. +.Fn lroundl +functions differ from +.Fn lround +only in their input and output types. .Sh SEE ALSO -.Xr ceil 3 , -.Xr floor 3 , -.Xr fpsetround 3 , +.Xr lrint 3 , .Xr math 3 , -.Xr nextafter 3 , .Xr rint 3 , .Xr round 3 .Sh STANDARDS The -.Fn trunc +.Fn llround , +.Fn llroundf , +.Fn llroundl , +.Fn lround , +.Fn lroundf , and -.Fn truncf -.\" .Fn truncl +.Fn lroundl functions conform to .St -isoC-99 . +.Sh HISTORY +The +.Vt float +and +.Vt double +versions of these routines first appeared in +.Dx 1.3 . +The +.Vt "long double" +versions appeared in +.Dx 2.13 . diff --git a/lib/libm/man/math.3 b/lib/libm/man/math.3 index c16d1bd7bc..2ea6e250a5 100644 --- a/lib/libm/man/math.3 +++ b/lib/libm/man/math.3 @@ -29,7 +29,7 @@ .\" .\" from: @(#)math.3 6.10 (Berkeley) 5/6/91 .\" -.Dd February 23, 2007 +.Dd December 21, 2011 .Dt MATH 3 .Os .Sh NAME @@ -75,6 +75,7 @@ Declarations for these functions may be obtained from the include file .It j0 Ta Xr j0 3 Ta Bessel function Ta ??? .It j1 Ta Xr j0 3 Ta Bessel function Ta ??? .It jn Ta Xr j0 3 Ta Bessel function Ta ??? +.It ldexp Ta Xr ldexp 3 Ta Multiply by power of 2 Ta ??? .It lgamma Ta Xr lgamma 3 Ta log gamma function Ta ??? .It log Ta Xr log 3 Ta natural logarithm Ta 1 .It log10 Ta Xr log 3 Ta logarithm to base 10 Ta 3 @@ -90,6 +91,7 @@ Declarations for these functions may be obtained from the include file .It sqrt Ta Xr sqrt 3 Ta square root Ta 1 .It tan Ta Xr tan 3 Ta trigonometric function Ta 3 .It tanh Ta Xr tanh 3 Ta hyperbolic function Ta 3 +.It tgamma Ta Xr tgamma 3 Ta True gamma function Ta 3 .It trunc Ta Xr trunc 3 Ta nearest integral value Ta 3 .It y0 Ta Xr j0 3 Ta Bessel function Ta ??? .It y1 Ta Xr j0 3 Ta Bessel function Ta ??? diff --git a/lib/libm/man/nextafter.3 b/lib/libm/man/nextafter.3 index c07006e154..1f87d0014a 100644 --- a/lib/libm/man/nextafter.3 +++ b/lib/libm/man/nextafter.3 @@ -1,6 +1,4 @@ -.\" $NetBSD: nextafter.3,v 1.4 2011/09/18 05:33:14 jruoho Exp $ -.\" -.\" Copyright (c) 2011 Jukka Ruohonen +.\" Copyright (c) 1985, 1991 Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -11,34 +9,35 @@ .\" 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. +.\" 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. .\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 +.\" $FreeBSD$ .\" -.Dd September 18, 2011 +.Dd December 21, 2011 .Dt NEXTAFTER 3 .Os .Sh NAME .Nm nextafter , .Nm nextafterf , .Nm nextafterl , -.Nm nexttoward -.\" -.\" XXX: Not yet implemented. -.\" -.\" .Nm nexttowardf , -.\" .Nm nexttowardl -.\" -.Nd next representable floating-point number +.Nm nexttoward , +.Nm nexttowardf +.Nd next representable value .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -51,76 +50,45 @@ .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" .Sh DESCRIPTION -The -.Fn nextafter , -.Fn nextafterf , -and -.Fn nextafterl -functions return the next machine representable number from -.Fa x -in direction of -.Fa y . -In other words, if -.Fa y -is less than -.Fa x , -the functions return the largest representable floating-point number less than -.Fa x . -When -.Fa x -equals -.Fa y , -the value of -.Fa y -is returned. -The three functions differ only in the type of the return value and -.Fa x . -.Pp -The -.Fn nexttoward -function is equivalent to the -.Fn nextafter -family of functions with two exceptions: -.Bl -enum -offset indent -.It -The second parameter has a type -.Vt long double . -.It -The return value is -.Fa y -converted to the type of the function, provided that +These functions +return the next machine representable number from .Fa x -equals +in direction .Fa y . -.El -.Sh RETURN VALUES -Upon successful completion, the described functions return -the next representable floating-point value as described above. -If -.Fa x -is finite but an overflow would occur, -a range error follows and the functions return -.Dv \*(Pm\*HHUGE_VAL , -.Dv \*(Pm\*HHUGE_VALF , -or -.Dv \*(Pm\*HHUGE_VALL -with the same sign as -.Fa x . -When either -.Fa x -or -.Fa y -is \*(Na, a \*(Na is returned. -When -.Fa x -is not -.Fa y -but the function value is subnormal, zero, or underflows, -a range error occurs, and either 0.0 or the correct function -value (if representable) is returned. .Sh SEE ALSO .Xr math 3 .Sh STANDARDS -The described functions conform to +The +.Fn nextafter , +.Fn nextafterf , +.Fn nextafterl , +.Fn nexttoward , +and +.Fn nexttowardf +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 . +.Fn nextafterl +appeared in +.Dx 2.13 . diff --git a/lib/libm/man/pow.3 b/lib/libm/man/pow.3 deleted file mode 100644 index 8c6ed50c7e..0000000000 --- a/lib/libm/man/pow.3 +++ /dev/null @@ -1,80 +0,0 @@ -.\" $NetBSD: pow.3,v 1.1 2011/09/17 10:51:53 jruoho Exp $ -.\" -.\" Copyright (c) 2011 Jukka Ruohonen -.\" 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 September 13, 2011 -.Dt POW 3 -.Os -.Sh NAME -.Nm pow , -.Nm powf -.Nd power functions -.Sh LIBRARY -.Lb libm -.Sh SYNOPSIS -.In math.h -.Ft double -.Fn pow "double x" "double y" -.Ft float -.Fn powf "float x" "float y" -.Sh DESCRIPTION -The -.Fn pow -family of functions return -.Fa x -raised to the power of -.Fa y . -.Pp -If -.Fa x -is negative and -.Fa y -is not an integer, the global variable -.Va errno -is set to -.Er EDOM , -and on -.Tn VAX -a reserved operand fault is generated. -A portable application should nevertheless ensure that -.Fa y -is an integer value whenever -.Fa x -is negative. -.Sh RETURN VALUES -.\" -.\" XXX: List also the special return values? -.\" -Upon successful completion, the described functions return -.Fa x^y . -.Sh SEE ALSO -.Xr exp 3 , -.Xr log 3 -.Sh STANDARDS -The described functions conform to -.St -isoC-99 . -.Sh HISTORY -The history of the power functions dates back to -.At v6 . diff --git a/lib/libm/man/remainder.3 b/lib/libm/man/remainder.3 index 6ce63beff9..a5c01c7ad4 100644 --- a/lib/libm/man/remainder.3 +++ b/lib/libm/man/remainder.3 @@ -1,6 +1,4 @@ -.\" $NetBSD: remainder.3,v 1.2 2011/09/18 05:33:14 jruoho Exp $ -.\" -.\" Copyright (c) 2011 Jukka Ruohonen +.\" Copyright (c) 1985, 1991 Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -11,28 +9,36 @@ .\" 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. +.\" 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. .\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 +.\" $FreeBSD$ .\" -.Dd September 18, 2011 +.Dd December 21, 2011 .Dt REMAINDER 3 .Os .Sh NAME .Nm remainder , .Nm remainderf , +.Nm remainderl , .Nm remquo , -.Nm remquof -.Nd remainder functions +.Nm remquof , +.Nm remquol +.Nd minimal residue functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -41,104 +47,108 @@ .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 -Provided that -.Fa y -\*(Ne 0 , -the -.Fn remainder +.Fn remainder , +.Fn remainderf , +.Fn remainderl , +.Fn remquo , +.Fn remquof , and -.Fn remainderf -functions calculate the floating-point remainder +.Fn remquol +return the remainder .Fa r -of -.Bd -ragged -offset indent -.Va r -= -.Va x - ny , -.Ed -.Pp +:= +.Fa x +\- +.Fa n\(**y where .Fa n -is the integral value nearest to the exact value of -.Fa x -/ -.Fa y . -If -.Bd -ragged -offset indent -.Va | n -- -.Va x / y | -= 1/2 , -.Ed -.Pp -the value +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 chosen to be even. -Consequently, the remainder is computed exactly and -.Va | r | +is even. +Consequently +the remainder is computed exactly and +.Sm off +.Pf \*(Ba Fa r No \*(Ba +.Sm on \*(Le -.Fa | y | -/ 2 . -.Pp -Also the -.Fn remquo -and -.Fn remquof -functions calculate the remainder as described above. -But these additionally use -.Fa quo -to store a value whose sign is the sign of -.Va x / y -and whose magnitude is congruent modulo -.Va 2^k -to the magnitude of the integral quotient of -.Va x / y , -where -.Fa k -is an implementation-defined integer greater than or equal to 3. -.Pp -The rationale of the -.Fn remquo -family of functions relates to situations where -only few bits of the quotient are required. -The exact representation of the quotient may not be meaningful when -.Fa x -is large in magnitude compared to -.Fa y . -.Sh RETURN VALUES -The functions return the remainder independent of the rounding mode. -If -.Fa y -is zero , -\*(Na -is returned and a domain error occurs. -A domain error occurs and a -\*(Na -is returned also when -.Fa x -is infinite but +.Sm off +.Pf \*(Ba Fa y No \*(Ba/2 . +.Sm on +But attempting to take the remainder when .Fa y -is not a -\*(Na. -If either +is 0 or .Fa x -or -.Fa y -is -\*(Na, -a -\*(Na -is always returned. +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 div 3 , -.\".Xr fast_remainder32 3 , .Xr fmod 3 , .Xr math 3 .Sh STANDARDS -The described functions conform to +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 , +.Fn remquof , +.Fn remquol , +and +.Fn remainderl +were added in +.Dx 2.13 . diff --git a/lib/libm/man/rint.3 b/lib/libm/man/rint.3 index 5f8fe26794..363240376a 100644 --- a/lib/libm/man/rint.3 +++ b/lib/libm/man/rint.3 @@ -26,16 +26,18 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)rint.3 5.1 (Berkeley) 5/2/91 -.\" $NetBSD: rint.3,v 1.12 2003/08/07 16:44:48 agc Exp $ +.\" $FreeBSD$ .\" -.Dd November 28, 2009 +.Dd December 21, 2011 .Dt RINT 3 .Os .Sh NAME .Nm nearbyint , .Nm nearbyintf , +.Nm nearbyintl , .Nm rint , -.Nm rintf +.Nm rintf , +.Nm rintl .Nd round to integral value in floating-point format .Sh LIBRARY .Lb libm @@ -45,32 +47,56 @@ .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 -function returns the integral value (represented as a double precision number) -nearest to +.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 nearbyint , +.Fn nearbyintf , and -.Fn nearbyintf +.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 math 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 +.Dx 2.5 , +and the long double variants were first available in +.Fx 2.13 . diff --git a/lib/libm/man/round.3 b/lib/libm/man/round.3 index 1d1519750a..f7efe0843f 100644 --- a/lib/libm/man/round.3 +++ b/lib/libm/man/round.3 @@ -24,14 +24,15 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/msun/man/round.3,v 1.2 2004/06/20 09:27:17 das Exp $ +.\" $FreeBSD$ .\" -.Dd July 15, 2004 +.Dd December 21, 2011 .Dt ROUND 3 .Os .Sh NAME .Nm round , -.Nm roundf +.Nm roundf , +.Nm roundl .Nd round to nearest integral value .Sh LIBRARY .Lb libm @@ -41,11 +42,14 @@ .Fn round "double x" .Ft float .Fn roundf "float x" +.Ft "long double" +.Fn roundl "long double x" .Sh DESCRIPTION The -.Fn round +.Fn round , +.Fn roundf , and -.Fn roundf +.Fn roundl functions return the nearest integral value to .Fa x ; if @@ -56,15 +60,13 @@ absolute value (i.e., they round away from zero). .Sh SEE ALSO .Xr ceil 3 , .Xr floor 3 , +.Xr lrint 3 , +.Xr lround 3 , .Xr math 3 , .Xr rint 3 , .Xr trunc 3 .Sh STANDARDS -The -.Fn round -and -.Fn roundf -functions conform to +These functions conform to .St -isoC-99 . .Sh HISTORY The @@ -72,4 +74,8 @@ The and .Fn roundf functions appeared in -.Nx 2.0 . +.Dx 1.3 . +The +.Fn roundl +function appeared in +.Dx 2.13 . diff --git a/lib/libm/man/scalbn.3 b/lib/libm/man/scalbn.3 index 8b2e2e5351..57f6f228e4 100644 --- a/lib/libm/man/scalbn.3 +++ b/lib/libm/man/scalbn.3 @@ -1,6 +1,4 @@ -.\" $NetBSD: scalbn.3,v 1.2 2011/09/18 05:33:14 jruoho Exp $ -.\" -.\" Copyright (c) 2011 Jukka Ruohonen +.\" Copyright (c) 1985, 1991 Regents of the University of California. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -11,97 +9,89 @@ .\" 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. +.\" 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. .\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +.\" from: @(#)ieee.3 6.4 (Berkeley) 5/6/91 +.\" FreeBSD SVN: 165906 (2007-01-09) .\" -.Dd September 18, 2011 +.Dd December 21, 2011 .Dt SCALBN 3 .Os .Sh NAME +.Nm scalbln , +.Nm scalblnf , +.Nm scalblnl , .Nm scalbn , .Nm scalbnf , -.Nm scalbnl -.Nd exponent using FLT_RADIX +.Nm scalbnl , +.Nm ldexp , +.Nm ldexpf , +.Nm ldexpl +.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" +.Ft double +.Fn ldexp "double x" "int n" +.Ft float +.Fn ldexpf "float x" "int n" +.Ft long double +.Fn ldexpl "long double x" "int n" .Sh DESCRIPTION -The -.Fn scalbn , -.Fn scalbnf , -and -.Fn scalbnl -functions compute -.Fa x -* -.Fa r^n , -where -.Fa r -is the radix of the machine's floating point arithmetic, defined by the -.Dv FLT_RADIX -constant in -.In float.h . -The rationale is efficiency; -.Fa r^n -is not computed explicitly. -.Sh RETURN VALUES -As described above, upon successful completion, the described functions return -the exponent computed using -.Dv FLT_RADIX . -Otherwise the following may occur: -.Bl -enum -offset indent -.It -When the result would cause an overflow, a range error occurs and -.Dv \*(Pm\*HHUGE_VAL , -.Dv \*(Pm\*HHUGE_VALF , -or -.Dv \*(Pm\*HHUGE_VALL -is returned according to the sign of -.Fa x -and the return type of the corresponding function. -.It -When the correct value would cause an underflow -and it is not representable, a range error occurs and -either 0.0 or an implementation-defined value is returned. -When an underflow occurs but the correct value is representable, -a range error occurs but the correct value is returned. -.It -If -.Fa x -is \*(Pm0 or \*(Pm\Inf, -.Fa x -is returned. -Likewise, if -.Fa n -is zero, -.Fa x -is returned. -If -.Fa x -is \*(Na, \*(Na is returned. -.El +These routines return +.Fa x Ns \(**(2** Ns Fa n ) +computed by exponent manipulation. .Sh SEE ALSO .Xr exp 3 , .Xr frexp 3 , -.Xr ldexp 3 , .Xr math 3 .Sh STANDARDS -The described functions conform to -.St -isoC-99 . +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 , +.Fn scalblnf , +.Fn scalblnl +and +.Fn scalbln +first appeared in +.Dx 2.13 . diff --git a/lib/libm/man/sin.3 b/lib/libm/man/sin.3 index d7a4d373ed..91cc0cfeaa 100644 --- a/lib/libm/man/sin.3 +++ b/lib/libm/man/sin.3 @@ -1,6 +1,7 @@ .\" Copyright (c) 1991 The Regents of the University of California. .\" All rights reserved. .\" +.\" @(#)sin.3 6.7 (Berkeley) 4/19/91 .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -26,16 +27,16 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)sin.3 6.7 (Berkeley) 4/19/91 -.\" $NetBSD: sin.3,v 1.14 2003/08/07 16:44:49 agc Exp $ -.\" $DragonFly: src/lib/libm/man/sin.3,v 1.1 2005/07/26 21:15:20 joerg Exp $ +.\" $FreeBSD$ .\" -.Dd April 19, 1991 +.Dd December 21, 2011 .Dt SIN 3 .Os .Sh NAME .Nm sin , -.Nm sinf -.Nd sine function +.Nm sinf , +.Nm sinl +.Nd sine functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -44,23 +45,32 @@ .Fn sin "double x" .Ft float .Fn sinf "float x" +.Ft long double +.Fn sinl "long double x" .Sh DESCRIPTION The -.Fn sin -function computes the sine of +.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 -function returns the sine value. +.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 csin 3 , .Xr cos 3 , .Xr cosh 3 , .Xr math 3 , @@ -68,7 +78,5 @@ function returns the sine value. .Xr tan 3 , .Xr tanh 3 .Sh STANDARDS -The -.Fn sin -function conforms to -.St -ansiC . +These functions conform to +.St -isoC-99 . diff --git a/lib/libm/man/sinh.3 b/lib/libm/man/sinh.3 index 263dd6039a..5e0cff788d 100644 --- a/lib/libm/man/sinh.3 +++ b/lib/libm/man/sinh.3 @@ -26,10 +26,8 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)sinh.3 6.6 (Berkeley) 4/19/91 -.\" $NetBSD: sinh.3,v 1.14 2003/08/07 16:44:49 agc Exp $ -.\" $DragonFly: src/lib/libm/man/sinh.3,v 1.1 2005/07/26 21:15:20 joerg Exp $ -.\" -.Dd April 19, 1991 +.\" $FreeBSD$ +.Dd December 21, 2011 .Dt SINH 3 .Os .Sh NAME @@ -47,7 +45,9 @@ .Sh DESCRIPTION The .Fn sinh -function computes the hyperbolic sine of +and the +.Fn sinhf +functions compute the hyperbolic sine of .Fa x . .Sh RETURN VALUES The @@ -66,6 +66,7 @@ is set to .Xr atan2 3 , .Xr cos 3 , .Xr cosh 3 , +.Xr csinh 3 , .Xr math 3 , .Xr sin 3 , .Xr tan 3 , @@ -74,4 +75,4 @@ is set to The .Fn sinh function conforms to -.St -ansiC . +.St -isoC . diff --git a/lib/libm/man/sqrt.3 b/lib/libm/man/sqrt.3 index c1c6e1cbe6..a9a8571396 100644 --- a/lib/libm/man/sqrt.3 +++ b/lib/libm/man/sqrt.3 @@ -26,17 +26,18 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)sqrt.3 6.4 (Berkeley) 5/6/91 -.\" $NetBSD: sqrt.3,v 1.13 2003/08/07 16:44:49 agc Exp $ -.\" $DragonFly: src/lib/libm/man/sqrt.3,v 1.2 2005/12/28 13:35:02 swildner Exp $ +.\" $FreeBSD$ .\" -.Dd May 6, 1991 +.Dd December 21, 2011 .Dt SQRT 3 .Os .Sh NAME .Nm cbrt , .Nm cbrtf , +.Nm cbrtl , .Nm sqrt , -.Nm sqrtf +.Nm sqrtf , +.Nm sqrtl .Nd cube root and square root functions .Sh LIBRARY .Lb libm @@ -46,48 +47,78 @@ .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 cbrt , +.Fn cbrtf , and -.Fn cbrtf +.Fn cbrtl functions compute the cube root of .Ar x . .Pp The -.Fn sqrt +.Fn sqrt , +.Fn sqrtf , and -.Fn sqrtf -functions compute -the non-negative square root of x. +.Fn sqrtl +functions compute the +non-negative square root of +.Ar x . .Sh RETURN VALUES -If x is negative, -.Fn sqrt "x" +The +.Fn cbrt , +.Fn cbrtf , +and +.Fn cbrtl +functions return the requested cube root. +The +.Fn sqrt , +.Fn sqrtf , and -.Fn sqrtf "x" -.\" POSIX_MODE -set the global variable -.Va errno -to -.Er EDOM . -.\" SYSV_MODE -.\" call -.\" .Xr matherr 3 . +.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 -.\" .Xr matherr 3 .Sh STANDARDS The -.Fn sqrt -function conforms to -.St -ansiC . +.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 +.Fn sqrt , +.Fn sqrtf , +.Fn cbrt , +and +.Fn cbrtf +functions appeared in .Bx 4.3 . +The +.Fn sqrtl +and the +.Fn cbrtl +function appeared in +.Dx 2.13 . diff --git a/lib/libm/man/tan.3 b/lib/libm/man/tan.3 index c28df3ec9e..b325eb2ef4 100644 --- a/lib/libm/man/tan.3 +++ b/lib/libm/man/tan.3 @@ -26,16 +26,16 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)tan.3 5.1 (Berkeley) 5/2/91 -.\" $NetBSD: tan.3,v 1.13 2003/08/07 16:44:49 agc Exp $ -.\" $DragonFly: src/lib/libm/man/tan.3,v 1.1 2005/07/26 21:15:20 joerg Exp $ +.\" $FreeBSD$ .\" -.Dd May 2, 1991 +.Dd December 21, 2011 .Dt TAN 3 .Os .Sh NAME .Nm tan , -.Nm tanf -.Nd tangent function +.Nm tanf , +.Nm tanl +.Nd tangent functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -44,11 +44,14 @@ .Fn tan "double x" .Ft float .Fn tanf "float x" +.Ft long double +.Fn tanl "long double x" .Sh DESCRIPTION The -.Fn tan +.Fn tan , +.Fn tanf , and -.Fn tanf +.Fn tanl functions compute the tangent of .Fa x (measured in radians). @@ -58,8 +61,11 @@ For a discussion of error due to roundoff, see .Xr math 3 . .Sh RETURN VALUES The -.Fn tan -function returns the tangent value. +.Fn tan , +.Fn tanf , +and +.Fn tanl +functions return the tangent value. .Sh SEE ALSO .Xr acos 3 , .Xr asin 3 , @@ -67,12 +73,11 @@ function returns the tangent value. .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 -The -.Fn tan -function conforms to -.St -ansiC . +These functions conform to +.St -isoC-99 . diff --git a/lib/libm/man/tanh.3 b/lib/libm/man/tanh.3 index cb79ba4e2c..78e504cb24 100644 --- a/lib/libm/man/tanh.3 +++ b/lib/libm/man/tanh.3 @@ -26,7 +26,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)tanh.3 5.1 (Berkeley) 5/2/91 -.\" $NetBSD: tanh.3,v 1.15 2011/11/17 23:46:32 wiz Exp $ +.\" $FreeBSD$ .\" .Dd September 18, 2011 .Dt TANH 3 @@ -34,7 +34,7 @@ .Sh NAME .Nm tanh , .Nm tanhf -.Nd hyperbolic tangent function +.Nd hyperbolic tangent functions .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -46,41 +46,18 @@ .Sh DESCRIPTION The .Fn tanh -and +and the .Fn tanhf functions compute the hyperbolic tangent of .Fa x . For a discussion of error due to roundoff, see .Xr math 3 . .Sh RETURN VALUES -Upon successful completion, -these functions return the hyperbolic tangent value. -The following may also occur: -.Bl -enum -offset indent -.It -If -.Fa x -is \*(Pm 0, -.Fa x -is returned. -.It -If -.Fa x -is \*(Na, a \*(Na is returned. -.It -If -.Fa x -is positive infinity, a value 1 is returned; -if -.Fa x -is negative infinity, -1 is returned. -.It -If -.Fa x -is subnormal, a range error can occur and -.Fa x -is returned. -.El +The +.Fn tanh +and the +.Fn tanhf +functions return the hyperbolic tangent value. .Sh SEE ALSO .Xr acos 3 , .Xr asin 3 , @@ -88,10 +65,13 @@ is returned. .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 described functions conform to -.St -isoC-99 . +The +.Fn tanh +function conforms to +.St -isoC . diff --git a/lib/libm/man/trunc.3 b/lib/libm/man/trunc.3 index bf6c8eb6a2..9bd784fad8 100644 --- a/lib/libm/man/trunc.3 +++ b/lib/libm/man/trunc.3 @@ -22,18 +22,16 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $NetBSD: trunc.3,v 1.5 2006/04/04 20:26:33 wiz Exp $ -.\" $FreeBSD: src/lib/msun/man/trunc.3,v 1.3 2005/06/15 19:04:04 ru Exp $ -.\" $DragonFly: src/lib/libm/man/trunc.3,v 1.1 2007/06/17 06:26:18 pavalos Exp $ +.\" $FreeBSD$ .\" -.Dd March 31, 2006 +.Dd December 21, 2011 .Dt TRUNC 3 .Os .Sh NAME .Nm trunc , -.Nm truncf -.\" .Nm truncl -.Nd "nearest integral value with magnitude less than or equal to |x|" +.Nm truncf , +.Nm truncl +.Nd nearest integral value with magnitude less than or equal to |x| .Sh LIBRARY .Lb libm .Sh SYNOPSIS @@ -42,38 +40,43 @@ .Fn trunc "double x" .Ft float .Fn truncf "float x" -.\" .Ft "long double" -.\" .Fn truncl "long double x" +.Ft "long double" +.Fn truncl "long double x" .Sh DESCRIPTION The -.Fn trunc +.Fn trunc , +.Fn truncf , and -.Fn truncf -.\" .Fn truncl +.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 rint , +.Fn rintf , and -.Fn rintf -.\" .Fn rintl +.Fn rintl , respectively, in the -.Dv FP_RZ +.Dv FE_TOWARDZERO rounding mode. .Sh SEE ALSO .Xr ceil 3 , +.Xr fesetround 3 , .Xr floor 3 , -.Xr fpsetround 3 , .Xr math 3 , .Xr nextafter 3 , .Xr rint 3 , .Xr round 3 .Sh STANDARDS The -.Fn trunc +.Fn trunc , +.Fn truncf , and -.Fn truncf -.\" .Fn truncl +.Fn truncl functions conform to .St -isoC-99 . +.Sh HISTORY +These routines first appeared in +.Dx 1.9 . +The long double version appeared in +.Dx 2.13 . \ No newline at end of file -- 2.41.0