add Berkeley specific copyright notices
[unix-history] / usr / src / lib / libc / gen / frexp.3
... / ...
CommitLineData
1.\" @(#)frexp.3 6.3 (Berkeley) %G%
2.\"
3.TH FREXP 3 ""
4.AT 3
5.SH NAME
6frexp, ldexp, modf \- split into mantissa and exponent
7.SH SYNOPSIS
8.nf
9.B double frexp(value, eptr)
10.B double value;
11.B int *eptr;
12.PP
13.B double ldexp(value, exp)
14.B double value;
15.PP
16.B double modf(value, iptr)
17.B double value, *iptr;
18.SH DESCRIPTION
19Every nonzero number can be written uniquely as
20.if t \fIx\fP\|\(**\|2\u\fIn\fP\d,
21.if n \fIx\fP * 2^\fIn\fP,
22where the ``mantissa'' (fraction) \fIx\fP is in the range 0.5 <= |x| < 1.0,
23and the ``exponent'' \fIn\fP is an integer. \fIFrexp\fP returns the
24mantissa of a double \fIvalue\fP, and stores the exponent indirectly in
25the location pointed to by \fIeptr\fP. If \fIvalue\fP is 0, both results
26returned by \fIfrexp\fP are 0.
27.PP
28\fILdexp\fP returns the quantity
29.if t \fIvalue\|\(**\|2\u\fIexp\fP\d.
30.if n \fIvalue\fP * 2^\fIexp\fP.
31.PP
32\fIModf\fP returns the signed fractional part of \fIvalue\fP
33and stores the integer part indirectly in the location pointed
34to by \fIiptr\fP.
35.SH DIAGNOSTICS
36If \fIldexp\fP would cause overflow, \fBHUGE\fP is returned
37and \fIerrno\fP is set to \fBERANGE\fP.