ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

Mathscript / Formula node precision

Solved!
Go to solution
Hi i was hoping someone could tell me more about a formula node / mathscript node.  I want to emulate a cordic Algorithm implemented in hardware within LabVIEW.  since the hardware uses 16bit integers i want to do all the mathematics in this precision.  If i pass (or if it is possible to pass) 16 bit integers to a formula node, does the node stick with this precision or does it do the maths in floating point or whatever and return the result as a 16 bit integer?
 
Any suggestions on how to approach this problem would be great.
 
Thanks in advance
 
Craig
LabVIEW 2012
0 Kudos
Message 1 of 3
(9,320 Views)
Solution
Accepted by topic author craigc
Hello Craig,

It is possible to pass a 16-bit integer to a formula node.  Create a formula node and add an input variable.  Drop a numeric constant on the diagram and wire it to the input variable.  Right-click the constant and select Representation >> I16.  However, the formula node will perform the mathematical operations with double-precision internally and then return the results as a 16-bit integer.  The MathScript node also works with double-precision internally, but it will show you the coercion when you wire the 16-bit integer type to the input variable.

To remain with 16-bit integers, you could use LabVIEW primitives to perform the mathematical operations instead of using a formula or MathScript node.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
Message 2 of 3
(9,315 Views)

Thanks Grant,

not exactly what i wanted to hear because as you say i may be back to primitives, however you answered my question exactly.

 

regards

Craig

LabVIEW 2012
0 Kudos
Message 3 of 3
(9,312 Views)