01-31-2006 10:52 AM
01-31-2006 11:03 AM
01-31-2006 11:42 AM
Here is a poor attempt (just before grabbing lunch) to improve the quotient... as long as you don't care too much about the accuracy of the remainder.. it's poor! very poor... shame to post it, actually...
but what the heck... here it is..
as I said, it's ok on the quotient part... Using U32 makes it worse when the number exceeds 2^32..
(oh boy... I'm asking for trouble by posting this... ok... where's the courage... 😉
have fun tbob!! 😄
(Maganne pas trop l'cousin!!)
01-31-2006 12:54 PM
LabVIEW, C'est LabVIEW
01-31-2006 12:56 PM
Pretty close "mon cousin". Try this slight modification to get the correct remainder.
01-31-2006 01:19 PM
Mon cousin de l'autre cote de la mer (that's JPD for you French challenged folks):
You are missing my point. I'm not saying that the Q&R function itself is not accurate. It is accurate. I'm saying that it is not reliable when using floats. As you said, great care must be taken to overcome rounding errors. I don't have to take great care when I use C because the have a separate division function for floats ("/" vs "DIV"). Why can't NI provide functions for floats like C does? What about the equality function? Does anyone use this for floats? No. Not because it is innacurate or incorrect. It is very accurate and very correct. But it is useless with floats because it doesn't take rounding errors into consideration. Q&R is also accurate and correct, but useless with floats unless you take the band aid approach and take great care, blah, blah, blah.
Let's drop the arguement of whether Q&R is correct or incorrect. It works exactly as designed. I think we can all agree on that. Let's ask NI for floating point functions that account for rounding errors by calculating in a higher precision than the inputs, and rounding the output to the same precision as the input. This will give reliable results in all cases with floating point numbers. Q&R and Equality are two functions that need special versions for floats.
01-31-2006 02:46 PM
@tbob wrote:
Try this slight modification to get the correct remainder.
02-01-2006 04:08 AM
02-01-2006 04:18 AM
02-01-2006 05:26 AM