| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 6784 |
\[-\log \left(\frac{1}{x} + -1\right)
\]
(FPCore (x) :precision binary64 (- (log (- (/ 1.0 x) 1.0))))
(FPCore (x) :precision binary64 (- (log (expm1 (- (log x))))))
double code(double x) {
return -log(((1.0 / x) - 1.0));
}
double code(double x) {
return -log(expm1(-log(x)));
}
public static double code(double x) {
return -Math.log(((1.0 / x) - 1.0));
}
public static double code(double x) {
return -Math.log(Math.expm1(-Math.log(x)));
}
def code(x): return -math.log(((1.0 / x) - 1.0))
def code(x): return -math.log(math.expm1(-math.log(x)))
function code(x) return Float64(-log(Float64(Float64(1.0 / x) - 1.0))) end
function code(x) return Float64(-log(expm1(Float64(-log(x))))) end
code[x_] := (-N[Log[N[(N[(1.0 / x), $MachinePrecision] - 1.0), $MachinePrecision]], $MachinePrecision])
code[x_] := (-N[Log[N[(Exp[(-N[Log[x], $MachinePrecision])] - 1), $MachinePrecision]], $MachinePrecision])
-\log \left(\frac{1}{x} - 1\right)
-\log \left(\mathsf{expm1}\left(-\log x\right)\right)
Results
Initial program 100.0%
Applied egg-rr100.0%
Final simplification100.0%
| Alternative 1 | |
|---|---|
| Accuracy | 100.0% |
| Cost | 6784 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.1% |
| Cost | 6592 |
| Alternative 3 | |
|---|---|
| Accuracy | 0.0% |
| Cost | 6528 |
| Alternative 4 | |
|---|---|
| Accuracy | 98.2% |
| Cost | 6464 |
herbie shell --seed 2023129
(FPCore (x)
:name "neg log"
:precision binary64
(- (log (- (/ 1.0 x) 1.0))))