POV-Ray : Newsgroups : povray.bugreports : 3.8 macro parsing errors : Re: 3.8 macro parsing errors Server Time
19 Jul 2024 23:37:31 EDT (-0400)
  Re: 3.8 macro parsing errors  
From: William F Pokorny
Date: 25 Jun 2024 14:57:13
Message: <667b1309@news.povray.org>
On 6/25/24 11:53, jr wrote:
> our" as in not just 'yuqk' ?  (because the wiki docs only mention 'float', and
> knowing it'll be a double is useful (I think))

I'm reasonably sure. :-)

It's true that the yuqk fork moved from the std::atof() function to 
std::strtod() to enable better debugging on bad, but still sort of 
getting converted strings. I wanted the debug compile of yuqk to return 
detail on problems and not just continue onward with unintended values. 
I believe both std::atof() and std::strtod() return doubles(*).

I'm not 100% sure what std::atof() might do on being passed "1.0f" say,
but it should be getting assign to a return double.

Suppose we have these two SDL lines where the first one is what we 
intended and the second one is what we typed.

#debug concat("val(1.0123\") = ",str(val("1.0123"),19,17),"\n")
#debug concat("val(1.01 23\") = ",str(val("1.01 23"),19,17),"\n")

in v3.8 beta 2 or the non-debug compile of yuqk we get the following 
output:

val(1.0123") = 1.01229999999999998  // (Example of str's noisy digits)
   (f_boom() %g returns 1.0123 with default rounding)
val(1.01 23") = 1.01000000000000001 // Oops

Where the debug compile of yuqk returns:

val(1.0123") = 1.01229999999999998
File 'HUGE_VAL.pov' line 46:
Parse Error:
Error during val call At: < 23> converting <1.01 23>
Value set to <1.01>

---

And wonder of wonders, I used the same test scene file I was using for 
the +-inf stuff and my debug compile dies on:

#debug concat("val(\"inf\") = ",str(val("+inf"),19,17),"\n")

but not in val but due an additional check I inserted in our expression 
parsing... Ideally at that check I would remember be smart enough to 
trust that std::strtod()'s own parsing handles the infinities correctly. 
I'd bet there is no easy way to do that with 100% certainly and still 
prevent other +-inf things which are very likely problems.

I'll look, but currently, I'd say now you cannot use infinities at all 
in the debug version of yuqk. Thanks jr & BW for the questions.

Off to again update the new rulesOfThumbForMath.txt file - or the code, 
if I can figure out how to let only infinite double returns from val() 
past by the debug compile checking for infinite values.

Bill P.


Post a reply to this message

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