 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I've been working on making my vector arity macro robust, and I came across this
surprising fact while stress testing.
NAN is treated differently in the parser than in the function VM.
NAN equals - EVERYTHING in the parser.
NAN equals nothing, not even itself in the function VM.
So my IfNan () macro fails, but my IfNan () function works as expected.
I'll need to dig into this and see where in the source it goes wrong.
I also recall seeing a thread where people were playing with N/0, and I think
the parser biases that - probably because it allows certain code to keep going.
https://news.povray.org/44294a5a%241%40news.povray.org
- BE
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 27/03/2026 00:13, Bald Eagle wrote:
> I've been working on making my vector arity macro robust, and I came across this
> surprising fact while stress testing.
>
> NAN is treated differently in the parser than in the function VM.
>
> NAN equals - EVERYTHING in the parser.
>
> NAN equals nothing, not even itself in the function VM.
>
> So my IfNan () macro fails, but my IfNan () function works as expected.
>
> I'll need to dig into this and see where in the source it goes wrong.
>
> I also recall seeing a thread where people were playing with N/0, and I think
> the parser biases that - probably because it allows certain code to keep going.
>
> https://news.povray.org/44294a5a%241%40news.povray.org
>
> - BE
>
Tim Nikias's message does not specify a POV version.
But, mathematically speaking, it makes sense :
lim 1/x = +∞ and lim 1/x = -∞
x -> 0+ x -> 0-
but no NAN.
In version 3.8 this code
#declare a = 1/0;
#debug concat("a = ",str(a,0,-1),"\n")
Give :
Parse Warning: Divide by zero.
a = inf
Only parse warning. No stop error in parser.
It is reasonable to assume that 1e+017 is equivalent to ∞
--
kurtz le pirate
compagnie de la banquise
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
hi,
kurtz le pirate <kur### [at] free fr> wrote:
> On 27/03/2026 00:13, Bald Eagle wrote:
> > ...
> > NAN is treated differently in the parser than in the function VM.
> > NAN equals - EVERYTHING in the parser.
> > NAN equals nothing, not even itself in the function VM.
> > ...
> Tim Nikias's message does not specify a POV version.
> But, mathematically speaking, it makes sense :
>
> lim 1/x = +∞ and lim 1/x = -∞
> x -> 0+ x -> 0-
>
> but no NAN.
>
> In version 3.8 this code
> #declare a = 1/0;
> #debug concat("a = ",str(a,0,-1),"\n")
>
> Give :
> Parse Warning: Divide by zero.
> a = inf
(not knowing what I do :-)) a-a displays -nan.
regards, jr.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |