'\"macro stdmacro
.if n .pH g3c.frexp @(#)frexp	40.11 of 10/26/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} frexp 3C "C Programming Language Utilities" "\&"
.if \nX=1 .ds x} frexp 3C "C Programming Language Utilities"
.if \nX=2 .ds x} frexp 3C "" "\&"
.if \nX=3 .ds x} frexp "" "" "\&"
.TH \*(x}
.SH NAME
\f4frexp\f1, \f4ldexp\f1, \f4logb\f1, \f4modf\f1, \f4modff\f1, \f4nextafter\f1, \f4scalb\f1 \- manipulate 
parts of floating-point numbers
.SH SYNOPSIS
.nf
\f4#include <math.h>\f1
.PP
\f4double frexp (double value, int \(**eptr);\f1
.PP
\f4double ldexp (double value, int exp);\f1
.PP
\f4double logb (double value);\f1
.PP
\f4double nextafter (double value1, double value2);\f1
.PP
\f4double scalb (double value, double exp);\f1
.PP
\f4double modf (double value, double \(**iptr);\f1
.PP
\f4float modff (float value, float \(**iptr);\f1
.SH DESCRIPTION
Every non-zero number can be written uniquely as
.IR x\| "\(** 2" \u\s-2n\s+2\d ,
where the ``mantissa'' (fraction)
.I x\^
is in the range
.RI "0.5 \(<= |" \|x\| "| < 1.0,"
and the ``exponent''
.I n\^
is an integer.
\f4frexp\fP
returns the mantissa of a double 
.IR value ,
and stores the exponent
indirectly in the location pointed to by 
.IR eptr .
If
.I value\^
is zero,
both results returned by
\f4frexp\fP
are zero.
.PP
\f4ldexp\fP
and
\f4scalb\fP
return the quantity
.IR value\| "\(** 2" \u\s-2exp\s+2\d .
The only difference between the two is that
\f4scalb\fP
of a signaling NaN will result in the invalid operation
exception being raised.
.PP
\f4logb\fP
returns the unbiased exponent of its floating-point argument as
a double-precision floating-point value.
.PP
\f4modf\fP
and
\f4modff\fP
(single-precision version)
return the signed fractional part of
.I value\^
and store the integral part indirectly
in the location pointed to by 
.IR iptr .
.PP
\f4nextafter\fP
returns the next representable double-precision floating-point 
value following 
.IR value1
in the direction of
.IR value2.
Thus, if 
.I value2\^
is less than 
\f2value1\fP,
\%\f4nextafter\fP
returns the largest representable floating-point number
less than 
.IR value1.
.SH "SEE ALSO"
\f4cc\f1(1), \f4intro\f1(3M).
.SH DIAGNOSTICS
If
\f4ldexp\fP
would cause overflow,
\f4\(+-HUGE\f1
(defined in 
\f4math.h\f1) is returned
(according to the sign of
.IR value ),
and
\f4errno\f1
is set to
\f4ERANGE\*S\f1.
If
\f4ldexp\fP
would cause underflow,
zero
is returned
and
\f4errno\f1
is set to
\f4ERANGE\*S\f1.
If the input
.I value\^
to
\f4ldexp\fP
is NaN or infinity, that input is returned and 
\f4errno\f1
is set to
\f4EDOM\*S\f1.
The same error conditions
apply to
\f4scalb\fP
except that a signaling NaN as
input will result in the raising of the invalid operation
exception.
.PP
\f4logb\fP
of NaN returns that NaN, 
\f4logb\fP
of infinity returns positive infinity, and
\f4logb\fP
of zero returns negative infinity and results in the raising of the
divide by zero exception.  In each of these conditions
\f4errno\f1
is set to 
\f4EDOM\*S\f1.
.PP
If input
.I value1\^
to 
\f4nextafter\fP
is positive or negative infinity, that input is returned
and 
\f4errno\f1
is set to 
\f4EDOM\*S\f1.
The overflow and inexact exceptions are signalled when input
.I value1\^
is finite, but
\f4nextafter(\f2value1\fP, \f2value2\fP)\f1
is not. 
The underflow
and inexact exceptions are signalled
when
\f4nextafter(\f2value1\fP, \f2value2\fP)\f1
lies strictly between
\(+-\|2\u\s-2\-1022\s+2\d.
In both cases 
\f4errno\f1
is set to
\f4ERANGE\*S\f1.
.PP
When the program is compiled with
the \f4cc\fP options \f4\-Xc\f1 or \f4\-Xa\f1,
\f4HUGE_VAL \f1
is returned instead of 
\f4HUGE.\f1
.\"	@(#)frexp.3c	6.2 of 10/20/83
.Ee
