|
![](/i/fill.gif) |
While there are not many such platforms left, those who still need them and
have ISO C99 compatible libraries may want to try to adjust the ot_index_box
function in octree.cpp to use the logbf / ilogbf C99 library function, which
is available in most recent compilers for Unix platforms. below is the
example code that demonstrates how to adapt the code. The actual POV-Ray
code change is left as an exercise to the reader ;-)
Thorsten
NOTE: Be aware that is is most likely far less efficient, but it is
compatible with ISO C99 libraries! I only provide the version using logbf
because the library I used for testing listed ilogbf as not yet supported...
#include <stdio.h>
#include <math.h>
int main(void)
{
union
{
float f;
long l;
}
convert;
convert.f = -8614.585434574;
convert.l &= 0xff800000;
printf("%f %f\n", pow(2.0, logbf(convert.f) *(1-2*signbit(convert.f)),
convert.f);
convert.f = -84.585434574;
convert.l &= 0x7f800000;
printf("%f %x %d %d %d\n", convert.f, convert.l, (convert.l>>23)-127,
(convert.l>>23), ((int)logbf(convert.f))+127);
return 0;
}
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
![](/i/fill.gif) |