Scale By Power Of 2 Function
- Updated2025-07-30
- 3 minute(s) read
Multiplies x by 2 raised to the power of n.
If x is an integer or fixed-point number, this function is the equivalent of an arithmetic shift. The connector pane displays the default data types for this polymorphic function.

Inputs/Outputs
n
—
n can be a scalar number, array or cluster of numbers, array of clusters of numbers, and so on. If n is a floating-point number, this function rounds n before it scales x (0.5 rounds to 0; 0.51 rounds to 1). If n is a 64-bit integer, LabVIEW coerces n to a 32-bit integer.
x
—
x can be a scalar number, array or cluster of numbers, array of clusters of numbers, and so on.
x*2^n
—
x*2^n is the result of multiplying x by 2, raised to the power of n. |
If you wire a fixed-point value to this function, the resulting output value retains the fixed-point configuration settings of the input value. However, the value is likely to truncate or wrap.
FPGA Module Details
The following details apply when you use this object in an FPGA VI.
| Single-Cycle Timed Loop | Supported. |
| Usage | If you wire a constant directly to the n input, this function uses no space on the FPGA and requires no clock cycles. If you use this function with the single-precision floating-point data type, refer to the Using the Single-Precision Floating-Point Data Type and Deciding Which Data Type to Use in FPGA Designs topics for resource use, latency, and single-cycle Timed Loop support implications. |
| Timing | Inside single-cycle Timed Loop--If n is not a constant and you use this function inside a single-cycle Timed Loop, the combinatorial logic delay is proportional to the number of bits in x. Outside single-cycle Timed Loop--If n is not a constant and you use this function outside a single-cycle Timed Loop, it takes one clock cycle and uses one register. |
| Resources | If n is not a constant, this function requires FPGA resources in proportion to the number of bits in x. |
Examples
Refer to the following example files included with LabVIEW.
- labview\examples\Numerics\Numeric Functions.vi
n
—
x
—
x*2^n
—