From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

raise a number to a power in teststand

Anybody find a way to raise a number to a power in teststand?
0 Kudos
Message 1 of 3
(3,518 Views)
As of TestStand 3.0, you can use the following expression function:

Pow(base, exponent)
This function returns a base value raised to a specified power.
Parameter 1: A number specifying the base value.
Parameter 2: A number specifying the exponent value.
Returns: The number x raised to the power of y.

In 2.0.1 or earlier, your best bet would be to call a code module to do it.

- James
0 Kudos
Message 2 of 3
(3,518 Views)
Thanks. I also discovered if you're looking to raise 2 to a power (i.e. a binary value), you can use the expression "1 << y" where y is the exponent, to left shift a bit some number of bits. Specifically that's what I was trying to do, and this solution worked very well.
0 Kudos
Message 3 of 3
(3,518 Views)