Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

pow2

Base 2 power and scale floating-point numbers

Syntax

X = pow2(Y)
X = pow2(F,E)

Description

X = pow2(Y) returns an array X whose elements are 2 raised to the power Y.

X = pow2(F,E) computes x = f * 2e for corresponding elements of F and E. The result is computed quickly by simply adding E to the floating-point exponent of F. Arguments F and E are real and integer arrays, respectively.

Examples

For IEEE® arithmetic, the statement X = pow2(F,E) yields the values:

    F         E        X
    1/2       1        1
    pi/4      2        pi
    -3/4      2        -3
    1/2       -51      eps
    1-eps/2   1024     realmax
    1/2       -1021    realmin 

More About

collapse all

Tall Array Support

This function fully supports tall arrays. For more information, see Tall Arrays.

Tips

This function corresponds to the ANSI® C function ldexp() and the IEEE floating-point standard function scalbn().

See Also

| | | | | |

Introduced before R2006a

Was this topic helpful?