Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

hc(1)



frexp(3C)                                               frexp(3C)



NAME
     frexp, ldexp, modf, logb, scalb, nextafter - manipulate
     parts of floating point numbers

SYNOPSIS
     double frexp (value, eptr)
     double value;
     int *eptr;

     double ldexp (value, exp)
     double value;
     int exp;

     double modf (value, iptr)
     double value, *iptr;

     double logb (value)
     double value;

     double nextafter (double value1, double value2)
     double value1, value2;

     double scalb (double value, double exp)
     double value, exp;

DESCRIPTION
     Every non-zero number can be written uniquely as x*(2**n)
     where the ''mantissa'' (fraction) x is in the range 0.5 <
     |x| < 1.0, and the ''exponent'' n is an integer.  frexp
     returns the mantissa of a double value, and stores the
     exponent indirectly in the location pointed to by eptr.  If
     value is zero, both results returned by frexp are zero.

     Ldexp and scalb return the quantity value*(2**exp).  The
     only difference between the two is that scalb of a signaling
     NaN will result in the invalid operation exception being
     raised.

     Modf returns the signed fractional part of value and stores
     the integral part indirectly in the location pointed to by
     iptr.

     Logb returns the unbiased exponent of its floating point
     argument as a double precision floating point value.

     nextafter returns the next representable double precision
     floating point value following value1 in the direction of
     value2.  Thus, if value2 is less than value1, nextafter
     returns the largest representable floating point number less
     than value1.





Page 1                        CX/UX Programmer's Reference Manual





frexp(3C)                                               frexp(3C)



DIAGNOSTICS
     If ldexp would cause overflow, +HUGE is returned (according
     to the sign of value).  However, if the program was linked
     in one of the ANSI C compilation modes, or in the 88open
     OCS-compliant mode.  +HUGE_VAL is returned.  In either case,
     errno is set to ERANGE.

     If ldexp would cause underflow, zero is returned and errno
     is set to ERANGE.  If the input value to ldexp is NaN or
     infinity, that input is returned and errno is set to EDOM.
     The same error conditions apply to scalb except that a sig-
     naling NaN as input will result in the raising of the
     invalid operation exception.

     logb of NaN returns that NaN, logb of infinity returns posi-
     tive infinity, and logb of zero returns negative infinity
     and results in the raising of the divide by zero exception.
     In each of these conditions errno is set to EDOM.

     If input value1 to nextafter is positive or negative infin-
     ity, that input is returned and errno is set to EDOM.  The
     overflow and inexact exceptions are signalled when input
     value1 is finite, but nextafter(value1, value2) is not.  The
     underflow and inexact exceptions are signalled when
     nextafter(value1, value2) lies strictly between -2**-1022
     and 2**-1022.  In both cases errno is set to ERANGE.

SEE ALSO
     hc(1).


























Page 2                        CX/UX Programmer's Reference Manual



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026