|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
/* Re my earlier post _Pinching points_ and responses by Chris Colefax and
Bill DeWitt:
I get a non-fatal "Domain error in pow" each pass through the loop below if
in pow(A,B) B is not an integer and I use the D2 section. Both sections
should be the same and do evaluate the same. Is there a mistake in my script
that I'm missing? The docs say pow(float,float).
I'm using 3.1d.msdos.wat-cwa and Win98SE. */
// Start - no camera or light needed in dos version.
sphere{0,1 pigment{ rgb 1 } hollow} // Removes no object error.
#declare N=1;
#while (N>0)
// This is OK
#if (N<0.75) #declare D1 = (1 - pow(1-(N/0.75), 1.5)) * 0.75;
#else #declare D1 = pow((N-0.75)/0.25, 1.5) * 0.25 + 0.75;
#end
// This gives domain error in pow
#declare D2 = ( (N<0.75)
? (1 - pow(1-(N/0.75), 1.5)) * 0.75
: pow((N-0.75)/0.25, 1.5) * 0.25 + 0.75 );
#declare N=N-0.1;
#end
// e.o.file
Alf
http://www.peake42.freeserve.co.uk
http://ourworld.compuserve.com/homepages/Alf_Peake/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Alf Peake wrote:
>
> /* Re my earlier post _Pinching points_ and responses by Chris Colefax and
> Bill DeWitt:
> I get a non-fatal "Domain error in pow" each pass through the loop below if
> in pow(A,B) B is not an integer and I use the D2 section. Both sections
> should be the same and do evaluate the same. Is there a mistake in my script
> that I'm missing? The docs say pow(float,float).
Yes but if the second number is not an integer, the first one must be
greater than 0...
The way I see it:
* in the first example, PoV only evaluates the right #declare and the
test ensures that the value is correct;
* in the second example, PoV evaluates both values (or tries to) and
then chooses according to the result of the test, which generates an
error since one of the values is incorrect...
Jerome
Disclaimer: I haven't looked at PoV's source and I don't really know
what I'm talking about, but this scenario is coherent with what you
describe...
--
*******************************
* they'll tell you what can't * mailto:ber### [at] inamecom
* be done and why... * http://www.enst.fr/~jberger
* Then do it. *
*******************************
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Alf Peake wrote:
> /* Re my earlier post _Pinching points_ and responses by Chris Colefax
and
> Bill DeWitt:
> I get a non-fatal "Domain error in pow" each pass through the loop
below if
> in pow(A,B) B is not an integer and I use the D2 section. Both
sections
> should be the same and do evaluate the same. Is there a mistake in my
script
> that I'm missing? The docs say pow(float,float).
to which Jerome M. BERGER <jbe### [at] enstfr> replied:
> Yes but if the second number is not an integer, the first one must be
> greater than 0...
> The way I see it:
> * in the first example, PoV only evaluates the right #declare and the
> test ensures that the value is correct;
> * in the second example, PoV evaluates both values (or tries to) and
> then chooses according to the result of the test, which generates an
> error since one of the values is incorrect...
This is precisely the case, and so it would be correct (indeed,
necessary) to use the full #if () #declare ... #else #declare ... #end
syntax if you wanted to use non-integer powers (but I guess some of us
just can't resist a shortcut!).
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thanks Chris, as you guessed it was a shortcut to save an assignment because
I seem to end up with too many #declares and us over-60s get easily confused
:-)
Many thanks again
Alf
Chris Colefax <cco### [at] geocitiescom> wrote in message
news:3845e24a@news.povray.org...
> Alf Peake wrote:
> > /* Re my earlier post _Pinching points_ and responses by Chris Colefax
> and
> > Bill DeWitt:
> > I get a non-fatal "Domain error in pow" each pass through the loop
> below if
> > in pow(A,B) B is not an integer and I use the D2 section. Both
> sections
> > should be the same and do evaluate the same. Is there a mistake in my
> script
> > that I'm missing? The docs say pow(float,float).
>
> to which Jerome M. BERGER <jbe### [at] enstfr> replied:
> > Yes but if the second number is not an integer, the first one must be
> > greater than 0...
> > The way I see it:
> > * in the first example, PoV only evaluates the right #declare and the
> > test ensures that the value is correct;
> > * in the second example, PoV evaluates both values (or tries to) and
> > then chooses according to the result of the test, which generates an
> > error since one of the values is incorrect...
>
> This is precisely the case, and so it would be correct (indeed,
> necessary) to use the full #if () #declare ... #else #declare ... #end
> syntax if you wanted to use non-integer powers (but I guess some of us
> just can't resist a shortcut!).
>
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|