POV-Ray : Newsgroups : povray.programming : QUESTION: Radiosity problem in POV-Ray v3.1g : Re: QUESTION: Radiosity problem in POV-Ray v3.1g Server Time
28 Jul 2024 22:25:51 EDT (-0400)
  Re: QUESTION: Radiosity problem in POV-Ray v3.1g  
From: Peter J  Holzer
Date: 22 Mar 2000 20:02:03
Message: <38D95213.4D9DBC06@hjp.at>
Nathan Kopp wrote:
>   /*
>    * This hex operation does a floor to next lower power of 2, by clearing
>    * all of the mantissa bits.  Works only on IEEE single precision floats
>    */
[...]
>   /*
>    * This magic hex operation extracts the exponent, which gives us an
>    * integer number suitable for labelling a range of a power of 2.  In IEEE
>    * format, value = pow(2,exponent-127). Therefore, if our index is, say,
>    * 129, then the item has a maximum extent of (2 to the (129-127)), or
>    * about 4 space units.
>    */
[...]
> A portable version of these operations could be written, using logrithms and
> fractional powers, but it would be significantly slower.

These operations can be easily implemented using the standard C
functions ldexp and frexp, which should be reasonably fast (although 
probably not as fast as the integer operations above) on any base2
system.

	hp 

-- 
   _  | Peter J. Holzer             | Think of it as evolution in action
|_|_) | Sysadmin WSR                |
| |   | hjp### [at] wsracat               |   -- Tony Rand in "Oath of Fealty"
__/   | http://wsrx.wsr.ac.at/~hjp/ | 	   by Niven & Pournelle


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.