Average Error: 6.1 → 2.2
Time: 13.7s
Precision: binary64
Cost: 8128
\[\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(x \cdot \log x - x\right) + 0.91893853320467\right) + \left(\frac{0.083333333333333}{x} + \left(\frac{z \cdot \left(0.0007936500793651 + y\right)}{\frac{x}{z}} + \frac{-0.0027777777777778}{\frac{x}{z}}\right)\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
 (+
  (+ (- (* x (log x)) x) 0.91893853320467)
  (+
   (/ 0.083333333333333 x)
   (+
    (/ (* z (+ 0.0007936500793651 y)) (/ x z))
    (/ -0.0027777777777778 (/ x z))))))
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 (((x * log(x)) - x) + 0.91893853320467) + ((0.083333333333333 / x) + (((z * (0.0007936500793651 + y)) / (x / z)) + (-0.0027777777777778 / (x / z))));
}
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 = (((x * log(x)) - x) + 0.91893853320467d0) + ((0.083333333333333d0 / x) + (((z * (0.0007936500793651d0 + y)) / (x / z)) + ((-0.0027777777777778d0) / (x / z))))
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 (((x * Math.log(x)) - x) + 0.91893853320467) + ((0.083333333333333 / x) + (((z * (0.0007936500793651 + y)) / (x / z)) + (-0.0027777777777778 / (x / z))));
}
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 (((x * math.log(x)) - x) + 0.91893853320467) + ((0.083333333333333 / x) + (((z * (0.0007936500793651 + y)) / (x / z)) + (-0.0027777777777778 / (x / z))))
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(x * log(x)) - x) + 0.91893853320467) + Float64(Float64(0.083333333333333 / x) + Float64(Float64(Float64(z * Float64(0.0007936500793651 + y)) / Float64(x / z)) + Float64(-0.0027777777777778 / Float64(x / z)))))
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 = (((x * log(x)) - x) + 0.91893853320467) + ((0.083333333333333 / x) + (((z * (0.0007936500793651 + y)) / (x / z)) + (-0.0027777777777778 / (x / z))));
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[(x * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] / N[(x / z), $MachinePrecision]), $MachinePrecision] + N[(-0.0027777777777778 / N[(x / z), $MachinePrecision]), $MachinePrecision]), $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(x \cdot \log x - x\right) + 0.91893853320467\right) + \left(\frac{0.083333333333333}{x} + \left(\frac{z \cdot \left(0.0007936500793651 + y\right)}{\frac{x}{z}} + \frac{-0.0027777777777778}{\frac{x}{z}}\right)\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.1
Target1.2
Herbie2.2
\[\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. Taylor expanded in y around 0 6.1

    \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \color{blue}{\left(\frac{y \cdot {z}^{2}}{x} + \left(0.083333333333333 \cdot \frac{1}{x} + \frac{\left(0.0007936500793651 \cdot z - 0.0027777777777778\right) \cdot z}{x}\right)\right)} \]
  3. Simplified1.2

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

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

    \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(\frac{0.083333333333333}{x} + \color{blue}{\left(\frac{z \cdot \left(0.0007936500793651 + y\right)}{\frac{x}{z}} - \frac{0.0027777777777778}{\frac{x}{z}}\right)}\right) \]
  6. Taylor expanded in x around inf 2.2

    \[\leadsto \left(\left(\color{blue}{-1 \cdot \left(\log \left(\frac{1}{x}\right) \cdot x\right)} - x\right) + 0.91893853320467\right) + \left(\frac{0.083333333333333}{x} + \left(\frac{z \cdot \left(0.0007936500793651 + y\right)}{\frac{x}{z}} - \frac{0.0027777777777778}{\frac{x}{z}}\right)\right) \]
  7. Simplified2.2

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

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

Alternatives

