LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Atto-Volts

The attached file has a slider with increment set to 5mV and coerce to nearest. Two questions:

Many times when moving the slider, it goes to -6.07 aV (atto volts = 10^-18 = essentially zero). Shouldn't it just say zero?--this is annoying. Most people don't know what a measurement of "-6.07 aV" means when it should say "0 V" or "0 mV". Isn't the coerce setting for the increment supposed to take care of this?

Second... there are two unit captions that show up when the units are enabled... one with the SI prefix added depending on value, and one without. Is there a way to get rid of the one without (as it is in the way)?
0 Kudos
Message 1 of 4
(2,832 Views)
to be shure it starts at 0, enter a 0 value in your control, then chose "Data operation - Make current value default" and save the vi.

You problem shall disappear.

Cheers.

Doc-Doc
Doc-Doc
http://www.machinevision.ch
http://visionindustrielle.ch
Please take time to rate this answer
0 Kudos
Message 2 of 4
(2,832 Views)
I suspect that you are seeing the effects of the finite binary representation of floating point numbers. None of your limits (0.1, -0.1, increment = 0.005) are exactly represented in binary. (0.1 decimal = .00011001100110011... binary). They are all repeating fractions. Thus the attovolt result is the closest it gets.

One option for your user interface might be to make the slider an integer with a range of +/-100 and increment of 5. Then multiply by 0.001 on the block diagram.

Lynn
Message 3 of 4
(2,832 Views)
You get a star for that answer... very good. It took me long enough to prove this is what was really happening but I got there.

The problem here is that the coercion routines for the float values aren't really coercing the slider value to 5mV increments. Where the last few (4 that I could see) least significant digits differ, they are not interpreted as a numerical difference, and aren't coerced.

So when the slider is moved to -5mV, it may be -5mV, or it may be -5mV +/- a few bits, which is also interpreted as -5mV, and just left as -5mV +/- a few instead of -5mV exactly (and by exactly, I mean whatever the repeating fraction comes out to when you go from decimal to binary). That's the problem--that it isn't set to the exact value. When it's t
hen +/- a few bits, and you move the pointer towards zero, you get a few bits leftover, but an increment value that still falls within the exact 5mV coercion test. And instead of saying (5mV exactly) - (5mV exactly) = 0, it says, (5mV +/- a few bits) - (5mV exactly) = -6.07aV.

I don't see how NI would even fix this--it's just annoying. I can't multiply by some constant on the block diagram without a lot of trouble because I'm dynamically modifying the limit values of the slider. There might be a related workaround though--thanks for the suggestion.

For curiousity's sake in the guts of the floating point problem and how I arrived at the above conclusion, see the second attached VI, which basically caluclates the value of a float from binary and shows how LabVIEW interprets two different numbers as one and the same since the significant digits are E-18 or thereabouts.
0 Kudos
Message 4 of 4
(2,832 Views)