Average Error: 6.1 → 0.5
Time: 9.2s
Precision: binary64
\[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
\[\left(\left(\log x \cdot \left(x - 0.5\right) + 0.91893853320467\right) - x\right) + \left(\left(\frac{1}{\frac{x}{0.083333333333333}} + \left(z \cdot \frac{z}{x}\right) \cdot \left(0.0007936500793651 + y\right)\right) + \frac{z}{x} \cdot -0.0027777777777778\right) \]
(FPCore (x y z)
 :precision binary64
 (+
  (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
  (/
   (+
    (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
    0.083333333333333)
   x)))
(FPCore (x y z)
 :precision binary64
 (+
  (- (+ (* (log x) (- x 0.5)) 0.91893853320467) x)
  (+
   (+
    (/ 1.0 (/ x 0.083333333333333))
    (* (* z (/ z x)) (+ 0.0007936500793651 y)))
   (* (/ z x) -0.0027777777777778))))
double code(double x, double y, double z) {
	return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
double code(double x, double y, double z) {
	return (((log(x) * (x - 0.5)) + 0.91893853320467) - x) + (((1.0 / (x / 0.083333333333333)) + ((z * (z / x)) * (0.0007936500793651 + y))) + ((z / x) * -0.0027777777777778));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (((log(x) * (x - 0.5d0)) + 0.91893853320467d0) - x) + (((1.0d0 / (x / 0.083333333333333d0)) + ((z * (z / x)) * (0.0007936500793651d0 + y))) + ((z / x) * (-0.0027777777777778d0)))
end function
public static double code(double x, double y, double z) {
	return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
public static double code(double x, double y, double z) {
	return (((Math.log(x) * (x - 0.5)) + 0.91893853320467) - x) + (((1.0 / (x / 0.083333333333333)) + ((z * (z / x)) * (0.0007936500793651 + y))) + ((z / x) * -0.0027777777777778));
}
def code(x, y, z):
	return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)
def code(x, y, z):
	return (((math.log(x) * (x - 0.5)) + 0.91893853320467) - x) + (((1.0 / (x / 0.083333333333333)) + ((z * (z / x)) * (0.0007936500793651 + y))) + ((z / x) * -0.0027777777777778))
function code(x, y, z)
	return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x))
end
function code(x, y, z)
	return Float64(Float64(Float64(Float64(log(x) * Float64(x - 0.5)) + 0.91893853320467) - x) + Float64(Float64(Float64(1.0 / Float64(x / 0.083333333333333)) + Float64(Float64(z * Float64(z / x)) * Float64(0.0007936500793651 + y))) + Float64(Float64(z / x) * -0.0027777777777778)))
end
function tmp = code(x, y, z)
	tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
end
function tmp = code(x, y, z)
	tmp = (((log(x) * (x - 0.5)) + 0.91893853320467) - x) + (((1.0 / (x / 0.083333333333333)) + ((z * (z / x)) * (0.0007936500793651 + y))) + ((z / x) * -0.0027777777777778));
end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] + 0.91893853320467), $MachinePrecision] - x), $MachinePrecision] + N[(N[(N[(1.0 / N[(x / 0.083333333333333), $MachinePrecision]), $MachinePrecision] + N[(N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision] * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z / x), $MachinePrecision] * -0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}
\left(\left(\log x \cdot \left(x - 0.5\right) + 0.91893853320467\right) - x\right) + \left(\left(\frac{1}{\frac{x}{0.083333333333333}} + \left(z \cdot \frac{z}{x}\right) \cdot \left(0.0007936500793651 + y\right)\right) + \frac{z}{x} \cdot -0.0027777777777778\right)

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.1
Target1.3
Herbie0.5
\[\left(\left(\left(x - 0.5\right) \cdot \log x + \left(0.91893853320467 - x\right)\right) + \frac{0.083333333333333}{x}\right) + \frac{z}{x} \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right) \]

Derivation

  1. Initial program 6.1

    \[\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x} \]
  2. Simplified6.1

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467\right) - x\right) + \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}{x}} \]
  3. Taylor expanded in z around 0 6.2

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467\right) - x\right) + \color{blue}{\left(\left(0.0007936500793651 \cdot \frac{{z}^{2}}{x} + \left(\frac{y \cdot {z}^{2}}{x} + 0.083333333333333 \cdot \frac{1}{x}\right)\right) - 0.0027777777777778 \cdot \frac{z}{x}\right)} \]
  4. Simplified0.5

    \[\leadsto \left(\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467\right) - x\right) + \color{blue}{\left(\left(\frac{0.083333333333333}{x} + \left(z \cdot \frac{z}{x}\right) \cdot \left(0.0007936500793651 + y\right)\right) + \frac{z}{x} \cdot -0.0027777777777778\right)} \]
  5. Applied fma-udef_binary640.5

    \[\leadsto \left(\color{blue}{\left(\left(x - 0.5\right) \cdot \log x + 0.91893853320467\right)} - x\right) + \left(\left(\frac{0.083333333333333}{x} + \left(z \cdot \frac{z}{x}\right) \cdot \left(0.0007936500793651 + y\right)\right) + \frac{z}{x} \cdot -0.0027777777777778\right) \]
  6. Simplified0.5

    \[\leadsto \left(\left(\color{blue}{\log x \cdot \left(x - 0.5\right)} + 0.91893853320467\right) - x\right) + \left(\left(\frac{0.083333333333333}{x} + \left(z \cdot \frac{z}{x}\right) \cdot \left(0.0007936500793651 + y\right)\right) + \frac{z}{x} \cdot -0.0027777777777778\right) \]
  7. Applied clear-num_binary640.5

    \[\leadsto \left(\left(\log x \cdot \left(x - 0.5\right) + 0.91893853320467\right) - x\right) + \left(\left(\color{blue}{\frac{1}{\frac{x}{0.083333333333333}}} + \left(z \cdot \frac{z}{x}\right) \cdot \left(0.0007936500793651 + y\right)\right) + \frac{z}{x} \cdot -0.0027777777777778\right) \]
  8. Final simplification0.5

    \[\leadsto \left(\left(\log x \cdot \left(x - 0.5\right) + 0.91893853320467\right) - x\right) + \left(\left(\frac{1}{\frac{x}{0.083333333333333}} + \left(z \cdot \frac{z}{x}\right) \cdot \left(0.0007936500793651 + y\right)\right) + \frac{z}{x} \cdot -0.0027777777777778\right) \]

Reproduce

herbie shell --seed 2022131 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
  :precision binary64

  :herbie-target
  (+ (+ (+ (* (- x 0.5) (log x)) (- 0.91893853320467 x)) (/ 0.083333333333333 x)) (* (/ z x) (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))

  (+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ (+ (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) 0.083333333333333) x)))