NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare floating poit numbers

Hello,

 

I'm using TestStand and LabVIEW.

 

What is the best way to compare floating point numbers in TestStand flow?

 

 

Thanks in advance.

0 Kudos
Message 1 of 4
(3,818 Views)

This question is somehow quite odd....

 

First of all and most important: Never compare floating numbers with "equal". Due to numeric representation of floating point numbers in computers, there might occur issues which are discussed many times in many different programming forums.....

As a second point in order to answer the question, you have to answer the following questions:

1. Are both numbers important for TestStand (e.g. because of the report)?

2. Are the numbers already in TestStand available or do they origin elsewhere?

3. Do you ask for performance/datareduction?

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 4
(3,799 Views)

Thanks, Norbert.

 

My tests contain configuring instruments (read and write data) using IVI steps.

For example, I need to configure power supply in loop by setting voltage level from 0V to 3.3V in step of 0.1V.

On each loop iteration I need also to read meausurement data from other instrument (DMM, scope) and compare it to a specific pass/fail criteria.

All these numbers are floating point, they are managed in TestStand and important for the report.

 

I saw discussions on different forums including this one.

In the meantime I created small VI with LabVIEW function "In Range and Coerce" and call it from TestStand, when I need to check whether the number is in the range. Is it good solution?

But what is solution just to compare 2 floating point numbers?

 

Thanks

0 Kudos
Message 3 of 4
(3,795 Views)

If the numbers are already available in TestStand and it is important for the report, i suggest you to make the comparison in TestStand.

The simplest way might be using a Numeric Limit Step when reading the data from the second instrument. I think this is what you are really looking for.

 

In regard to the comparison: you should define a maximum "jitter" (or hysterises or whatever you call it) around your desired value and check for this "corridor". "greater equal, less euqal"  would be the comparison type for the Numeric Limit Step.

 

You should not alter the value in LabVIEW if you require the value, the limits and the result of this comparison to be part of the report.

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 4
(3,788 Views)