Alternative 1
Error2.5
Cost9160
\[\begin{array}{l} t_0 := z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) + -0.0027777777777778\right)\\ t_1 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\ \mathbf{if}\;t_0 \leq -1 \cdot 10^{+74}:\\ \;\;\;\;t_1 + z \cdot \frac{z \cdot y}{x}\\ \mathbf{elif}\;t_0 \leq 10^{+256}:\\ \;\;\;\;t_1 + \left(\frac{0.083333333333333}{x} + \frac{\left(0.0007936500793651 + y\right) \cdot \left(z \cdot z\right)}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 + z \cdot \left(z \cdot \frac{0.0007936500793651}{x}\right)\\ \end{array} \]
Alternative 2
Error7.0
Cost7752
\[\begin{array}{l} t_0 := \log x \cdot \left(x + -0.5\right)\\ t_1 := \left(0.91893853320467 + \left(t_0 - x\right)\right) + \frac{z}{x} \cdot \left(z \cdot 0.0007936500793651\right)\\ \mathbf{if}\;z \leq -4.2 \cdot 10^{+14}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 12000000:\\ \;\;\;\;\left(t_0 + \left(0.91893853320467 - x\right)\right) + -0.083333333333333 \cdot \frac{1}{-x}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error8.2
Cost7752
\[\begin{array}{l} t_0 := \log x \cdot \left(x + -0.5\right)\\ t_1 := 0.91893853320467 + \left(t_0 - x\right)\\ \mathbf{if}\;z \leq -4.2 \cdot 10^{+14}:\\ \;\;\;\;t_1 + \frac{z}{x} \cdot \left(z \cdot 0.0007936500793651\right)\\ \mathbf{elif}\;z \leq 1.584397902279445 \cdot 10^{-29}:\\ \;\;\;\;\left(t_0 + \left(0.91893853320467 - x\right)\right) + -0.083333333333333 \cdot \frac{1}{-x}\\ \mathbf{else}:\\ \;\;\;\;t_1 + z \cdot \frac{z}{\frac{x}{y}}\\ \end{array} \]
Alternative 4
Error8.2
Cost7752
\[\begin{array}{l} t_0 := \log x \cdot \left(x + -0.5\right)\\ t_1 := 0.91893853320467 + \left(t_0 - x\right)\\ \mathbf{if}\;z \leq -4.2 \cdot 10^{+14}:\\ \;\;\;\;t_1 + z \cdot \left(z \cdot \frac{0.0007936500793651}{x}\right)\\ \mathbf{elif}\;z \leq 1.584397902279445 \cdot 10^{-29}:\\ \;\;\;\;\left(t_0 + \left(0.91893853320467 - x\right)\right) + -0.083333333333333 \cdot \frac{1}{-x}\\ \mathbf{else}:\\ \;\;\;\;t_1 + z \cdot \frac{z}{\frac{x}{y}}\\ \end{array} \]
Alternative 5
Error3.6
Cost7748
\[\begin{array}{l} \mathbf{if}\;x \leq 1950:\\ \;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) + -0.0027777777777778\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + z \cdot \frac{z}{\frac{x}{y}}\\ \end{array} \]
Alternative 6
Error12.0
Cost7424
\[\left(\log x \cdot \left(x + -0.5\right) + \left(0.91893853320467 - x\right)\right) + -0.083333333333333 \cdot \frac{1}{-x} \]
Alternative 7
Error12.0
Cost7232
\[\frac{0.083333333333333}{x} + \left(\log x \cdot \left(x + -0.5\right) + \left(0.91893853320467 - x\right)\right) \]
Alternative 8
Error13.0
Cost6976
\[\left(x \cdot \log x - x\right) + \frac{0.083333333333333}{x} \]
Alternative 9
Error42.8
Cost6656
\[{\left(x \cdot 12.000000000000048\right)}^{-1} \]
Alternative 10
Error42.8
Cost384
\[-0.083333333333333 \cdot \frac{1}{-x} \]
Alternative 11
Error42.8
Cost192
\[\frac{0.083333333333333}{x} \]

Error

Reproduce

herbie shell --seed 2022228 
(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)))