?

Average Accuracy: 100.0% → 100.0%
Time: 2.4s
Precision: binary64
Cost: 19392

?

\[-\log \left(\frac{1}{x} - 1\right) \]
\[-\log \left(\mathsf{expm1}\left(-\log x\right)\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)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 100.0%

    \[-\log \left(\frac{1}{x} - 1\right) \]
  2. Applied egg-rr100.0%

    \[\leadsto -\log \color{blue}{\left(\mathsf{expm1}\left(-\log x\right)\right)} \]
  3. Final simplification100.0%

    \[\leadsto -\log \left(\mathsf{expm1}\left(-\log x\right)\right) \]

Alternatives

Alternative 1
Accuracy100.0%
Cost6784
\[-\log \left(\frac{1}{x} + -1\right) \]
Alternative 2
Accuracy99.1%
Cost6592
\[x + \log x \]
Alternative 3
Accuracy0.0%
Cost6528
\[-\log -1 \]
Alternative 4
Accuracy98.2%
Cost6464
\[\log x \]

Error

Reproduce?

herbie shell --seed 2023129 
(FPCore (x)
  :name "neg log"
  :precision binary64
  (- (log (- (/ 1.0 x) 1.0))))