LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

> Bug reporting guidelines:

See here for the proper LabVIEW bug reporting procedure.


Tags
(This content has not been tagged yet)
 
Reply to this topic Start new topic
> Greater? funktion. Is it a bug ?
Bjarne Joergense...
post Oct 24 2007, 09:21 AM
Post #1


1 more post to go!


Member
Posts: 9
Joined: 12-January 07
From: Randers
Member No.: 7489
Using LabVIEW Since:1997
LV:6.1 ,8.20 ,.
Denmark Nothing Selected Nothing Selected


Hi

I got a problem with the compare function "Greater?".
I use it the way you can see in the VI.

With the controls set as default there is no problem.
The current value cycles between 8 and 4 with 0.2 steps.

The problem is that when I set the Start value less than 7.6, current value never reach 8.00.

I can't what's wrong with my VI, or is it the Greater? funktion that got a bug ?

best regards
Bjarne Jørgensen

PS: It's the same behaviour in LV6.1 and 8.2

The Vi is in 8.2
Attached File(s)
Attached File  Test_Greater.vi ( 13.88K ) Number of downloads: 138
 


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ad
post Oct 24 2007, 09:21 AM
Post #















Tags
(This content has not been tagged yet)
Go to the top of the page
Quote Post
Aitor Solar
post Oct 24 2007, 09:47 AM
Post #2


Extremely Active
****

Member
Posts: 262
Joined: 26-January 05
Member No.: 1450
Using LabVIEW Since:2000
LV:8.5 ,8.20 ,7.1.1
Spain spn_Madrid Nothing Selected


Well, the problem arises in the "7.8" step, when you compare two "7.8" values and the "greater?" function returns true. I'm not an expert on this but I believe is usual for floating point numbers not to be exactly the expected value, due to accuracy limits (number of bytes, etc). Surely someone else can explain better.

Anyway, it's better to avoid those risks. For example, you can substract both values and check if the difference is greater than 0.1, or work with integers and convert then to double in the end.

Saludos,
Aitor

This post has been edited by Aitor Solar: Oct 24 2007, 09:47 AM


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Bjarne Joergense...
post Oct 24 2007, 11:51 AM
Post #3


1 more post to go!


Member
Posts: 9
Joined: 12-January 07
From: Randers
Member No.: 7489
Using LabVIEW Since:1997
LV:6.1 ,8.20 ,.
Denmark Nothing Selected Nothing Selected


QUOTE (Aitor Solar @ Oct 24 2007, 11:47 AM) *
Well, the problem arises in the "7.8" step, when you compare two "7.8" values and the "greater?" function returns true. I'm not an expert on this but I believe is usual for floating point numbers not to be exactly the expected value, due to accuracy limits (number of bytes, etc). Surely someone else can explain better.

Anyway, it's better to avoid those risks. For example, you can substract both values and check if the difference is greater than 0.1, or work with integers and convert then to double in the end.

Saludos,
Aitor


I have tryed with integers and then there is no problem.
If I set the procision to 20 digits for a DBL-control I see a strange behaviour.
If I type 0.5 then i display 0.50000000000000000000, but if I type 0.2 then it display 0.20000000000000001100
Why is that ?

Bjarne

Update: I found this on Lava http://wiki.lavag.org/Numeric
This explain the problem

This post has been edited by Bjarne Joergensen: Oct 24 2007, 12:19 PM


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

 




Time is now: 22nd November 2008 - 11:01 AM