?

Average Error: 6.4 → 3.7
Time: 17.3s
Precision: binary64
Cost: 14724

?

\[\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} \]
\[\begin{array}{l} \mathbf{if}\;x \leq 6 \cdot 10^{+101}:\\ \;\;\;\;\left(\left(x - 0.5\right) \cdot \log x - x\right) + \left(0.91893853320467 + \left(\frac{{z}^{2} \cdot \left(y + 0.0007936500793651\right)}{x} + \left(\frac{0.083333333333333}{x} + -0.0027777777777778 \cdot \frac{z}{x}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x\\ \end{array} \]
(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
 (if (<= x 6e+101)
   (+
    (- (* (- x 0.5) (log x)) x)
    (+
     0.91893853320467
     (+
      (/ (* (pow z 2.0) (+ y 0.0007936500793651)) x)
      (+ (/ 0.083333333333333 x) (* -0.0027777777777778 (/ z x))))))
   (* (- (* -1.0 (log (/ 1.0 x))) 1.0) x)))
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) {
	double tmp;
	if (x <= 6e+101) {
		tmp = (((x - 0.5) * log(x)) - x) + (0.91893853320467 + (((pow(z, 2.0) * (y + 0.0007936500793651)) / x) + ((0.083333333333333 / x) + (-0.0027777777777778 * (z / x)))));
	} else {
		tmp = ((-1.0 * log((1.0 / x))) - 1.0) * x;
	}
	return tmp;
}
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
    real(8) :: tmp
    if (x <= 6d+101) then
        tmp = (((x - 0.5d0) * log(x)) - x) + (0.91893853320467d0 + ((((z ** 2.0d0) * (y + 0.0007936500793651d0)) / x) + ((0.083333333333333d0 / x) + ((-0.0027777777777778d0) * (z / x)))))
    else
        tmp = (((-1.0d0) * log((1.0d0 / x))) - 1.0d0) * x
    end if
    code = tmp
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) {
	double tmp;
	if (x <= 6e+101) {
		tmp = (((x - 0.5) * Math.log(x)) - x) + (0.91893853320467 + (((Math.pow(z, 2.0) * (y + 0.0007936500793651)) / x) + ((0.083333333333333 / x) + (-0.0027777777777778 * (z / x)))));
	} else {
		tmp = ((-1.0 * Math.log((1.0 / x))) - 1.0) * x;
	}
	return tmp;
}
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):
	tmp = 0
	if x <= 6e+101:
		tmp = (((x - 0.5) * math.log(x)) - x) + (0.91893853320467 + (((math.pow(z, 2.0) * (y + 0.0007936500793651)) / x) + ((0.083333333333333 / x) + (-0.0027777777777778 * (z / x)))))
	else:
		tmp = ((-1.0 * math.log((1.0 / x))) - 1.0) * x
	return tmp
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)
	tmp = 0.0
	if (x <= 6e+101)
		tmp = Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + Float64(0.91893853320467 + Float64(Float64(Float64((z ^ 2.0) * Float64(y + 0.0007936500793651)) / x) + Float64(Float64(0.083333333333333 / x) + Float64(-0.0027777777777778 * Float64(z / x))))));
	else
		tmp = Float64(Float64(Float64(-1.0 * log(Float64(1.0 / x))) - 1.0) * x);
	end
	return tmp
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_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= 6e+101)
		tmp = (((x - 0.5) * log(x)) - x) + (0.91893853320467 + ((((z ^ 2.0) * (y + 0.0007936500793651)) / x) + ((0.083333333333333 / x) + (-0.0027777777777778 * (z / x)))));
	else
		tmp = ((-1.0 * log((1.0 / x))) - 1.0) * x;
	end
	tmp_2 = tmp;
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_] := If[LessEqual[x, 6e+101], N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + N[(0.91893853320467 + N[(N[(N[(N[Power[z, 2.0], $MachinePrecision] * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(-0.0027777777777778 * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 * N[Log[N[(1.0 / x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] * x), $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}
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{+101}:\\
\;\;\;\;\left(\left(x - 0.5\right) \cdot \log x - x\right) + \left(0.91893853320467 + \left(\frac{{z}^{2} \cdot \left(y + 0.0007936500793651\right)}{x} + \left(\frac{0.083333333333333}{x} + -0.0027777777777778 \cdot \frac{z}{x}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.4
Target1.3
Herbie3.7
\[\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. Split input into 2 regimes
  2. if x < 5.99999999999999986e101

    1. Initial program 1.4

      \[\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. Simplified1.4

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

      [Start]1.4

      \[ \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} \]

      rational_best_oopsla_all_46_json_45_simplify-35 [=>]1.4

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

      rational_best_oopsla_all_46_json_45_simplify-82 [=>]1.4

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

      rational_best_oopsla_all_46_json_45_simplify-35 [=>]1.4

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]1.4

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

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

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

      [Start]1.5

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

      rational_best_oopsla_all_46_json_45_simplify-82 [=>]1.5

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

      rational_best_oopsla_all_46_json_45_simplify-35 [<=]1.5

      \[ \left(\left(x - 0.5\right) \cdot \log x - x\right) + \left(0.91893853320467 + \left(\frac{{z}^{2} \cdot \color{blue}{\left(y + 0.0007936500793651\right)}}{x} + \left(0.083333333333333 \cdot \frac{1}{x} + -0.0027777777777778 \cdot \frac{z}{x}\right)\right)\right) \]
    5. Taylor expanded in x around 0 1.5

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

    if 5.99999999999999986e101 < x

    1. Initial program 13.4

      \[\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. Simplified13.4

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

      [Start]13.4

      \[ \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} \]

      rational_best_oopsla_all_46_json_45_simplify-35 [=>]13.4

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

      rational_best_oopsla_all_46_json_45_simplify-108 [=>]13.4

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

      rational_best_oopsla_all_46_json_45_simplify-35 [=>]13.4

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

      rational_best_oopsla_all_46_json_45_simplify-107 [=>]13.4

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]13.4

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

      \[\leadsto \left(\left(x - 0.5\right) \cdot \log x + \left(0.91893853320467 - x\right)\right) + \color{blue}{\frac{0.083333333333333}{x}} \]
    4. Taylor expanded in x around inf 6.8

      \[\leadsto \color{blue}{\left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 6 \cdot 10^{+101}:\\ \;\;\;\;\left(\left(x - 0.5\right) \cdot \log x - x\right) + \left(0.91893853320467 + \left(\frac{{z}^{2} \cdot \left(y + 0.0007936500793651\right)}{x} + \left(\frac{0.083333333333333}{x} + -0.0027777777777778 \cdot \frac{z}{x}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x\\ \end{array} \]

Alternatives

Alternative 1
Error5.9
Cost8008
\[\begin{array}{l} \mathbf{if}\;x \leq 3.2 \cdot 10^{-38}:\\ \;\;\;\;\left(0.91893853320467 + -0.5 \cdot \log x\right) + \frac{z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) + 0.083333333333333}{x}\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{+59}:\\ \;\;\;\;\left(\left(x - 0.5\right) \cdot \log x - x\right) + \left(0.91893853320467 + \frac{z \cdot \left(z \cdot 0.0007936500793651 - 0.0027777777777778\right) + 0.083333333333333}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x\\ \end{array} \]
Alternative 2
Error3.7
Cost8004
\[\begin{array}{l} \mathbf{if}\;x \leq 1.15 \cdot 10^{+101}:\\ \;\;\;\;\left(\left(x - 0.5\right) \cdot \log x + \left(0.91893853320467 - x\right)\right) + \frac{z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) + 0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x\\ \end{array} \]
Alternative 3
Error4.6
Cost7940
\[\begin{array}{l} t_0 := \log \left(\frac{1}{x}\right)\\ \mathbf{if}\;x \leq 5 \cdot 10^{+101}:\\ \;\;\;\;x \cdot \left(-1 + \left(-t_0\right)\right) + \frac{z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) + 0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot t_0 - 1\right) \cdot x\\ \end{array} \]
Alternative 4
Error6.4
Cost7748
\[\begin{array}{l} \mathbf{if}\;x \leq 5:\\ \;\;\;\;\left(0.91893853320467 + -0.5 \cdot \log x\right) + \frac{z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) + 0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x - 0.5\right) \cdot \log x + \left(0.91893853320467 - x\right)\right) + \frac{0.083333333333333}{x}\\ \end{array} \]
Alternative 5
Error9.4
Cost7620
\[\begin{array}{l} \mathbf{if}\;x \leq 5:\\ \;\;\;\;-0.5 \cdot \log x + \left(0.91893853320467 + \frac{z \cdot \left(z \cdot 0.0007936500793651 - 0.0027777777777778\right) + 0.083333333333333}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(x - 0.5\right) \cdot \log x + \left(0.91893853320467 - x\right)\right) + \frac{0.083333333333333}{x}\\ \end{array} \]
Alternative 6
Error12.0
Cost7232
\[\left(\left(x - 0.5\right) \cdot \log x + \left(0.91893853320467 - x\right)\right) + \frac{0.083333333333333}{x} \]
Alternative 7
Error12.9
Cost7168
\[x \cdot \left(-1 + \left(-\log \left(\frac{1}{x}\right)\right)\right) + \frac{0.083333333333333}{x} \]
Alternative 8
Error12.9
Cost7108
\[\begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x\\ \end{array} \]
Alternative 9
Error12.6
Cost7108
\[\begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;0.91893853320467 + \left(-0.5 \cdot \log x + \frac{0.083333333333333}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x\\ \end{array} \]
Alternative 10
Error12.9
Cost7044
\[\begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(-\log \left(\frac{1}{x}\right)\right) \cdot x - x\\ \end{array} \]
Alternative 11
Error43.1
Cost192
\[\frac{0.083333333333333}{x} \]

Error

Reproduce?

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