Average Error: 45.3 → 0.2
Time: 4.2s
Precision: 64
Internal precision: 1408
\[\frac{e^{x}}{e^{x} - 1}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le -2.657023345002393 \cdot 10^{-12}:\\
\;\;\;\;\left(\sqrt[3]{\frac{e^{x}}{e^{x} - 1}} \cdot \sqrt[3]{\frac{e^{x}}{e^{x} - 1}}\right) \cdot \sqrt[3]{\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 | 45.3 |
| Comparison | 45.3 |
| Herbie | 0.2 |
\[ \frac{1}{1 - e^{-x}} \]
Derivation
- Split input into 2 regimes.
-
if x < -2.657023345002393e-12
Initial program 0.5
\[\frac{e^{x}}{e^{x} - 1}\]
- Using strategy
rm
Applied add-cube-cbrt 0.5
\[\leadsto \color{blue}{\left(\sqrt[3]{\frac{e^{x}}{e^{x} - 1}} \cdot \sqrt[3]{\frac{e^{x}}{e^{x} - 1}}\right) \cdot \sqrt[3]{\frac{e^{x}}{e^{x} - 1}}}\]
if -2.657023345002393e-12 < x
Initial program 60.9
\[\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 '#(1067901057 3396600083 3715501224 3126139233 3908045574 1593683916)'
(FPCore (x)
:name "expq2 (section 3.11)"
:target
(/ 1 (- 1 (exp (- x))))
(/ (exp x) (- (exp x) 1)))