FastLED 3.9.15
Loading...
Searching...
No Matches

◆ pow()

static FASTLED_FORCE_INLINE u16x16 fl::u16x16::pow ( u16x16 base,
u16x16 exp )
inlinestatic

Definition at line 186 of file u16x16.h.

186 {
187 constexpr u16x16 one(1.0f);
188 if (exp.mValue == 0) return one;
189 if (base == one) return one;
190 if (base.mValue == 0) return u16x16();
191 // Snap base values within ~2 ULPs of 1.0 to exactly 1.0 to dodge the
192 // log2(1+t) minimax polynomial's upper-endpoint residual (#2969).
193 constexpr u32 kOneRaw = static_cast<u32>(SCALE);
194 if (base.mValue >= (kOneRaw - 2u) && base.mValue <= kOneRaw) {
195 return one;
196 }
197 return exp2_fp(exp * log2_fp(base));
198 }
static FASTLED_FORCE_INLINE u16x16 exp2_fp(u16x16 x) FL_NOEXCEPT
Definition u16x16.h:255
static FASTLED_FORCE_INLINE u16x16 log2_fp(u16x16 x) FL_NOEXCEPT
Definition u16x16.h:221
constexpr u16x16() FL_NOEXCEPT=default
static constexpr i32 SCALE
Definition u16x16.h:22
enable_if< is_fixed_point< T >::value, T >::type exp(T x) FL_NOEXCEPT

References u16x16(), fl::exp(), exp2_fp(), FASTLED_FORCE_INLINE, FL_NOEXCEPT, log2_fp(), and SCALE.

+ Here is the call graph for this function: