Average Error: 44.9 → 0.2
Time: 3.4s
Precision: 64
Internal precision: 1408
\[\frac{e^{x}}{e^{x} - 1}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -5.075430944100181 \cdot 10^{-08}:\\
\;\;\;\;\frac{e^{x}}{e^{x} - 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)\\
\end{array}\]
Target
| Original | 44.9 |
| Comparison | 44.9 |
| Herbie | 0.2 |
\[ \frac{1}{1 - e^{-x}} \]
Derivation
- Split input into 2 regimes.
-
if x < -5.075430944100181e-08
Initial program 0.2
\[\frac{e^{x}}{e^{x} - 1}\]
if -5.075430944100181e-08 < x
Initial program 60.8
\[\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 '#(1066372953 114334025 411438303 1288252006 2962405338 2829794477)'
(FPCore (x)
:name "expq2 (section 3.11)"
:target
(/ 1 (- 1 (exp (- x))))
(/ (exp x) (- (exp x) 1)))