Jump to content

Greater? funktion. Is it a bug ?


Recommended Posts

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

Link to comment

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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.