LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

quotient & remainder bug

I assume xband got the answer 25 in stead of 26.   

(That was the same problem I had in the past...  1 divided by 0.2 would give the answer 4)

 

However, in LV2012 I also get 26....   It seems the QR behaviour has changed!  

 

And I never got any kudo's !!! Smiley Surprised

0 Kudos
Message 91 of 95
(1,149 Views)

Hi,

 

confirm: result of QR is 25 (instead of expected 26).

 

Things to do:

- increase number of shown digits in all indicators to 20: you will notice the remainder is no longer 1e-8

- why don't you do your QR operation on the prescaled value of 260 and just scale the result of that operation?

 

Dealing with inaccuracy involves thinking about correct order of operations! When using floats you have to deal with rounding errors, often due to values of different magnitude...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 92 of 95
(1,140 Views)

@Anthony_de_Vries wrote:

I assume xband got the answer 25 in stead of 26.   


I figured that much from the file name, but it seemed vague. 😉

 

Of course that raises the question on how it could have possibly changed over the versions because the old result was most likely "mathematically correct" too due to the fuzzy nature of floating point operations. I guess that this is not an intentional change but a side effect of some operation reordering inside the node that, by a lucky coincidence (!), now gives the expected result. 😄

 

Is there a CAR or release note mentioning any of this change? What is the first LabVIEW version that gives 26?

 

 

0 Kudos
Message 93 of 95
(1,118 Views)

Indeed, the idea was that the old result was "mathematically correct".    (See the discussions early on in this thread).

 

However, I think that maybe the IEEE has changed their mind in what is "mathematically correct".  I remember that when I tried Matlab, it also gave these strange results, just like Labview.    When I try it now in Matlab 2012, it also has changed it's behaviour, and gives 'human results'. 

 

 

 

 

0 Kudos
Message 94 of 95
(1,086 Views)

@Anthony_de_Vries wrote:

When I try it now in Matlab 2012, it also has changed it's behaviour, and gives 'human results'.  


Interesting. Maybe the change was made in some common library (e.g. Intel MKL). I am curious what the change was and if it has any negative implications under other scenarios. 😉

0 Kudos
Message 95 of 95
(1,075 Views)