289 |
|
d = r > g ? r : g; |
290 |
|
if (b > d) d = b; |
291 |
|
|
292 |
< |
if (d <= 0.0) { |
292 |
> |
if (d <= 1e-32) { |
293 |
|
clr[RED] = clr[GRN] = clr[BLU] = 0; |
294 |
|
clr[EXP] = 0; |
295 |
|
return; |
313 |
|
if (clr[EXP] == 0) |
314 |
|
col[RED] = col[GRN] = col[BLU] = 0.0; |
315 |
|
else { |
316 |
< |
f = ldexp(1.0, clr[EXP]-(COLXS+8)); |
316 |
> |
f = ldexp(1.0, (int)clr[EXP]-(COLXS+8)); |
317 |
|
col[RED] = (clr[RED] + 0.5)*f; |
318 |
|
col[GRN] = (clr[GRN] + 0.5)*f; |
319 |
|
col[BLU] = (clr[BLU] + 0.5)*f; |
320 |
|
} |
321 |
|
} |
322 |
– |
|
323 |
– |
|
324 |
– |
#ifdef FREXP |
325 |
– |
double |
326 |
– |
frexp(x, ip) /* call it paranoia, I've seen the lib version */ |
327 |
– |
register double x; |
328 |
– |
int *ip; |
329 |
– |
{ |
330 |
– |
int neg; |
331 |
– |
register int i; |
332 |
– |
|
333 |
– |
if (neg = (x < 0.0)) |
334 |
– |
x = -x; |
335 |
– |
else if (x == 0.0) { |
336 |
– |
*ip = 0; |
337 |
– |
return(0.0); |
338 |
– |
} |
339 |
– |
if (x < 0.5) |
340 |
– |
for (i = 0; x < 0.5; i--) |
341 |
– |
x *= 2.0; |
342 |
– |
else |
343 |
– |
for (i = 0; x >= 1.0; i++) |
344 |
– |
x /= 2.0; |
345 |
– |
*ip = i; |
346 |
– |
if (neg) |
347 |
– |
return(-x); |
348 |
– |
else |
349 |
– |
return(x); |
350 |
– |
} |
351 |
– |
#endif |