LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does LabVIEW generate -0?

Solved!
Go to solution

now try with complex numbers!

 

nearly as much fun as tracking down.... (BTW, nice equipment,,, I allways will respect a squid [ If you have served in the US Navy you don't need the wiki disabiguation page to get the pun])

 

Glad to have entertained you!


"Should be" isn't "Is" -Jay
0 Kudos
Message 11 of 15
(474 Views)

@Darin.K wrote:

OK I got a chance to play with this, and it is even more fun than I could have imagined!

 

First of all Max&Min does the conditional swap as I expected and it is all good.  You get the outputs back in the same order.

 

Now I start playing with other special cases of the spec: (LV10)

 

1. Drop a sqrt function, create an indicator and create a constant on the input, enter -0.0

2. Ctrl-drag the -0 contant and wire the copy to both terminals of an add function, create an indicator

3. Run the VI and look at the two values.

4. Change the value in the constant wired to the add function to 0

5. Run the VI, both values change!

 

Probably some weird constant-folding thing going on.



Sounds logical, since -0 = 0 it can fold them both to one constant, probably the first found. I assume if you do it in another order both outputs will be +0 instead.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 12 of 15
(462 Views)

@JÞB wrote:

now try with complex numbers!

 

nearly as much fun as tracking down.... (BTW, nice equipment,,, I allways will respect a squid [ If you have served in the US Navy you don't need the wiki disabiguation page to get the pun])

 

Glad to have entertained you!


Really that was an entertainment and funny.. Came to know these kind of funny behaviour and became more eager still how many kinda stuffs are there.. Will explore those in spare time.

-----

The best solution is the one you find it by yourself
Message 13 of 15
(437 Views)

@P Anand wrote:

@JÞB wrote:

now try with complex numbers!

 

nearly as much fun as tracking down.... (BTW, nice equipment,,, I allways will respect a squid [ If you have served in the US Navy you don't need the wiki disabiguation page to get the pun])

 

Glad to have entertained you!


Really that was an entertainment and funny.. Came to know these kind of funny behaviour and became more eager still how many kinda stuffs are there.. Will explore those in spare time.


That's the spirit!  LabVIEW used to ship posters with " LabVIEW 7 Express - Its OK to have fun!"  Enjoy your learning!


"Should be" isn't "Is" -Jay
0 Kudos
Message 14 of 15
(430 Views)

Clearly there is some buffer reuse going on and the compiler is figuring that 0=-0.  I can use highlight execution and see -0.000E+0 coming out of constants with a value of 0.0 and vice versa.  Wireless communication or spooky action at a distance?

 

I can usually play around at find which constant is the "real zero" and which ones are simply reusing it.  With a simple reciprocal I can twiddle a constant on the BD and change a completely separate output to plus or minus infinity, doesn't get much further apart than that!

Message 15 of 15
(416 Views)