COHERENT manpages
This page displays the COHERENT manpage for frexp() [Separate fraction and exponent].
List of available manpages
Index
frexp() -- General Function (libc) Separate fraction and exponent #include <math.h> double frexp(real, ep) double real; int *ep; frexp() breaks double-precision floating point numbers into fraction and exponent. It returns the fraction m of its real argument, such that 0.5 <= m < 1 or m=0, and stores the binary exponent e in the location pointed to by ep. These numbers satisfy the equation real = m * 2e. Example This example prompts for a number, then uses frexp() to break it into its fraction and exponent. #include <math.h> #include <stdio.h> #include <stdlib.h> main() { double real, fraction; int ep; char string[64]; for (;;) { printf("Enter number: "); if (gets(string) == NULL) break; fraction = frexp(real, &ep); printf("%lf is the fraction of %lf\n", fraction, real); printf("%d is the binary exponent of %lf\n", ep, real); } } See Also atof(), ceil(), fabs(), floor(), ldexp(), libc, modf() ANSI Standard, §7.5.4.3 POSIX Standard, §8.1