Average Error: 45.5 → 0.0
Time: 14.3s
Precision: 64
Ground Truth: 128
\[\frac{e^{x}}{e^{x} - 1}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -4.436569855739804 \cdot 10^{-07}:\\
\;\;\;\;e^{x} \cdot \frac{1}{e^{x} - 1}\\
\mathbf{if}\;x \le 0.08880936985480982:\\
\;\;\;\;\frac{1}{2} + \left(\frac{1}{12} \cdot x + \frac{1}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 - e^{-x}}\\
\end{array}\]
Target
| Original | 45.5 |
| Comparison | 30.2 |
| Herbie | 0.0 |
\[ \frac{1}{1 - e^{-x}} \]
Derivation
- Split input into 3 regimes.
-
if x < -4.436569855739804e-07
Initial program 0.1
\[\frac{e^{x}}{e^{x} - 1}\]
- Using strategy
rm
Applied div-inv 0.1
\[\leadsto \color{blue}{e^{x} \cdot \frac{1}{e^{x} - 1}}\]
if -4.436569855739804e-07 < x < 0.08880936985480982
Initial program 60.8
\[\frac{e^{x}}{e^{x} - 1}\]
Applied taylor 0.0
\[\leadsto \frac{1}{2} + \left(\frac{1}{12} \cdot x + \frac{1}{x}\right)\]
Taylor expanded around 0 0.0
\[\leadsto \color{blue}{\frac{1}{2} + \left(\frac{1}{12} \cdot x + \frac{1}{x}\right)}\]
if 0.08880936985480982 < x
Initial program 61.2
\[\frac{e^{x}}{e^{x} - 1}\]
- Using strategy
rm
Applied clear-num 61.2
\[\leadsto \color{blue}{\frac{1}{\frac{e^{x} - 1}{e^{x}}}}\]
Applied simplify 0.0
\[\leadsto \frac{1}{\color{blue}{1 - e^{-x}}}\]
- Recombined 3 regimes into one program.
- Removed slow pow expressions
Runtime
Please report a bug with the following info:
herbie --seed '#(1570617624 1452639106 4162419203 1378987275 2291276829 4162533703)'
(FPCore (x)
:name "NMSE section 3.11"
:target
(/ 1 (- 1 (exp (- x))))
(/ (exp x) (- (exp x) 1)))