How does the prop handle a non integer number
science_geek
Posts: 247
if i do the square root of a number and it turn out to not be an integer, what does the prop do, does it round up or down, or does it throw it out and outputs an error message
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
That's true only for positive numbers, not for negatives - e.g. floor(-3.2) = -4, not -3
But since we started out talking about square roots, I suppose science_geek is only dealing with positive numbers.
Ross.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina
obex.parallax.com/objects/category/6/?page=1
Do as I say, not as I do.
I always do extensive testings with extremly values to be sure that everything works right even with a value beeing a zero
or very tiny or negative, or really huge.
I do this REALLY ALWAYS even if I know in this method the values can NEVER get negative or bigger than 100
I DO test it ALWAYS in general. Testing it this way keeps me away from thinking "oh here it doesn't matter"
In earlier times I had enough cases where I thought "oh here it doesn't matter" and then bug came up later
And by doing this I add code that catches bad values and make the code setting the value to a default-value or
create debug-output that a value was out of expected range
best regards
Stefan
in the case of negative numbers and square roots, i kinda will get a negative number cause the code im using for circular interpolation is y= sqrt(r^2 - (x - h)), where y = y axis movement and·x =·x + 1 until x = 2r·since this equation only does half a circle i would have to also do a negative version counting x down and running the x axis in the opposit direction which would·need to be a negative number to give the second half of the cirlce, but i can just set the direction of y opposite to the first half of the circle
if this doesnt make sense im sorry, it does in my mind