MATLAB: Does POW2 throw an error when executed with an integer for its second input argument in MATLAB 7.9 (R2009b)

MATLAB

The documentation for POW2 states that the function "corresponds to the ANSI C function ldexp() and the IEEE floating point standard function scalbn()."
Looking into the specification for ldexp() available here:
<http://docs.sun.com/app/docs/doc/806-3335/6jcg81a1j?a=view>
I find that LDEXP is defined as
double ldexp(double x, int exp);
with the second input being an integer.
However, the MATLAB function POW2 is not defined for integers as the second input as the following command demonstrates:
pow2(double(1.5),int32(2))
??? Undefined function or method 'pow2' for input arguments of type 'int32'.

Best Answer

The statement referenced in the documentation refers to the behavior of the function with respect to its input values, not necessarily to its input types. POW2 is not currently supported for any integer input.
The function does accept double-precision floating point numbers that represent integers (flints) and should return the same result as calling ldexp() or scalbn() with the corresponding integer input.