Average Error: 45.5 → 0.1
Time: 18.1s
Precision: 64
Ground Truth: 128
\[\frac{e^{x}}{e^{x} - 1}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -8.658073314327725 \cdot 10^{-05}:\\
\;\;\;\;\frac{e^{x}}{e^{x} - 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2} + \left(\frac{1}{12} \cdot x + \frac{1}{x}\right)\\
\end{array}\]
Target
| Original | 45.5 |
| Comparison | 45.5 |
| Herbie | 0.1 |
\[ \frac{1}{1 - e^{-x}} \]
Derivation
- Split input into 2 regimes.
-
if x < -8.658073314327725e-05
Initial program 0.1
\[\frac{e^{x}}{e^{x} - 1}\]
if -8.658073314327725e-05 < x
Initial program 60.6
\[\frac{e^{x}}{e^{x} - 1}\]
Applied taylor 0.1
\[\leadsto \frac{1}{2} + \left(\frac{1}{12} \cdot x + \frac{1}{x}\right)\]
Taylor expanded around 0 0.1
\[\leadsto \color{blue}{\frac{1}{2} + \left(\frac{1}{12} \cdot x + \frac{1}{x}\right)}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(159337892 3967392979 2364236447 3188298973 2350036330 69330587)'
(FPCore (x)
:name "NMSE section 3.11"
:target
(/ 1 (- 1 (exp (- x))))
(/ (exp x) (- (exp x) 1)))