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

◆ pow()

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

Definition at line 206 of file s12x4.h.

206 {
207 if (base.mValue <= 0) return s12x4();
208 constexpr s12x4 one(1.0f);
209 if (exp.mValue == 0) return one;
210 if (base == one) return one;
211 // Snap base values within ~2 ULPs of 1.0 to exactly 1.0 to dodge the
212 // log2(1+t) minimax polynomial's upper-endpoint residual (#2969).
213 constexpr i16 kOneRaw = static_cast<i16>(SCALE);
214 if (base.mValue >= static_cast<i16>(kOneRaw - 2) &&
215 base.mValue <= kOneRaw) {
216 return one;
217 }
218 return exp2_fp(exp * log2_fp(base));
219 }
static FASTLED_FORCE_INLINE s12x4 exp2_fp(s12x4 x) FL_NOEXCEPT
Definition s12x4.h:345
static constexpr i32 SCALE
Definition s12x4.h:23
constexpr s12x4() FL_NOEXCEPT=default
static FASTLED_FORCE_INLINE s12x4 log2_fp(s12x4 x) FL_NOEXCEPT
Definition s12x4.h:310
enable_if< is_fixed_point< T >::value, T >::type exp(T x) FL_NOEXCEPT

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

+ Here is the call graph for this function: