LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong quotient with quotient and remainder vi

I got some issue with the quotient and remainder vi it is giving me the
wrong result in case of dividing with multiples of 2
e.g. input I have x = 80 and y=20; quotient output is giving me 3 instead of 4 !
 
Unfortunately I cannot switch to integer, so is there a solution I can get the correct value out
of this vi ?
Are there any alternatives to convert a value of an input box e.g. 0,3 (double) to 30 (integer)
 
Thanks
Stefan 
0 Kudos
Message 1 of 5
(2,718 Views)
Hi Stefan,

Would it be acceptable in your application to round X and Y before the division ? (like this)





Message Edité par TiTou le 03-24-200603:03 PM


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 5
(2,712 Views)


@Stefan22 wrote:
Unfortunately I cannot switch to integer, so is there a solution I can get the correct value out
of this vi ?


There are a few long discussions that you might want to read, e.g.:

http://forums.ni.com/ni/board/message?board.id=170&message.id=163975

http://forums.ni.com/ni/board/message?board.id=170&message.id=117462

If your inputs are known to be whole numbers, you could insert a "round to nearest" before each of the inputs to Q&R. This will retain the DBL representation and eliminate any binary residual.

Message 3 of 5
(2,690 Views)
You could also scale your inputs and then round to the nearest integer.  For example instead of doing the math on kilometres, scale the inputs to metres, then round to nearest integer and then do the division.
----
I am the founder of CnCSoftwareSolutions. When not cleaning up baby drool, I write about test data or work on Vision, a tool for understanding your test data. Visit me at www.cncsoftwaresolutions.com
0 Kudos
Message 4 of 5
(2,675 Views)
Ok thank you boys,
I give it a try.

Best regards
0 Kudos
Message 5 of 5
(2,660 Views)