|
|
Tor Olav Kristensen wrote:
>
> > >
> > > x^n = exp(n*ln(x))
> >
> > Uh, I think "x^n = pow(x, n)" is more likely...
>
> Yes, but do you know how this is actually computed ?
>
<remembering something>
<digging through harddisk>
\Delphi4\Source\Rtl\Sys\Math.pas:
function Power(Base, Exponent: Extended): Extended;
begin
if Exponent = 0.0 then
Result := 1.0 { n**0 = 1 }
else if (Base = 0.0) and (Exponent > 0.0) then
Result := 0.0 { 0**n = 0, n > 0 }
else if (Frac(Exponent) = 0.0) and (Abs(Exponent) <= MaxInt) then
Result := IntPower(Base, Integer(Trunc(Exponent)))
else
Result := Exp(Exponent * Ln(Base))
end;
Seems Tor is right, since i guess the C function pow(x,y) computes the
same (maybe apart from the optimization done here) this again answers the
questions about where it is defined.
Christoph
--
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other
things on: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
|
|
|
Christoph Hormann wrote:
> Seems Tor is right, since i guess the C function pow(x,y) computes the
> same (maybe apart from the optimization done here) this again answers the
> questions about where it is defined.
Yall are getting almost over my head.
I'd once again assert that in parametrics Chris Huff's statement is NOT true
for parametrics:
> It is defined as "x raised to the power of n", and works fine with
> negative x and fractional values of n.
albeit it appears to work fine in isosurfaces.
OR perhaps for isosurfaces: x^n=abs(x)^n* sign(x); whereas parametrics have
something else.
Would parametrics and isosurfaces use different math code for exponents?
Hope I'm not being too much of a pain. But I would suggest "something is
wrong" if we get an image like that in the top of this thread.
Post a reply to this message
|
|
|
|
In article <3A55CB79.96817286@my-dejanews.com>,
gre### [at] my-dejanewscom wrote:
> I'd once again assert that in parametrics Chris Huff's statement is NOT
> true for parametrics:
I highly doubt function evaluation is significantly different between
the two...I think it's much more likely that it is a problem with the
parametric solving code.
--
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
<><
Post a reply to this message
|
|