Average Error: 45.3 → 0.1
Time: 29.5s
Precision: 64
Internal precision: 1408
\[\frac{e^{x}}{e^{x} - 1}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -3.859884253300168 \cdot 10^{-07}:\\
\;\;\;\;\frac{e^{x}}{\frac{e^{x + x} - 1}{e^{x} + 1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2} + \left(\frac{1}{x} + \frac{1}{12} \cdot x\right)\\
\end{array}\]
Target
| Original | 45.3 |
| Comparison | 45.3 |
| Herbie | 0.1 |
\[ \frac{1}{1 - e^{-x}} \]
Derivation
- Split input into 2 regimes.
-
if x < -3.859884253300168e-07
Initial program 0.2
\[\frac{e^{x}}{e^{x} - 1}\]
- Using strategy
rm
Applied flip-- 0.2
\[\leadsto \frac{e^{x}}{\color{blue}{\frac{e^{x} \cdot e^{x} - 1 \cdot 1}{e^{x} + 1}}}\]
Applied simplify 0.2
\[\leadsto \frac{e^{x}}{\frac{\color{blue}{e^{x + x} - 1}}{e^{x} + 1}}\]
if -3.859884253300168e-07 < x
Initial program 60.7
\[\frac{e^{x}}{e^{x} - 1}\]
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 '#(2329929097 3210370195 3111198779 2406363002 3511342718 2136436390)'
(FPCore (x)
:name "expq2 (section 3.11)"
:herbie-target
(/ 1 (- 1 (exp (- x))))
(/ (exp x) (- (exp x) 1)))