?

Average Accuracy: 90.5% → 97.1%
Time: 24.2s
Precision: binary64
Cost: 34632

?

\[\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} t_0 := z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z + -0.0027777777777778\right)\\ t_1 := \log x \cdot \left(x + -0.5\right)\\ \mathbf{if}\;t_0 \leq -5 \cdot 10^{+80}:\\ \;\;\;\;\left(x \cdot \log x - x\right) + \left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x}\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+260}:\\ \;\;\;\;\left(\left(\left(0.91893853320467 + t_1\right) - e^{\mathsf{log1p}\left(x\right)}\right) + 1\right) + \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + \left(t_1 - x\right)\right) + 0.0007936500793651 \cdot \left(z \cdot \frac{z}{x}\right)\\ \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
 (let* ((t_0 (* z (+ (* (+ y 0.0007936500793651) z) -0.0027777777777778)))
        (t_1 (* (log x) (+ x -0.5))))
   (if (<= t_0 -5e+80)
     (+ (- (* x (log x)) x) (* (+ y 0.0007936500793651) (/ (* z z) x)))
     (if (<= t_0 2e+260)
       (+
        (+ (- (+ 0.91893853320467 t_1) (exp (log1p x))) 1.0)
        (/
         (fma
          z
          (fma (+ y 0.0007936500793651) z -0.0027777777777778)
          0.083333333333333)
         x))
       (+
        (+ 0.91893853320467 (- t_1 x))
        (* 0.0007936500793651 (* z (/ z 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 t_0 = z * (((y + 0.0007936500793651) * z) + -0.0027777777777778);
	double t_1 = log(x) * (x + -0.5);
	double tmp;
	if (t_0 <= -5e+80) {
		tmp = ((x * log(x)) - x) + ((y + 0.0007936500793651) * ((z * z) / x));
	} else if (t_0 <= 2e+260) {
		tmp = (((0.91893853320467 + t_1) - exp(log1p(x))) + 1.0) + (fma(z, fma((y + 0.0007936500793651), z, -0.0027777777777778), 0.083333333333333) / x);
	} else {
		tmp = (0.91893853320467 + (t_1 - x)) + (0.0007936500793651 * (z * (z / 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)
	t_0 = Float64(z * Float64(Float64(Float64(y + 0.0007936500793651) * z) + -0.0027777777777778))
	t_1 = Float64(log(x) * Float64(x + -0.5))
	tmp = 0.0
	if (t_0 <= -5e+80)
		tmp = Float64(Float64(Float64(x * log(x)) - x) + Float64(Float64(y + 0.0007936500793651) * Float64(Float64(z * z) / x)));
	elseif (t_0 <= 2e+260)
		tmp = Float64(Float64(Float64(Float64(0.91893853320467 + t_1) - exp(log1p(x))) + 1.0) + Float64(fma(z, fma(Float64(y + 0.0007936500793651), z, -0.0027777777777778), 0.083333333333333) / x));
	else
		tmp = Float64(Float64(0.91893853320467 + Float64(t_1 - x)) + Float64(0.0007936500793651 * Float64(z * Float64(z / x))));
	end
	return 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_] := Block[{t$95$0 = N[(z * N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] + -0.0027777777777778), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[x], $MachinePrecision] * N[(x + -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+80], N[(N[(N[(x * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + N[(N[(y + 0.0007936500793651), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+260], N[(N[(N[(N[(0.91893853320467 + t$95$1), $MachinePrecision] - N[Exp[N[Log[1 + x], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + N[(N[(z * N[(N[(y + 0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(0.91893853320467 + N[(t$95$1 - x), $MachinePrecision]), $MachinePrecision] + N[(0.0007936500793651 * N[(z * N[(z / x), $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}
\begin{array}{l}
t_0 := z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z + -0.0027777777777778\right)\\
t_1 := \log x \cdot \left(x + -0.5\right)\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{+80}:\\
\;\;\;\;\left(x \cdot \log x - x\right) + \left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x}\\

\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+260}:\\
\;\;\;\;\left(\left(\left(0.91893853320467 + t_1\right) - e^{\mathsf{log1p}\left(x\right)}\right) + 1\right) + \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}{x}\\

\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 + \left(t_1 - x\right)\right) + 0.0007936500793651 \cdot \left(z \cdot \frac{z}{x}\right)\\


\end{array}

Error?

Target

Original90.5%
Target98.1%
Herbie97.1%
\[\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 3 regimes
  2. if (*.f64 (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000) z) < -4.99999999999999961e80

    1. Initial program 70.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 z around inf 70.1%

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \color{blue}{\frac{{z}^{2} \cdot \left(0.0007936500793651 + y\right)}{x}} \]
    3. Simplified89.4%

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

      [Start]70.1

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

      associate-/l* [=>]85.5

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

      associate-/r/ [=>]89.4

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

      unpow2 [=>]89.4

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

      \[\leadsto \color{blue}{\left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x} + \frac{z \cdot z}{x} \cdot \left(0.0007936500793651 + y\right) \]
    5. Simplified89.4%

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

      [Start]89.5

      \[ \left(-1 \cdot \log \left(\frac{1}{x}\right) - 1\right) \cdot x + \frac{z \cdot z}{x} \cdot \left(0.0007936500793651 + y\right) \]

      *-commutative [=>]89.5

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

      sub-neg [=>]89.5

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

      metadata-eval [=>]89.5

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

      distribute-lft-in [=>]89.4

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

      mul-1-neg [=>]89.4

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

      log-rec [=>]89.4

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

      remove-double-neg [=>]89.4

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

      *-commutative [=>]89.4

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

      *-commutative [<=]89.4

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

      neg-mul-1 [<=]89.4

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

      unsub-neg [=>]89.4

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

      *-commutative [<=]89.4

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

    if -4.99999999999999961e80 < (*.f64 (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000) z) < 2.00000000000000013e260

    1. Initial program 99.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. Simplified99.5%

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

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

      associate-+l- [=>]99.4

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

      sub-neg [=>]99.4

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

      associate--r+ [=>]99.4

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

      associate--r+ [<=]99.4

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

      sub-neg [<=]99.4

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

      fma-neg [=>]99.5

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

      sub-neg [=>]99.5

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

      metadata-eval [=>]99.5

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

      neg-sub0 [=>]99.5

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

      associate-+l- [<=]99.5

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

      neg-sub0 [<=]99.5

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

      +-commutative [=>]99.5

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

      unsub-neg [=>]99.5

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

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

      [Start]99.5

      \[ \mathsf{fma}\left(x + -0.5, \log x, 0.91893853320467 - x\right) + \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}{x} \]

      fma-udef [=>]99.4

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

      associate-+r- [=>]99.4

      \[ \color{blue}{\left(\left(\left(x + -0.5\right) \cdot \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} \]

      expm1-log1p-u [=>]99.5

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

      expm1-udef [=>]99.5

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

      associate--r- [=>]99.5

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

      +-commutative [=>]99.5

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

    if 2.00000000000000013e260 < (*.f64 (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000) z)

    1. Initial program 25.3%

      \[\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 z around inf 23.7%

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \color{blue}{\frac{{z}^{2} \cdot \left(0.0007936500793651 + y\right)}{x}} \]
    3. Simplified38.4%

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

      [Start]23.7

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

      associate-/l* [=>]38.4

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

      associate-/r/ [=>]38.4

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

      unpow2 [=>]38.4

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

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \color{blue}{0.0007936500793651 \cdot \frac{{z}^{2}}{x}} \]
    5. Simplified81.3%

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

      [Start]25.7

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

      unpow2 [=>]25.7

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

      associate-*r/ [<=]81.3

      \[ \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + 0.0007936500793651 \cdot \color{blue}{\left(z \cdot \frac{z}{x}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification97.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z + -0.0027777777777778\right) \leq -5 \cdot 10^{+80}:\\ \;\;\;\;\left(x \cdot \log x - x\right) + \left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x}\\ \mathbf{elif}\;z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z + -0.0027777777777778\right) \leq 2 \cdot 10^{+260}:\\ \;\;\;\;\left(\left(\left(0.91893853320467 + \log x \cdot \left(x + -0.5\right)\right) - e^{\mathsf{log1p}\left(x\right)}\right) + 1\right) + \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + 0.0007936500793651 \cdot \left(z \cdot \frac{z}{x}\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy97.1%
Cost27976
\[\begin{array}{l} t_0 := z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z + -0.0027777777777778\right)\\ \mathbf{if}\;t_0 \leq -5 \cdot 10^{+80}:\\ \;\;\;\;\left(x \cdot \log x - x\right) + \left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x}\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+260}:\\ \;\;\;\;\frac{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}{x} + \mathsf{fma}\left(x + -0.5, \log x, 0.91893853320467 - x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + 0.0007936500793651 \cdot \left(z \cdot \frac{z}{x}\right)\\ \end{array} \]
Alternative 2
Accuracy97.1%
Cost9160
\[\begin{array}{l} t_0 := z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z + -0.0027777777777778\right)\\ t_1 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\ \mathbf{if}\;t_0 \leq -5 \cdot 10^{+80}:\\ \;\;\;\;\left(x \cdot \log x - x\right) + \left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x}\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+260}:\\ \;\;\;\;t_1 + \frac{t_0 + 0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;t_1 + 0.0007936500793651 \cdot \left(z \cdot \frac{z}{x}\right)\\ \end{array} \]
Alternative 3
Accuracy95.6%
Cost9032
\[\begin{array}{l} t_0 := z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z + -0.0027777777777778\right)\\ \mathbf{if}\;t_0 \leq -5 \cdot 10^{+80}:\\ \;\;\;\;\left(x \cdot \log x - x\right) + \left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x}\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+260}:\\ \;\;\;\;\frac{t_0 + 0.083333333333333}{x} + x \cdot \left(-1 - \log \left(\frac{1}{x}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + 0.0007936500793651 \cdot \left(z \cdot \frac{z}{x}\right)\\ \end{array} \]
Alternative 4
Accuracy95.5%
Cost8904
\[\begin{array}{l} t_0 := z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z + -0.0027777777777778\right)\\ t_1 := x \cdot \log x - x\\ \mathbf{if}\;t_0 \leq -5 \cdot 10^{+80}:\\ \;\;\;\;t_1 + \left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x}\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+260}:\\ \;\;\;\;t_1 + \frac{t_0 + 0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + 0.0007936500793651 \cdot \left(z \cdot \frac{z}{x}\right)\\ \end{array} \]
Alternative 5
Accuracy91.5%
Cost7756
\[\begin{array}{l} t_0 := x \cdot \log x - x\\ t_1 := t_0 + z \cdot \left(0.0007936500793651 \cdot \frac{z}{x}\right)\\ \mathbf{if}\;z \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.2 \cdot 10^{-22}:\\ \;\;\;\;t_0 + \left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x}\\ \mathbf{elif}\;z \leq 10:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + \frac{\frac{1}{x}}{12.000000000000048}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Accuracy91.5%
Cost7756
\[\begin{array}{l} t_0 := x \cdot \log x - x\\ t_1 := t_0 + z \cdot \left(0.0007936500793651 \cdot \frac{z}{x}\right)\\ \mathbf{if}\;z \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -3.5 \cdot 10^{-21}:\\ \;\;\;\;\left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x} + \left(t_0 + 0.91893853320467\right)\\ \mathbf{elif}\;z \leq 10.6:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + \frac{\frac{1}{x}}{12.000000000000048}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Accuracy91.4%
Cost7756
\[\begin{array}{l} t_0 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\ t_1 := x \cdot \log x - x\\ \mathbf{if}\;z \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;t_0 + 0.0007936500793651 \cdot \left(z \cdot \frac{z}{x}\right)\\ \mathbf{elif}\;z \leq -1 \cdot 10^{-22}:\\ \;\;\;\;\left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x} + \left(t_1 + 0.91893853320467\right)\\ \mathbf{elif}\;z \leq 10.5:\\ \;\;\;\;t_0 + \frac{\frac{1}{x}}{12.000000000000048}\\ \mathbf{else}:\\ \;\;\;\;t_1 + z \cdot \left(0.0007936500793651 \cdot \frac{z}{x}\right)\\ \end{array} \]
Alternative 8
Accuracy89.1%
Cost7624
\[\begin{array}{l} t_0 := x \cdot \log x - x\\ t_1 := z \cdot \left(0.0007936500793651 \cdot \frac{z}{x}\right)\\ \mathbf{if}\;z \leq -0.00095:\\ \;\;\;\;\left(t_0 + 0.91893853320467\right) + t_1\\ \mathbf{elif}\;z \leq 11:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + \frac{1}{x \cdot 12.000000000000048}\\ \mathbf{else}:\\ \;\;\;\;t_0 + t_1\\ \end{array} \]
Alternative 9
Accuracy89.1%
Cost7624
\[\begin{array}{l} t_0 := x \cdot \log x - x\\ t_1 := z \cdot \left(0.0007936500793651 \cdot \frac{z}{x}\right)\\ \mathbf{if}\;z \leq -0.00095:\\ \;\;\;\;\left(t_0 + 0.91893853320467\right) + t_1\\ \mathbf{elif}\;z \leq 10.5:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + \frac{\frac{1}{x}}{12.000000000000048}\\ \mathbf{else}:\\ \;\;\;\;t_0 + t_1\\ \end{array} \]
Alternative 10
Accuracy89.1%
Cost7497
\[\begin{array}{l} \mathbf{if}\;z \leq -0.00095 \lor \neg \left(z \leq 12\right):\\ \;\;\;\;\left(x \cdot \log x - x\right) + z \cdot \left(0.0007936500793651 \cdot \frac{z}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + \frac{0.083333333333333}{x}\\ \end{array} \]
Alternative 11
Accuracy89.1%
Cost7496
\[\begin{array}{l} t_0 := x \cdot \log x - x\\ t_1 := z \cdot \left(0.0007936500793651 \cdot \frac{z}{x}\right)\\ \mathbf{if}\;z \leq -0.00095:\\ \;\;\;\;\left(t_0 + 0.91893853320467\right) + t_1\\ \mathbf{elif}\;z \leq 10.5:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + \frac{0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0 + t_1\\ \end{array} \]
Alternative 12
Accuracy80.5%
Cost7232
\[\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + \frac{0.083333333333333}{x} \]
Alternative 13
Accuracy79.1%
Cost7104
\[\left(\left(x \cdot \log x - x\right) + 0.91893853320467\right) + \frac{0.083333333333333}{x} \]
Alternative 14
Accuracy79.1%
Cost7104
\[x \cdot \left(-1 - \log \left(\frac{1}{x}\right)\right) + \frac{0.083333333333333}{x} \]
Alternative 15
Accuracy79.1%
Cost6976
\[\left(x \cdot \log x - x\right) + \frac{0.083333333333333}{x} \]
Alternative 16
Accuracy33.1%
Cost6656
\[{\left(x \cdot 12.000000000000048\right)}^{-1} \]
Alternative 17
Accuracy33.0%
Cost320
\[0.083333333333333 \cdot \frac{1}{x} \]
Alternative 18
Accuracy33.0%
Cost192
\[\frac{0.083333333333333}{x} \]

Error

Reproduce?

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