Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ frexp(S) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought


 frexp(S)                       6 January 1993                       frexp(S)


 Name

    frexp, ldexp, modf - manipulate parts of floating-point numbers

 Syntax


    cc  . . .  -lm


    #include  <math.h>

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

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

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


 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 returns the quantity value* 2^(exp).

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

 Diagnostics

    If ldexp would cause overflow, +-HUGE (defined in <math.h>) is returned
    (according to the sign of value), and errno is set to ERANGE.  If ldexp
    would cause underflow, zero is returned and errno is set to ERANGE.

 Standards conformance

    frexp, ldexp and modf are conformant with:
    AT&T SVID Issue 2;
    X/Open Portability Guide, Issue 3, 1989;
    ANSI X3.159-1989 Programming Language -- C;
    Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2);
    IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C
    Language] (ISO/IEC 9945-1);
    and NIST FIPS 151-1.


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