LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Spectre_Dave

Add Precision Level to Comparison Functions

Status: Declined

Any idea that has received less than 4 kudos within 4 years after posting will be automatically declined.

Say you are comparing two Floating Point Numbers 1.00000120 and 1.00000116.

 

With the optional Precision input you could:

Case 1    Compare out to 5 digits =True

Case 2    Compare out to 7 Digits =  False

Default   Compare all digits = False

Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
8 Comments
JackDunaway
Trusted Enthusiast
Current method would involve comparing the difference of the two numbers to a known threshold - it's easy to see the code on the BD, and nothing is hidden. Could you suggest a graphical indication for this type of "threshold comparison"? I would not want to see this type of comparison unless indicated somehow on the BD.
Darin.K
Trusted Enthusiast

Buried in vi.lib\Waveform\WDTOps.llb is a VI called Check for Equality.vi (hat-tip to DFGray for pointing this out at some time).   It would be a good start for what you are looking for.  It handles the NaN/Inf situations and returns the precision with which the two DBL inputs match.  As it is written (looks quite old based on the connector pane), it arbitrarily selects 6 digits as equality and for trivial cases returns a seemingly random value of 10 for the measured precision.  The equality threshold can be changed to a control.  As with all vi.lib VIs, save your own copy before changing.

 

This has done the job for me, the few times I have needed it.

Spectre_Dave
Active Participant

I envision an optional terminal extending from the center of the function - similar to Trim Whitespace.vi

 

 

Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
JackDunaway
Trusted Enthusiast
VADave, the source of your file is from "My Documents" on your local drive. Try uploading the picture again.
Spectre_Dave
Active Participant
I am unable to upload the JPEG from my PC at work.  I'll upload from a real computer (Mac)  tonight from home.
Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
Spectre_Dave
Active Participant

Here is the Image made on a Mac. 

 

 

Equal w/ Precision

Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
RavensFan
Knight of NI

VADave,

 

I don't want to start a Mac vs. PC debate with you (Mac's really aren't all that great, 90% of the world uses PCs, and most of us PC users are able to insert images just fine), but Mac vs. PC has nothing to do with the picture not showing up.  In the first post, you attached a picture that was located on your harddrive.  In your later post, you used the new picture upload method that moves the file you picked to your picture gallery and the message links to that.

 

Now that the picture is in your picture gallery, don't ever clean out your picture gallery because the link in the second post will go as dead as the link in your first post.

 

The best way to insert pictures is to attach them to your message as file.  (Note that the Idea Exchange editor sucks and doesn't work as well as the regular forums.)  Then once you've posted the message, insert the image using the image button, but go to the third tab and have it point to the file location that is on the NI servers.  You can get that location by looking at the properties of the link.

Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 4 kudos within 4 years after posting will be automatically declined.