Average Error: 45.4 → 0.0
Time: 10.1s
Precision: 64
Internal precision: 128
\[\frac{e^{x}}{e^{x} - 1}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -5.458497096453193 \cdot 10^{-06}:\\
\;\;\;\;\frac{1}{1 - e^{-x}}\\
\mathbf{if}\;x \le 15.465634390463869:\\
\;\;\;\;\frac{1}{x} + \left(\frac{1}{12} \cdot x + \frac{1}{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 - e^{-x}}\\
\end{array}\]
Target
| Original | 45.4 |
| Comparison | 30.1 |
| Herbie | 0.0 |
\[ \frac{1}{1 - e^{-x}} \]
Derivation
- Split input into 2 regimes.
-
if x < -5.458497096453193e-06 or 15.465634390463869 < x
Initial program 30.4
\[\frac{e^{x}}{e^{x} - 1}\]
- Using strategy
rm
Applied clear-num 30.4
\[\leadsto \color{blue}{\frac{1}{\frac{e^{x} - 1}{e^{x}}}}\]
Applied simplify 0.1
\[\leadsto \frac{1}{\color{blue}{1 - e^{-x}}}\]
if -5.458497096453193e-06 < x < 15.465634390463869
Initial program 60.7
\[\frac{e^{x}}{e^{x} - 1}\]
Applied taylor 0.0
\[\leadsto \frac{1}{x} + \left(\frac{1}{12} \cdot x + \frac{1}{2}\right)\]
Taylor expanded around 0 0.0
\[\leadsto \color{blue}{\frac{1}{x} + \left(\frac{1}{12} \cdot x + \frac{1}{2}\right)}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(2056641123 1002655617 1935656572 1439775833 1455146737 3976603290)'
(FPCore (x)
:name "expq2 (section 3.11)"
:target
(/ 1 (- 1 (exp (- x))))
(/ (exp x) (- (exp x) 1)))