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

◆ exp_impl_double()

double fl::exp_impl_double ( double value)

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

101 {
102 if (value > 10.0)
103 return 22026.465794806718; // e^10 approx
104 if (value < -10.0)
105 return 0.0000453999297625; // e^-10 approx
106
107 // For negative values, use exp(x) = 1/exp(-x) to keep the Taylor series
108 // input non-negative where it converges well with limited terms.
109 if (value < 0.0) {
110 return 1.0 / exp_impl_double(-value);
111 }
112
113 double result = 1.0;
114 double term = 1.0;
115 for (int i = 1; i < 10; ++i) {
116 term *= value / static_cast<double>(i);
117 result += term;
118 }
119 return result;
120}
constexpr int type_rank< T >::value
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31
double exp_impl_double(double value)
Definition math.cpp.hpp:101

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

Referenced by exp(), exp_impl_double(), and pow_impl_double().

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