frexp(3) — Subroutines
OSF
NAME
frexp, ldexp, modf − Manipulates floating-point numbers
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <math.h>
double frexp (
double value,
int ∗exp );
double ldexp (
double mantissa,
int exp );
double modf (
double value,
double ∗int_pointer);
PARAMETERS
valueSpecifies some double value.
expSpecifies an integer pointer to store the exponent for frexp(); for ldexp(), specifies some integer value.
mantissaSpecifies some double value.
int_pointerSpecifies a double pointer in which to store the signed integral part.
DESCRIPTION
Every nonzero number can be written uniquely as x times 2 raised to the power n, where the mantissa (fraction), x, is in the range 0.5 ≤ |x| < 1.0, and the exponent, n, is an integer.
The frexp() function breaks a floating-point number into a normalized fraction and an integral power of 2. It stores the integer in the int object pointed to by the exp parameter and returns the fraction part.
The ldexp() function multiplies a floating-point number by an integral power of 2.
The modf() function breaks the value parameter into an integral and fractional part, each of which has the same sign as the value parameter. It stores the integral part as a double in the location pointed to by the int_pointer parameter.
NOTES
The frexp() and modf() functions are supported for multi-threaded applications. The ldexp() function is not supported for multiple threads.
AES Support Level:
Full use
RETURN VALUES
Upon successful completion, the frexp() function returns the value x such that x is a double with magnitude in the interval 1/2 to 1, or 0 (zero), and value equals x times 2 raised to the power of ∗exp. If value is 0, both parts of the result are 0. If value is NaN, then the result is NaN and ∗exp is set to LONG_MIN. If value is +infinity, then the result is +0.0 and ∗exp is set to +LONG_MAX.
Upon successful completion, the ldexp() function returns a double equal to value times 2 to the power exp. If value is NaN, NaN is returned. If ldexp() would cause overflow, ±HUGE_VAL is returned (according to the sign of value) and errno is set to [ERANGE]. If ldexp() would cause underflow, 0 (zero) is returned. Otherwise, either errno is set to indicate the error or NaN is returned.
Upon successful completion, the modf() function returns the signed fractional part of value and stores the signed integral part in the object pointed to by int_pointer. If value is NaNQ or NaNS, then NaNQ is returned and NaNQ is stored in the object pointed to by int_pointer. If value is +infinity, then a +0.0 is returned and +infinity is stored in the object pointed to by int_pointer.
ERRORS
If the ldexp() function fails, errno may be set to one of the following values:
[ERANGE]The value to be returned would cause overflow or underflow.
[EDOM]The value parameter is NaN.
If the modf() function fails, errno may be set to one of the following values:
[EDOM]The value parameter is NaN.
If the frexp() function fails, errno may be set to one of the following values:
[EDOM]The value parameter is NaN or infinity.
RELATED INFORMATION
Functions: isnan(3)