POV-Ray : Newsgroups : povray.unofficial.patches : radiosity samples: 255x255x255 probably isn't enough : Re: pow()??? (Re: radiosity samples: 255x255x255 probably isn't enough) Server Time
2 Jul 2024 18:46:04 EDT (-0400)
  Re: pow()??? (Re: radiosity samples: 255x255x255 probably isn't enough)  
From: Vadim Sytnikov
Date: 8 Jan 2003 14:17:08
Message: <3e1c7934$1@news.povray.org>
"Anders K." <and### [at] kaseorgcom> wrote:
> A reasonably smart compiler will optimize "src_vec->x * src_vec->x" to "x
=
> src_vec->x; x * x", but I doubt it would change "pow(x, 2)" to "x * x".
>
> Even if pow is included on the CPU, multiplication is much faster (AFAIK).

Right.

As to the direct support of pow() in the CPU, this is very and very
unlikely... Usually, pow() is implemented as a function that computes its
result using the

x ^ y == 2 ^ (y * log2(x))

formula, with *some* support for the log2(x) in the CPU (power of 2, being a
shift, is quite efficient, of course). log2(x) may easily take a hundred or
so cycles, plus those extra calculations, plus the overhead of the function
call... so, hope you got the idea.


Post a reply to this message

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