Average Error: 41.7 → 0.5
Time: 2.9s
Precision: binary64
\[\frac{e^{x}}{e^{x} - 1} \]
\[\begin{array}{l} t_0 := \sqrt{e^{x}}\\ t_0 \cdot \frac{t_0}{\mathsf{expm1}\left(x\right)} \end{array} \]
\frac{e^{x}}{e^{x} - 1}
\begin{array}{l}
t_0 := \sqrt{e^{x}}\\
t_0 \cdot \frac{t_0}{\mathsf{expm1}\left(x\right)}
\end{array}
(FPCore (x) :precision binary64 (/ (exp x) (- (exp x) 1.0)))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sqrt (exp x)))) (* t_0 (/ t_0 (expm1 x)))))
double code(double x) {
	return exp(x) / (exp(x) - 1.0);
}
double code(double x) {
	double t_0 = sqrt(exp(x));
	return t_0 * (t_0 / expm1(x));
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original41.7
Target41.2
Herbie0.5
\[\frac{1}{1 - e^{-x}} \]

Derivation

  1. Initial program 41.7

    \[\frac{e^{x}}{e^{x} - 1} \]
  2. Simplified0.4

    \[\leadsto \color{blue}{\frac{e^{x}}{\mathsf{expm1}\left(x\right)}} \]
  3. Applied egg-rr0.5

    \[\leadsto \color{blue}{\frac{\sqrt{e^{x}}}{1} \cdot \frac{\sqrt{e^{x}}}{\mathsf{expm1}\left(x\right)}} \]
  4. Final simplification0.5

    \[\leadsto \sqrt{e^{x}} \cdot \frac{\sqrt{e^{x}}}{\mathsf{expm1}\left(x\right)} \]

Reproduce

herbie shell --seed 2022125 
(FPCore (x)
  :name "expq2 (section 3.11)"
  :precision binary64

  :herbie-target
  (/ 1.0 (- 1.0 (exp (- x))))

  (/ (exp x) (- (exp x) 1.0)))