Average Error: 39.6 → 0.0
Time: 2.7s
Precision: binary64
\[\frac{e^{x} - 1}{x} \]
\[{1}^{0.3333333333333333} \cdot \frac{\mathsf{expm1}\left(x\right)}{x} \]
(FPCore (x) :precision binary64 (/ (- (exp x) 1.0) x))
(FPCore (x)
 :precision binary64
 (* (pow 1.0 0.3333333333333333) (/ (expm1 x) x)))
double code(double x) {
	return (exp(x) - 1.0) / x;
}
double code(double x) {
	return pow(1.0, 0.3333333333333333) * (expm1(x) / x);
}
public static double code(double x) {
	return (Math.exp(x) - 1.0) / x;
}
public static double code(double x) {
	return Math.pow(1.0, 0.3333333333333333) * (Math.expm1(x) / x);
}
def code(x):
	return (math.exp(x) - 1.0) / x
def code(x):
	return math.pow(1.0, 0.3333333333333333) * (math.expm1(x) / x)
function code(x)
	return Float64(Float64(exp(x) - 1.0) / x)
end
function code(x)
	return Float64((1.0 ^ 0.3333333333333333) * Float64(expm1(x) / x))
end
code[x_] := N[(N[(N[Exp[x], $MachinePrecision] - 1.0), $MachinePrecision] / x), $MachinePrecision]
code[x_] := N[(N[Power[1.0, 0.3333333333333333], $MachinePrecision] * N[(N[(Exp[x] - 1), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\frac{e^{x} - 1}{x}
{1}^{0.3333333333333333} \cdot \frac{\mathsf{expm1}\left(x\right)}{x}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original39.6
Target40.0
Herbie0.0
\[\begin{array}{l} \mathbf{if}\;x < 1 \land x > -1:\\ \;\;\;\;\frac{e^{x} - 1}{\log \left(e^{x}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x} - 1}{x}\\ \end{array} \]

Derivation

  1. Initial program 39.6

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

    \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(x\right)}{x}} \]
  3. Applied egg-rr41.4

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

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

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

Reproduce

herbie shell --seed 2022156 
(FPCore (x)
  :name "Kahan's exp quotient"
  :precision binary64

  :herbie-target
  (if (and (< x 1.0) (> x -1.0)) (/ (- (exp x) 1.0) (log (exp x))) (/ (- (exp x) 1.0) x))

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