summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/head/math.h7
-rw-r--r--usr/src/man/man3m/scalb.3m335
-rw-r--r--usr/src/test/libc-tests/cfg/symbols/math_h.cfg7
3 files changed, 217 insertions, 132 deletions
diff --git a/usr/src/head/math.h b/usr/src/head/math.h
index caa29df4d3..3cf2d96571 100644
--- a/usr/src/head/math.h
+++ b/usr/src/head/math.h
@@ -25,6 +25,9 @@
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright 2014 Garrett D'Amore <garrett@damore.org>
+ */
#ifndef _MATH_H
#define _MATH_H
@@ -178,9 +181,11 @@ extern double yn(int, double);
_XOPEN_SOURCE - 0 >= 500 || \
defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1
/*
- * SVID & XPG 4.2/5
+ * SVID & XPG 4.2/5 - removed from XPG7.
*/
+#if !defined(_STRICT_SYMBOLS) || !defined(_XPG7)
extern double scalb(double, double);
+#endif
#if defined(__MATHERR_ERRNO_DONTCARE)
#pragma does_not_read_global_data(scalb)
diff --git a/usr/src/man/man3m/scalb.3m b/usr/src/man/man3m/scalb.3m
index 95e895d57d..ed038d8f2d 100644
--- a/usr/src/man/man3m/scalb.3m
+++ b/usr/src/man/man3m/scalb.3m
@@ -43,137 +43,216 @@
.\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
.\" Copyright (c) 2001, The IEEE and The Open Group. All Rights Reserved.
.\" Portions Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
-.\"
-.TH SCALB 3M "Jul 12, 2006" "SunOS 5.11" "Mathematical Library Functions"
-.SH NAME
-scalb, scalbf, scalbl \- load exponent of a radix-independent floating-point
-number
-.SH SYNOPSIS
-.LP
-.nf
-c99 [ \fIflag\fR... ] \fIfile\fR... \fB-lm\fR [ \fIlibrary\fR... ]
-#include <math.h>
-
-\fBdouble\fR \fBscalb\fR(\fBdouble\fR \fIx\fR, \fBdouble\fR \fIn\fR);
-.fi
-
-.LP
-.nf
-\fBfloat\fR \fBscalbf\fR(\fBfloat\fR \fIx\fR, \fBfloat\fR \fIn\fR);
-.fi
-
-.LP
-.nf
-\fBlong double\fR \fBscalbl\fR(\fBlong double\fR \fIx\fR, \fBlong double\fR \fIn\fR);
-.fi
-
-.SH DESCRIPTION
-.sp
-.LP
-These functions compute x * \fIr\fR^n, where \fIr\fR is the radix of the
-machine's floating point arithmetic. When \fIr\fR is 2, \fBscalb()\fR is
-equivalent to \fBldexp\fR(3M). The value of \fIr\fR is \fBFLT_RADIX\fR which is
-defined in <\fBfloat.h\fR>.
-.SH RETURN VALUES
-.sp
-.LP
-Upon successful completion, the \fBscalb()\fR function returns \fIx\fR *
-\fIr\fR^n.
-.sp
-.LP
-If \fIx\fR or \fIn\fR is NaN, a NaN is returned.
-.sp
-.LP
-If \fIn\fR is 0, \fIx\fR is returned.
-.sp
-.LP
-If \fIx\fR is \(+-Inf and \fIn\fR is not \(miInf, \fIx\fR is returned.
-.sp
-.LP
-If \fIx\fR is \(+-0 and \fIn\fR is not +Inf, \fIx\fR is returned.
-.sp
-.LP
-If \fIx\fR is \(+-0 and \fIn\fR is +Inf, a domain error occurs and a NaN is
-returned.
-.sp
-.LP
-If \fIx\fR is \(+-Inf and \fIn\fR is \(miInf, a domain error occurs and a NaN
+.\" Portions Copyright 2019 Garrett D'Amore <garrett@damore.org>
+.Dd Jul 05, 2019
+.Dt SCALB 3M
+.Os
+.Sh NAME
+.Nm scalb ,
+.Nm scalbf ,
+.Nm scalbl
+.Nd load exponent of a radix-independent floating-point number
+.Sh SYNOPSIS
+.Ic c99 Oo Ar flag Ns ... Oc Ar file Ns ... Fl lm Op Ar library Ns ...
+.Pp
+.In math.h
+.
+.Ft double
+.Fo scalb
+.Fa "double x"
+.Fa "double n"
+.Fc
+.
+.Ft float
+.Fo scalbf
+.Fa "float x"
+.Fa "float n"
+.Fc
+.
+.Ft "long double"
+.Fo scalbl
+.Fa "long double x"
+.Fa "long double n"
+.Fc
+.
+.Sh DESCRIPTION
+These functions compute
+.Fa x No * Va r Ns No ^ Ns Fa n ,
+where
+.Va r
+is the radix of the machine's floating point arithmetic.
+When
+.Va r
+is 2,
+.Fn scalb
+is equivalent to
+.Xr ldexp 3M .
+The value of
+.Va r
+is
+.Dv FLT_RADIX
+which is
+defined in
+.In float.h .
+.Sh RETURN VALUES
+Upon successful completion, the
+.Fn scalb
+function returns
+.Fa x No * Va r Ns No ^ Ns Fa n .
+.Pp
+If
+.Fa x
+or
+.Fa n
+is
+.Sy NaN ,
+a
+.Sy NaN
+is returned.
+.Lp
+If
+.Fa n
+is 0,
+.Fa x
is returned.
-.sp
-.LP
+.Lp
+If
+.Fa x
+is
+.Sy \(+-Inf
+and
+.Fa n
+is not
+.Sy \(miInf ,
+.Fa x
+is returned.
+.Lp
+If
+.Fa x
+is \(+-0 and
+.Fa n
+is not
+.Sy +Inf ,
+.Fa x
+is returned.
+.Lp
+If
+.Fa x
+is \(+-0 and
+.Fa n
+is
+.Sy +Inf ,
+a domain error occurs and a
+.Sy NaN
+is returned.
+.Lp
+If
+.Fa x
+is
+.Sy \(+-Inf
+and
+Fa n
+is
+.Sy \(miInf ,
+a domain error occurs and a
+.Sy NaN
+is returned.
+.Lp
If the result would cause an overflow, a range error occurs and
-\(+-\fBHUGE_VAL\fR (according to the sign of \fIx\fR) is returned.
-.sp
-.LP
-For exceptional cases, \fBmatherr\fR(3M) tabulates the values to be returned by
-\fBscalb()\fR as specified by SVID3 and XPG3. See \fBstandards\fR(5).
-.SH ERRORS
-.sp
-.LP
+.Dv \(+-HUGE_VAL
+(according to the sign of
+.Fa x )
+is returned.
+.Lp
+For exceptional cases,
+.Xr matherr 3M
+tabulates the values to be returned by
+.Fn scalb
+as specified by SVID3 and XPG3.
+See
+.Xr standards 5 .
+.
+.Sh ERRORS
+.
These functions will fail if:
-.sp
-.ne 2
-.mk
-.na
-\fBDomain Error\fR
-.ad
-.RS 16n
-.rt
-If \fIx\fR is 0 and \fIn\fR is +Inf, or \fIx\fR is Inf and \fIn\fR is \(miInf.
-.sp
-If the integer expression (\fBmath_errhandling\fR & \fBMATH_ERREXCEPT\fR) is
-non-zero, then the invalid floating-point exception is raised.
-.RE
-
-.sp
-.ne 2
-.mk
-.na
-\fBRange Error\fR
-.ad
-.RS 16n
-.rt
+.
+.Bl -tag -width Sy
+.It Sy Domain Error
+If
+.Fa x
+is 0 and
+.Fa n
+is
+.Sy +Inf ,
+or
+.Fa x
+is
+.Sy Inf
+and
+.Fa n
+is
+.Sy \(miInf .
+.Lp
+If the integer expression
+.Po Va math_errhandling No & Dv MATH_ERREXCEPT Pc
+.\" (\fBmath_errhandling\fR & \fBMATH_ERREXCEPT\fR)
+is non-zero, then the invalid floating-point exception is raised.
+.
+.It Sy Range Error
The result would overflow.
-.sp
-If the integer expression (\fBmath_errhandling\fR & \fBMATH_ERREXCEPT\fR) is
-non-zero, then the overflow floating-point exception is raised.
-.RE
-
-.SH USAGE
-.sp
-.LP
+.Lp
+If the integer expression
+.Po Va math_errhandling No & Dv MATH_ERREXCEPT Pc
+is non-zero, then the overflow floating-point exception is raised.
+.El
+.
+.Sh USAGE
An application wanting to check for exceptions should call
-\fBfeclearexcept\fR(\fBFE_ALL_EXCEPT\fR) before calling these functions. On
-return, if \fBfetestexcept\fR(\fBFE_INVALID\fR | \fBFE_DIVBYZERO\fR |
-\fBFE_OVERFLOW\fR | \fBFE_UNDERFLOW\fR) is non-zero, an exception has been
-raised. An application should either examine the return value or check the
+.Fn feclearexcept FE_ALL_EXCEPT
+before calling these functions.
+On return, if
+.Fn fetestexcept "FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW"
+is non-zero, an exception has been raised.
+An application should either examine the return value or check the
floating point exception flags to detect exceptions.
-.SH ATTRIBUTES
-.sp
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-tab( ) box;
-cw(2.75i) |cw(2.75i)
-lw(2.75i) |lw(2.75i)
-.
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-Interface Stability See below.
-_
-MT-Level MT-Safe
-.TE
-
-.sp
-.LP
-The \fBscalb()\fR function is Standard. The \fBscalbf()\fR and \fBscalbl()\fR
-functions are Stable.
-.SH SEE ALSO
-.sp
-.LP
-\fBfeclearexcept\fR(3M), \fBfetestexcept\fR(3M), \fBilogb\fR(3M),
-\fBldexp\fR(3M), \fBlogb\fR(3M), \fBmath.h\fR(3HEAD), \fBmatherr\fR(3M),
-\fBscalbln\fR(3M), \fBattributes\fR(5), \fBstandards\fR(5)
+.
+.Lp
+.
+These functions are
+.Sy Obsolete .
+The
+.Xr scalbln 3M ,
+.Xr scalblnf 3M ,
+or
+.Xr scalblnl 3M
+functions should be used instead.
+.
+.Sh MT-LEVEL
+.
+.Sy MT-Safe .
+.
+.Sh INTERFACE STABILITY
+.
+The
+.Fn scalb
+function is
+.Sy Obsolete Standard .
+The
+.Fn scalbf
+and
+.Fn scalbl
+functions are
+.Sy Obsolete Committed .
+.
+.Sh SEE ALSO
+.
+.Xr math.h 3HEAD ,
+.Xr feclearexcept 3M ,
+.Xr fetestexcept 3M ,
+.Xr ilogb 3M ,
+.Xr ldexp 3M ,
+.Xr logb 3M ,
+.Xr matherr 3M ,
+.Xr scalbln 3M ,
+.Xr attributes 5 ,
+.Xr standards 5
diff --git a/usr/src/test/libc-tests/cfg/symbols/math_h.cfg b/usr/src/test/libc-tests/cfg/symbols/math_h.cfg
index 60a219c431..d7a8cc0261 100644
--- a/usr/src/test/libc-tests/cfg/symbols/math_h.cfg
+++ b/usr/src/test/libc-tests/cfg/symbols/math_h.cfg
@@ -10,7 +10,7 @@
#
#
-# Copyright 2015 Garrett D'Amore <garrett@damore.org>
+# Copyright 2019 Garrett D'Amore <garrett@damore.org>
#
#
@@ -33,5 +33,6 @@ value | FP_NAN | int | math.h | C99+
#
# Functions
#
-func | cos | double | double | math.h | ALL
-func | cosf | float | float | math.h | -ALL +C99+
+func | cos | double | double | math.h | ALL
+func | cosf | float | float | math.h | -ALL +C99+
+func | scalb | double | double; double | math.h | -POSIX+ +SUS+ -SUSv4+