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

◆ pow()

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

Definition at line 173 of file u4x12.h.

173 {
174 if (base.mValue == 0) return u4x12();
175 constexpr u4x12 one(1.0f);
176 if (exp.mValue == 0) return one;
177 if (base == one) return one;
178 // Snap base values within ~2 ULPs of 1.0 to exactly 1.0 to dodge the
179 // log2(1+t) minimax polynomial's upper-endpoint residual (#2969).
180 constexpr u16 kOneRaw = static_cast<u16>(SCALE);
181 if (base.mValue >= static_cast<u16>(kOneRaw - 2) &&
182 base.mValue <= kOneRaw) {
183 return one;
184 }
185 return exp2_fp(exp * log2_fp(base));
186 }
static constexpr i32 SCALE
Definition u4x12.h:22
static FASTLED_FORCE_INLINE u4x12 exp2_fp(u4x12 x) FL_NOEXCEPT
Definition u4x12.h:244
static FASTLED_FORCE_INLINE u4x12 log2_fp(u4x12 x) FL_NOEXCEPT
Definition u4x12.h:209
constexpr u4x12() FL_NOEXCEPT=default
enable_if< is_fixed_point< T >::value, T >::type exp(T x) FL_NOEXCEPT

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

+ Here is the call graph for this function: