LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What types are supported by the formula node? Specifically, are any unsigned types supported?

As long as i know, you can wire any numerical type to a formula node.
0 Kudos
Message 2 of 5
(4,460 Views)
The input types are set by what you wire into them. The output type defaults to Double. You must declare (Eg. "int output") to change the type of output.
0 Kudos
Message 3 of 5
(4,460 Views)
The question isn't really what types you can hook up to the formula node, but what types you can declare within the formula node.

For example, assume you have hooked a control with type unsigned byte to the formula node labeled "x". For the output you connect an indicator with type unsigned word (16 bits). Inside you have the code:

/* formula node */
int16 y; /* defines output */

y = x;
/* end of formula code */

Let the input be 255. When the VI is run, the output will be 65535! This is because when the expression "y=x;" is executed, the byte value 255 is sign extended upon assignment to the int16 output "y".

Of course the assignment could be rewritten as:

y=x & 255;

so the output will be 255 as expected.

The problem is that this is a little
sloppy. It would be far superior if instead of defining "y" as "int16", it could be defined unsigned such as "uint16" (this doesn't work -- I tried).

The types you can declare inside a formula node (that I know of) are:

int8
int16
int32 (or int)
float32
float64 (or float)

The question is are there any other types available?

Thanks for your input

David Walker
0 Kudos
Message 4 of 5
(4,460 Views)
I hate to be the kind of person who answers my own questions, but here I go anyway...

Unsigned types are, in fact, supported. The complete (I think) list of types that can be used in a formula node are:

int8
int16
int32 (or just 'int')
float32
float64 (or just 'float')
uInt8
uInt16
uInt32 (or just 'uInt')
floatExt

I think that's all, but if anybody knows any others, please post.
0 Kudos
Message 5 of 5
(4,460 Views)