Name

ldexp - returns x times 2 rained to n

Synopsis

float  ldexp(float x, float n);
float1 ldexp(float1 x, float1 n);
float2 ldexp(float2 x, float2 n);
float3 ldexp(float3 x, float3 n);
float4 ldexp(float4 x, float4 n);

half   ldexp(half x, half n);
half1  ldexp(half1 x, half1 n);
half2  ldexp(half2 x, half2 n);
half3  ldexp(half3 x, half3 n);
half4  ldexp(half4 x, half4 n);

fixed  ldexp(fixed x, fixed n);
fixed1 ldexp(fixed1 x, fixed1 n);
fixed2 ldexp(fixed2 x, fixed2 n);
fixed3 ldexp(fixed3 x, fixed3 n);
fixed4 ldexp(fixed4 x, fixed4 n);

Parameters

x
Vector or scalar.
n
Vector or scalar for power with which to raise 2.

Description

ldexp returns x times 2 raised to the power n.

Reference Implementation

ldexp for float2 vectors x and n could be implemented as:

float2 ldexp(float2 x, float2 n)
{
  return x * exp2(n);
}

Profile Support

ldexp is supported in all profiles but fp20.

See Also

exp2, modf, pow