POV-Ray : Newsgroups : povray.advanced-users : <no subject> : <no subject> Server Time
26 Apr 2024 22:54:40 EDT (-0400)
  <no subject>  
From: Bald Eagle
Date: 13 Sep 2018 19:35:00
Message: <web.5b9af324c23a6d9458c7afe0@news.povray.org>
[Floating-point] math is hard.







extra confounding factor that I had failed to consider. So, the lesson to
remember is that floating-point math is always more complex than you think it
is.

I may need something ... stronger than coffee, gin, bourbon, and Stephen's
proprietary family-secret Dried Frog Pills (TM) (R) (c)

I had ironed out some stupid errors and was homing in working out the wonkiness
of a function and, lo and behold, I'm getting an "...uninitialized array
element..." error - not because i was working outside the scope of my 2D array,
but because the comparison I was trying to perform - WAIT --- HAD been
performing for the last week - suddenly didn't like to successfully compare 0 to
.... "zero".

@#%$^&**

So I have an array of vectors with .y and .z values ranging from 0 to tau, or
2*pi, or whatever the #version's parser allows...

And I just want to see "where" in that range I am....



    #local Mult = 1000;

    #local _Patch = array [6];

    #for (U, 0, Usize)
        #debug concat ("Testing Y = ", Scalar (YVal, 3, 0), " vs ", Vector
(UArray [U], 3, 0), " \n")

(commmence anti-floating point calisthenics...)

        #if ( int(YVal*Mult) >= int(UArray [U].y*Mult) & int(YVal*Mult) <=
int(UArray [U].z*Mult) )

        #local _Patch [0] = UArray [U].x;
        #local _Patch [1] = UArray [U].y;
        #local _Patch [2] = UArray [U].z;
        #end
    #end





And I mean, it's ZERO, so what do I multiply by and round it with?
Is f'ing  _***INT***_ (0) not ZERO?!

:|


I would like a kind soul to attempt, again, in a practical way, to suggest an
effective algorithm that will allow "easy" and accurate comparison of numbers
derived in some way shape or form from floating point calculations.


Apparently #for (N, 0, ....
doesn't give me a zero that's equal to 0 * N2....


Post a reply to this message

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