POV-Ray : Newsgroups : povray.general : Error with pow() : Re: Error with pow() Server Time
4 Aug 2024 14:25:13 EDT (-0400)
  Re: Error with pow()  
From: Christopher James Huff
Date: 14 Jun 2003 18:48:08
Message: <cjameshuff-F988E4.17393614062003@netplex.aussie.org>
In article <3eeb73c1$1@news.povray.org>,
 "Tim Nikias v2.0" <tim### [at] gmxde> wrote:

> I thought that it would solve most problems (like the
> doc-mentioned non-integer usage for exponents), and
> you replied that it wouldn't necessarily "fix" anything.
> What I want to avoid is the platform-specific handling
> of non-integer exponents. I assume int() would be the
> way to go.

It is really very simple: as the manual says, the result of a negative 
base raised to a non-integer exponent is undefined. Non-integer 
exponents with positive bases are perfectly acceptable. Using both abs() 
on the base and int() on the exponent is unnecessary, and pretty much 
useless...the int() doesn't avoid any problems. The issue has nothing to 
do with int() vs. floor() or ceil().

The only platform-dependence is the return value of pow(): because of 
the different methods platforms use for performing math and calculating 
the power, they will often come up with slightly different results, and 
they may have different ways of handling undefined "values". There is 
nothing you can do about this, but it is extremely rare for it to be at 
all relevant.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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