FastLED 3.10.8
Loading...
Searching...
No Matches

◆ pow()

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

Definition at line 195 of file u16x16.h.

195 {
196 constexpr u16x16 one(1.0f);
197 if (exp.mValue == 0) return one;
198 if (base == one) return one;
199 if (base.mValue == 0) return u16x16();
200 // Snap base values within ~2 ULPs of 1.0 to exactly 1.0 to dodge the
201 // log2(1+t) minimax polynomial's upper-endpoint residual (#2969).
202 constexpr u32 kOneRaw = static_cast<u32>(SCALE);
203 if (base.mValue >= (kOneRaw - 2u) && base.mValue <= kOneRaw) {
204 return one;
205 }
206 return exp2_fp(exp * log2_fp(base));
207 }
static FASTLED_FORCE_INLINE u16x16 exp2_fp(u16x16 x) FL_NO_EXCEPT
Definition u16x16.h:264
constexpr u16x16() FL_NO_EXCEPT=default
static constexpr i32 SCALE
Definition u16x16.h:23
static FASTLED_FORCE_INLINE u16x16 log2_fp(u16x16 x) FL_NO_EXCEPT
Definition u16x16.h:230
enable_if< is_fixed_point< T >::value, T >::type exp(T x) FL_NO_EXCEPT

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

+ Here is the call graph for this function: