Average Error: 45.1 → 0.2
Time: 10.3s
Precision: 64
Internal precision: 1408
\[\frac{e^{x}}{e^{x} - 1}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -6.667433711053936 \cdot 10^{-08}:\\
\;\;\;\;\frac{e^{x}}{\log \left(e^{e^{x} - 1}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)\\
\end{array}\]
Derivation
- Split input into 2 regimes.
-
if x < -6.667433711053936e-08
Initial program 0.3
\[\frac{e^{x}}{e^{x} - 1}\]
- Using strategy
rm
Applied add-log-exp 0.3
\[\leadsto \frac{e^{x}}{\color{blue}{\log \left(e^{e^{x} - 1}\right)}}\]
if -6.667433711053936e-08 < x
Initial program 60.7
\[\frac{e^{x}}{e^{x} - 1}\]
Applied taylor 0.1
\[\leadsto \frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)\]
Taylor expanded around 0 0.1
\[\leadsto \color{blue}{\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie shell --seed '#(3052192724 3812927732 3686175817 630908657 2373248591 511094450)'
(FPCore (x)
:name "NMSE section 3.11"
:pre (!= x 0)
(/ (exp x) (- (exp x) 1)))