11-14-2009 12:29 PM
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 ofprecision 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?
11-14-2009 01:25 PM
(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).
11-14-2009 02:00 PM
March 2004, LabVIEW 8.0 I guess.
Thanks for the tip, but would you please specify what "legal" stands for.
11-14-2009 02:18 PM
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
11-14-2009 02:18 PM
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.
11-14-2009 02:20 PM - edited 11-14-2009 02:22 PM
Allready said... and I was writing nonsense...
Felix