ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/frexp.c
Revision: 1.5
Committed: Fri Nov 5 03:31:36 2004 UTC (20 years, 6 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +1 -1 lines
State: FILE REMOVED
Log Message:
Removed unused programs and files from distribution (sources to CVS attic)

File Contents

# User Rev Content
1 greg 1.1 #ifndef lint
2 greg 1.5 static const char RCSid[] = "$Id: frexp.c,v 1.4 2003/11/12 18:06:54 greg Exp $";
3 greg 1.1 #endif
4    
5 greg 1.4 double
6 greg 1.1 frexp(x, ip) /* call it paranoia, I've seen the lib version */
7 greg 1.4 double x;
8 greg 1.1 int *ip;
9     {
10     int neg;
11     register int i;
12    
13     if (neg = (x < 0.0))
14     x = -x;
15     else if (x == 0.0) {
16     *ip = 0;
17     return(0.0);
18     }
19     if (x < 0.5)
20     for (i = 0; x < 0.5; i--)
21     x *= 2.0;
22     else
23     for (i = 0; x >= 1.0; i++)
24 greg 1.4 x *= 0.5;
25 greg 1.1 *ip = i;
26 greg 1.4 return (neg ? -x : x);
27 greg 1.1 }