POV-Ray : Newsgroups : povray.general : Stupid math help : Re: Stupid math help Server Time
25 Apr 2024 08:24:16 EDT (-0400)
  Re: Stupid math help  
From: Tor Olav Kristensen
Date: 10 Nov 2016 22:35:01
Message: <web.58253984c2d2382468fc97e0@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> On 11/10/2016 1:10 PM, Mike Horvath wrote:
> > I have this formula from Wikipedia:
> >
> > <math>A_v = </math> <math>\log_2</math> <math>A^2</math>
> >
> > How do I use this in POV-Ray? What is the correct syntax? Thanks.
> >
> >
> > Mike
>
>
> Never mind. I guessed the correct syntax.

It seems that \log_2 is the binary logarithm, which is not a standard float
function in POV-Ray (AFAIK).

You can get around this by doing something like this:


#declare BinLogFn = function(x) { ln(x)/ln(2) }

#declare Q = 8; // 2^3 = 8
#declare P = BinLogFn(Q);

#debug "\n\n"
#debug concat("2^", str(P, 0, -1), " = ", str(Q, 0, -1))
#debug "\n\n"


- But if you found the correct syntax, then you are probably aware of this.

--
Tor Olav
http://subcube.com


Post a reply to this message

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