(FPCore (x) :precision binary64 (/ (exp x) (- (exp x) 1.0)))
(FPCore (x) :precision binary64 (pow (- (expm1 (- x))) -1.0))
double code(double x) {
return exp(x) / (exp(x) - 1.0);
}
double code(double x) {
return pow(-expm1(-x), -1.0);
}
public static double code(double x) {
return Math.exp(x) / (Math.exp(x) - 1.0);
}
public static double code(double x) {
return Math.pow(-Math.expm1(-x), -1.0);
}
def code(x): return math.exp(x) / (math.exp(x) - 1.0)
def code(x): return math.pow(-math.expm1(-x), -1.0)
function code(x) return Float64(exp(x) / Float64(exp(x) - 1.0)) end
function code(x) return Float64(-expm1(Float64(-x))) ^ -1.0 end
code[x_] := N[(N[Exp[x], $MachinePrecision] / N[(N[Exp[x], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]
code[x_] := N[Power[(-N[(Exp[(-x)] - 1), $MachinePrecision]), -1.0], $MachinePrecision]
\frac{e^{x}}{e^{x} - 1}
{\left(-\mathsf{expm1}\left(-x\right)\right)}^{-1}
Results
| Original | 41.6 |
|---|---|
| Target | 41.2 |
| Herbie | 0.0 |
Initial program 41.6
Simplified0.4
Applied egg-rr0.4
Taylor expanded in x around inf 41.6
Simplified0.0
Final simplification0.0
herbie shell --seed 2022206
(FPCore (x)
:name "expq2 (section 3.11)"
:precision binary64
:herbie-target
(/ 1.0 (- 1.0 (exp (- x))))
(/ (exp x) (- (exp x) 1.0)))