File:  [MW Coherent from dump] / coherent / a / usr / man / ALL / frexp
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:34 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent



frexp()                  General Function                 frexp()




Separate fraction and exponent

ddoouubbllee ffrreexxpp(_r_e_a_l, _e_p) ddoouubbllee _r_e_a_l; iinntt *_e_p;

frexp breaks  double-precision floating point  numbers into frac-
tion and  exponent.  It returns the fraction m  of its real argu-
ment, such  that 0.5 <= _m  < 1 or _m=0, and  stores the binary ex-
ponent e in the location pointed to by ep.  These numbers satisfy
the equation _r_e_a_l = _m * 2^_e.

***** Example *****

This example  prompts for a  number, then uses frexp  to break it
into its fraction and exponent.


#include <stdio.h>



main()
{
        extern char *gets();
        extern double frexp(), atof();
        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);
        }









COHERENT Lexicon                                           Page 1




frexp()                  General Function                 frexp()



        putchar('\n');
}


***** See Also *****

atof(),  ceil(),  fabs(),  floor(), general  functions,  ldexp(),
modf()

















































COHERENT Lexicon                                           Page 2



unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.