01-30-2006 06:25 PM
01-31-2006 12:31 AM
01-31-2006 08:27 AM
01-31-2006 09:20 AM - edited 01-31-2006 09:20 AM
Message Edited by Anthony de Vries on 01-31-2006 04:21 PM
01-31-2006 09:36 AM
01-31-2006 10:20 AM
On the same computer that mistakenly outputs 4 for Q&R of 1/0.2 using Labview's Q&R function, I can write a C program using the floor(x/y) function and floor(1/0.2) comes out to be 5. Now who is to blame? Clearly the Labview Q&R function is wrong. Sure the computer does not interpret human intentions, but the programmers must make the necessary corrections. I'm not talking about you or me making these corrections, I'm talking about the Labview function writers. Calculators do it right, C does it right, Labview does it wrong. There is no suitable arguement against this fact.
One could argue that Q&R is correct because the actual input is not 0.2, instead it is 0.200000001 or so. For this input Q&R is right on. However, the Q&R function writers are not taking into account that the computer representation of a floating point input is inexact. The function was written for humans to use. So computer innacuracies must be accounted for, or the function is useless. Same with the equality function. It is useless for floats. We have all gotten around this by using greater than or less than with some 20 digits of precesion, but this is a band aid approach. The LV functions do not work with floats as intended to be used by humans. As Anthony said, the function writers should compute the results using a higher precesion and then round off. This is the way calculators do it, and this is the way a C compiler does it. You don't see any arguements amongst calculator users or C programmers because there is no problem there. Changing Q&R to work this way will not upset anyone and will not cause a problem for previously written code. How can improved accuracy cause any problems?
You could argue, well what if someone wants to calculate 1/0.200000000001? This calculation should be done using 64 bit numbers then rounded to a 32 bit number, or whatever. Bottom line is to make the Q&R function calculate in a higher precision than the input, and output at a precision equal to the input, as Anthony said. Same for equality. Would anyone be against NI making this change?
01-31-2006 10:26 AM
01-31-2006 10:35 AM
01-31-2006 10:48 AM
This is worth < $0.02 **, but with all these comparisons to calculators ...
While binary/floating point calculators exist, most physical calculators work internally with binary coded decimal (BCD) ... or at least they used to. Apologies if I'm behind the times on this.
(** both in binary and BCD)
01-31-2006 10:48 AM
@unclebump wrote:
Seems kind of silly that a $5000 program can't perform as well as a $10 calculator.
LOL!! 😄 😄
That's a good comeback Unclebump!!
LOL!! 😄
But we have to get back into context... LV was designed as a computer language not as a calculator.. so similar (computer language) rules apply. But there ins nothing that prevents having a Math VI that breaks those rules for practicality. 😉
In reality, the computer has no clue what the number really is, it only sees a finite number of 1's & 0's and interprets its value from that... But of course we all know this...
😄