1 |
|
#ifndef lint |
2 |
|
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
4 |
– |
/* ==================================================================== |
5 |
– |
* The Radiance Software License, Version 1.0 |
6 |
– |
* |
7 |
– |
* Copyright (c) 1990 - 2002 The Regents of the University of California, |
8 |
– |
* through Lawrence Berkeley National Laboratory. All rights reserved. |
9 |
– |
* |
10 |
– |
* Redistribution and use in source and binary forms, with or without |
11 |
– |
* modification, are permitted provided that the following conditions |
12 |
– |
* are met: |
13 |
– |
* |
14 |
– |
* 1. Redistributions of source code must retain the above copyright |
15 |
– |
* notice, this list of conditions and the following disclaimer. |
16 |
– |
* |
17 |
– |
* 2. Redistributions in binary form must reproduce the above copyright |
18 |
– |
* notice, this list of conditions and the following disclaimer in |
19 |
– |
* the documentation and/or other materials provided with the |
20 |
– |
* distribution. |
21 |
– |
* |
22 |
– |
* 3. The end-user documentation included with the redistribution, |
23 |
– |
* if any, must include the following acknowledgment: |
24 |
– |
* "This product includes Radiance software |
25 |
– |
* (http://radsite.lbl.gov/) |
26 |
– |
* developed by the Lawrence Berkeley National Laboratory |
27 |
– |
* (http://www.lbl.gov/)." |
28 |
– |
* Alternately, this acknowledgment may appear in the software itself, |
29 |
– |
* if and wherever such third-party acknowledgments normally appear. |
30 |
– |
* |
31 |
– |
* 4. The names "Radiance," "Lawrence Berkeley National Laboratory" |
32 |
– |
* and "The Regents of the University of California" must |
33 |
– |
* not be used to endorse or promote products derived from this |
34 |
– |
* software without prior written permission. For written |
35 |
– |
* permission, please contact [email protected]. |
36 |
– |
* |
37 |
– |
* 5. Products derived from this software may not be called "Radiance", |
38 |
– |
* nor may "Radiance" appear in their name, without prior written |
39 |
– |
* permission of Lawrence Berkeley National Laboratory. |
40 |
– |
* |
41 |
– |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
42 |
– |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
43 |
– |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
44 |
– |
* DISCLAIMED. IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR |
45 |
– |
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
46 |
– |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
47 |
– |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
48 |
– |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
49 |
– |
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
50 |
– |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
51 |
– |
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
52 |
– |
* SUCH DAMAGE. |
53 |
– |
* ==================================================================== |
54 |
– |
* |
55 |
– |
* This software consists of voluntary contributions made by many |
56 |
– |
* individuals on behalf of Lawrence Berkeley National Laboratory. For more |
57 |
– |
* information on Lawrence Berkeley National Laboratory, please see |
58 |
– |
* <http://www.lbl.gov/>. |
59 |
– |
*/ |
4 |
|
|
5 |
+ |
double |
6 |
|
frexp(x, ip) /* call it paranoia, I've seen the lib version */ |
7 |
< |
register double x; |
7 |
> |
double x; |
8 |
|
int *ip; |
9 |
|
{ |
10 |
|
int neg; |
21 |
|
x *= 2.0; |
22 |
|
else |
23 |
|
for (i = 0; x >= 1.0; i++) |
24 |
< |
x /= 2.0; |
24 |
> |
x *= 0.5; |
25 |
|
*ip = i; |
26 |
< |
if (neg) |
82 |
< |
return(-x); |
83 |
< |
else |
84 |
< |
return(x); |
26 |
> |
return (neg ? -x : x); |
27 |
|
} |