LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Square Root VI involving decision making

This is a simple VI that calculates the sqrt of the indicator value. It's a sample from NI LabVIEW student manual:

 

True case ( value >= 0 ), False case ( value < 0 )

 

My questions are:

 

1) What does this mean " 

Right-click the numeric constant and select Properties from theshortcut menu. Select the

Format and Precision tab. Set Digits of

precision to 1, select Floating point notation, and click the OK

button to ensure there is no data conversion between the constant and

the numeric indicator outside the Case structure.

"

 

2) What does -99999.0 stand for?

 

T. A.
0 Kudos
Message 1 of 6
(4,554 Views)

(1) This makes little sense (how old is your book???). To avoid data coercion, all you need to do is set the representation of the diagram constant to DBL. The display format of the diagram constant is just cosmetic.

 

(2) If the value is illegal, you need to display someting "special" to indicate that fact. I guess the programmer thought a -99999.0 would be obvious, but that's just some private convention and depends on the specifications. You can display anything else, but make sure it's not a legal result. (A better choice would have been e.g. NaN).

Message 2 of 6
(4,539 Views)

March 2004, LabVIEW 8.0 I guess.

 

Thanks for the tip, but would you please specify what "legal" stands for.

T. A.
0 Kudos
Message 3 of 6
(4,529 Views)


 

Thanks for the tip, but would you please specify what "legal" stands for.


In this case. "Legal" number  has the same meaning as "Real number".  The square root of a NEGATIVE number ic a "Complex Number" and cannot fit into a DBL indicator.  In fact the SQRT function has a limitation as it can only return a value of DBL type.   This type of limitation of SQRT function makes LabVIEW behave just like most calculators and identical to common programming languages.  (Caution Soapbox ahead: ) For the mathmatical purists this is a source of some constant grumbling as their are exactly two solutions for square soot of any non-zero number |eg Sqrt(1)=[1,-1] and sqrt(-1) =[1i,-1i] | and of coarse the special case sqrt(0)=0


"Should be" isn't "Is" -Jay
Message 4 of 6
(4,523 Views)

You don't want to display a value that cannot be distignuised from a proper result.

 

For example of you would display a result of "4" if the input is negative, you would not be able to tell if the value was negative or +16, because both would give the same output.

0 Kudos
Message 5 of 6
(4,522 Views)

Allready said... and I was writing nonsense...

 

Felix

Message Edited by F. Schubert on 11-14-2009 02:22 PM
0 Kudos
Message 6 of 6
(4,521 Views)