| Revision: | 1.1 |
| Committed: | Thu May 11 21:24:16 1989 UTC (36 years, 5 months ago) by greg |
| Content type: | text/plain |
| Branch: | MAIN |
| Log Message: | Initial revision |
| # | User | Rev | Content |
|---|---|---|---|
| 1 | greg | 1.1 | #ifndef lint |
| 2 | static char SCCSid[] = "$SunId$ LBL"; | ||
| 3 | #endif | ||
| 4 | |||
| 5 | double | ||
| 6 | frexp(x, ip) /* call it paranoia, I've seen the lib version */ | ||
| 7 | register double x; | ||
| 8 | 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 | x /= 2.0; | ||
| 25 | *ip = i; | ||
| 26 | if (neg) | ||
| 27 | return(-x); | ||
| 28 | else | ||
| 29 | return(x); | ||
| 30 | } |