02-01-2006 05:39 AM
02-01-2006 06:51 AM
02-01-2006 07:00 AM
Now eleven...
For nice guys (incl. frogs) 😉
-- plus an extra --
02-01-2006 07:43 AM
@David Crawford wrote:
Also the answer the formula node returns for R=x-y*floor(x/y) isn't right.
02-01-2006 08:29 AM
I remember reading in one of the trade magazines a long time ago the following:
"Anything perceived by a user of a piece of software to be a bug, is a bug."
I have always tried to keep that in mind when programming or when responding to users of my software and I think it may apply to the quotient & remainder function as well. I dare say that most LabVIEW users, when presented with this specific behavior would wonder what was wrong. A minority of that population would quickly "get it" and go on to deal with it but the remaining majority would continue to be confounded. Does that mean that their opinion is worth less than those of us who understand what's happening? I think not.
Any piece of software that generates this much controversy cannot be considered to be really good.
It certainly doesn't help that the documentation for the function does not come with a warning about this behavior.
02-01-2006 08:40 AM
02-01-2006 09:44 AM
CC and JLV
Thanks for the stars - glad that there still is justice around.... :):):)
02-01-2006 09:49 AM
Kevin,
About your SGL to DBL scheme. I had been thinking along the same lines too. However, it doesn't always work. The quantization error that's in the SGL (the last bit), also get's into the DBL, as if it were a significant number. Often, it might disappear in the devide, but not always. Try the attached vi. It works fine for y = 0.2 and x = 1, 1.2, 1.4 etc.
However, it doesn't work for y = 0.1 and x = 1.3
It also might be impossible for DBL's. If I understand the documentation correctly, depending on your system, the EXT doesn't always add extra digits, but just allows bigger exponentials. In that case, it wouldn't help in getting rid of quantization or rounding errors...
That's why I decided for my own QR vi, that I would take DBL in, convert to SGL after the devide, and then have the output in DBL again. That's limiting the significant digits on which the IQ is based rather drastically, but at least it will always give the expected result.
BTW, I don't think speed should ever take precedence over safeguards. The first requirement is that the function is predictable. A function that can give either 1 or 2 as the answer, due to simple rounding errors, is useless regardless how fast it is. Only when choosing between different implementations of predictable routines, would speed become an issue.
02-01-2006 10:27 AM
Once again. NI doesn't have to change Q&R. NI should instead add a floating point math library. I believe there is such a library for C programmers. Lets have two Q&R functions and two equality functions, etc..., one for integers and speed, one for floating points.
BTW, what is NI's take on all of this? They have been curiously silent this whole time. Will someone from NI respond?
02-01-2006 11:13 AM
I agree with tbob and Anthony. If the Q&R does not work for floats as would normally be expected due to rounding errors then the Q&R function should be limited (by NI) to integer inputs and a coersion dot should show up when you try to attach a float. The fact that floats are accepted leads programmers to believe that NI has already taken steps to alleviate the rounding error problem.
I think that having a separate floating point pallete is very appropriate. For those of you who are interested in speed the existing Q&R function could be sped up because it would only accept integer inputs.
Just because we understand a problem doesn't mean that the solution should be ignored.