BSD 4_3_Net_2 release
[unix-history] / usr / src / lib / libc / gen / frexp.3
index 338541e..1faca53 100644 (file)
@@ -1,37 +1,85 @@
-.\"    @(#)frexp.3     6.3 (Berkeley) 4/13/87
+.\" Copyright (c) 1991 The Regents of the University of California.
+.\" All rights reserved.
 .\"
 .\"
-.TH FREXP 3 "April 13, 1987"
-.AT 3
-.SH NAME
-frexp, ldexp, modf \- split into mantissa and exponent
-.SH SYNOPSIS
-.nf
-.B double frexp(value, eptr)
-.B double value;
-.B int *eptr;
-.PP
-.B double ldexp(value, exp)
-.B double value;
-.PP
-.B double modf(value, iptr)
-.B double value, *iptr;
-.SH DESCRIPTION
-Every nonzero number can be written uniquely as
-.if t \fIx\fP\|\(**\|2\u\fIn\fP\d,
-.if n \fIx\fP * 2^\fIn\fP,
-where the ``mantissa'' (fraction) \fIx\fP is in the range 0.5 <= |x| < 1.0,
-and the ``exponent'' \fIn\fP is an integer.  \fIFrexp\fP returns the
-mantissa of a double \fIvalue\fP, and stores the exponent indirectly in
-the location pointed to by \fIeptr\fP.  If \fIvalue\fP is 0, both results
-returned by \fIfrexp\fP are 0.
-.PP
-\fILdexp\fP returns the quantity
-.if t \fIvalue\|\(**\|2\u\fIexp\fP\d.
-.if n \fIvalue\fP * 2^\fIexp\fP.
-.PP
-\fIModf\fP returns the signed fractional part of \fIvalue\fP
-and stores the integer part indirectly in the location pointed
-to by \fIiptr\fP.
-.SH DIAGNOSTICS
-If \fIldexp\fP would cause overflow, \fBHUGE\fP is returned
-and \fIerrno\fP is set to \fBERANGE\fP.
+.\" This code is derived from software contributed to Berkeley by
+.\" the American National Standards Committee X3, on Information
+.\" Processing Systems.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"    This product includes software developed by the University of
+.\"    California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"     @(#)frexp.3    6.5 (Berkeley) 6/29/91
+.\"
+.Dd June 29, 1991
+.Dt FREXP 3
+.Os
+.Sh NAME
+.Nm frexp
+.Nd convert floating-point number to fractional and integral components
+.Sh SYNOPSIS
+.Fd #include <math.h>
+.Ft double
+.Fn frexp "double value" "int *exp"
+.Sh DESCRIPTION
+The
+.Fn frexp
+function breaks a floating-point number into a normalized
+fraction and an integral power of 2.
+It stores the integer in the
+.Em int
+object pointed to by
+.Fa exp .
+.Sh RETURN VALUES
+The
+.Fn frexp
+function returns the value
+.Em x ,
+such that
+.Em x
+is a 
+.Em double
+with magnitude in the interval
+.Bq 1/2 , 1
+or zero, and
+.Fa value
+equals
+.Em x
+times 2 raised to the power
+.Fa *exp .
+If
+.Fa value
+is zero, both parts of the result are zero. 
+.Sh SEE ALSO
+.Xr ldexp 3 ,
+.Xr modf 3 ,
+.Xr math 3
+.Sh STANDARDS
+The
+.Fn frexp
+function conforms to
+.St -ansiC .