FastLED 3.10.6
Loading...
Searching...
No Matches

◆ pow()

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

Definition at line 279 of file s16x16.h.

279 {
280 if (base.mValue <= 0) return s16x16();
281 constexpr s16x16 one(1.0f);
282 if (exp.mValue == 0) return one;
283 if (base == one) return one;
284 // Snap base values within ~2 ULPs of 1.0 to exactly 1.0 to dodge the
285 // log2(1+t) minimax polynomial's upper-endpoint residual (#2969).
286 constexpr i32 kOneRaw = static_cast<i32>(SCALE);
287 if (base.mValue >= (kOneRaw - 2) && base.mValue <= kOneRaw) {
288 return one;
289 }
290 return exp2_fp(exp * log2_fp(base));
291 }
static constexpr i32 SCALE
Definition s16x16.h:25
static FASTLED_FORCE_INLINE s16x16 exp2_fp(s16x16 x) FL_NO_EXCEPT
Definition s16x16.h:419
static FASTLED_FORCE_INLINE s16x16 log2_fp(s16x16 x) FL_NO_EXCEPT
Definition s16x16.h:384
constexpr s16x16() FL_NO_EXCEPT=default
enable_if< is_fixed_point< T >::value, T >::type exp(T x) FL_NO_EXCEPT

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

Referenced by fl::applyGamma_video(), and fl::FlowFieldFP::flowAdvect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: