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

◆ exp_impl_float()

float fl::exp_impl_float ( float value)

Definition at line 80 of file math.cpp.hpp.

80 {
81 if (value > 10.0f)
82 return 22026.465794806718f; // e^10 approx
83 if (value < -10.0f)
84 return 0.0000453999297625f; // e^-10 approx
85
86 // For negative values, use exp(x) = 1/exp(-x) to keep the Taylor series
87 // input non-negative where it converges well with limited terms.
88 if (value < 0.0f) {
89 return 1.0f / exp_impl_float(-value);
90 }
91
92 float result = 1.0f;
93 float term = 1.0f;
94 for (int i = 1; i < 10; ++i) {
95 term *= value / static_cast<float>(i);
96 result += term;
97 }
98 return result;
99}
constexpr int type_rank< T >::value
float exp_impl_float(float value)
Definition math.cpp.hpp:80
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31

References exp_impl_float(), and type_rank< T >::value.

Referenced by exp(), exp_impl_float(), expf(), and pow_impl_float().

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