9.7.3.21. Floating Point Instructions: ex2
ex2
Find the base-2 exponential of a value.
Syntax
ptx
ex2.approx{.ftz}.f32 d, a;Description
Raise 2 to the power a.
Semantics
ptx
d = 2 ^ a;Notes
ex2.approx.f32 implements a fast approximation to 2^a.
| Input | Result |
|---|---|
| -Inf | +0.0 |
| -0.0 | +1.0 |
| +0.0 | +1.0 |
| +Inf | +Inf |
| NaN | NaN |
The maximum ulp error is 2 ulp from correctly rounded result across the full range of inputs.
Subnormal numbers:
sm_20+- By default, subnormal numbers are supported.
ex2.ftz.f32flushes subnormal inputs and results to sign-preserving zero.sm_1x- Subnormal inputs and results to sign-preserving zero.
PTX ISA Notes
ex2.f32 introduced in PTX ISA version 1.0. Explicit modifiers .approx and .ftz introduced in PTX ISA version 1.4.
For PTX ISA version 1.4 and later, the .approx modifier is required.
For PTX ISA versions 1.0 through 1.3, ex2.f32 defaults to ex2.approx.ftz.f32.
Target ISA Notes
Supported on all target architectures.
Examples
ptx
ex2.approx.ftz.f32 xa, a;