Average Error: 0.0 → 0.3
Time: 1.8s
Precision: binary64
\[-\log \left(\frac{1}{x} - 1\right) \]
\[{x}^{2} \cdot 0.5 + \left(x + \left(\log x + {x}^{3} \cdot 0.3333333333333333\right)\right) \]
(FPCore (x) :precision binary64 (- (log (- (/ 1.0 x) 1.0))))
(FPCore (x)
 :precision binary64
 (+ (* (pow x 2.0) 0.5) (+ x (+ (log x) (* (pow x 3.0) 0.3333333333333333)))))
double code(double x) {
	return -log(((1.0 / x) - 1.0));
}
double code(double x) {
	return (pow(x, 2.0) * 0.5) + (x + (log(x) + (pow(x, 3.0) * 0.3333333333333333)));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = -log(((1.0d0 / x) - 1.0d0))
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((x ** 2.0d0) * 0.5d0) + (x + (log(x) + ((x ** 3.0d0) * 0.3333333333333333d0)))
end function
public static double code(double x) {
	return -Math.log(((1.0 / x) - 1.0));
}
public static double code(double x) {
	return (Math.pow(x, 2.0) * 0.5) + (x + (Math.log(x) + (Math.pow(x, 3.0) * 0.3333333333333333)));
}
def code(x):
	return -math.log(((1.0 / x) - 1.0))
def code(x):
	return (math.pow(x, 2.0) * 0.5) + (x + (math.log(x) + (math.pow(x, 3.0) * 0.3333333333333333)))
function code(x)
	return Float64(-log(Float64(Float64(1.0 / x) - 1.0)))
end
function code(x)
	return Float64(Float64((x ^ 2.0) * 0.5) + Float64(x + Float64(log(x) + Float64((x ^ 3.0) * 0.3333333333333333))))
end
function tmp = code(x)
	tmp = -log(((1.0 / x) - 1.0));
end
function tmp = code(x)
	tmp = ((x ^ 2.0) * 0.5) + (x + (log(x) + ((x ^ 3.0) * 0.3333333333333333)));
end
code[x_] := (-N[Log[N[(N[(1.0 / x), $MachinePrecision] - 1.0), $MachinePrecision]], $MachinePrecision])
code[x_] := N[(N[(N[Power[x, 2.0], $MachinePrecision] * 0.5), $MachinePrecision] + N[(x + N[(N[Log[x], $MachinePrecision] + N[(N[Power[x, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
-\log \left(\frac{1}{x} - 1\right)
{x}^{2} \cdot 0.5 + \left(x + \left(\log x + {x}^{3} \cdot 0.3333333333333333\right)\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[-\log \left(\frac{1}{x} - 1\right) \]
  2. Simplified0.0

    \[\leadsto \color{blue}{-\log \left(\frac{1}{x} + -1\right)} \]
  3. Taylor expanded in x around 0 0.3

    \[\leadsto -\color{blue}{\left(-0.5 \cdot {x}^{2} + \left(-1 \cdot x + \left(-0.3333333333333333 \cdot {x}^{3} + -1 \cdot \log x\right)\right)\right)} \]
  4. Final simplification0.3

    \[\leadsto {x}^{2} \cdot 0.5 + \left(x + \left(\log x + {x}^{3} \cdot 0.3333333333333333\right)\right) \]

Reproduce

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