?

Average Accuracy: 90.5% → 99.2%
Time: 24.2s
Precision: binary64
Cost: 40777

?

\[\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(-0.0027777777777778 + \left(y + 0.0007936500793651\right) \cdot z\right)\\ \mathbf{if}\;t_0 \leq -2 \cdot 10^{+102} \lor \neg \left(t_0 \leq 5 \cdot 10^{+162}\right):\\ \;\;\;\;\left(\left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(\mathsf{fma}\left(-0.0027777777777778, \frac{z}{x}, \frac{0.083333333333333}{x}\right) + z \cdot \left(z \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.91893853320467 + \left(\frac{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}{x} - \mathsf{fma}\left(\log x, 0.5 - x, \mathsf{expm1}\left(\mathsf{log1p}\left(x\right)\right)\right)\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 (+ -0.0027777777777778 (* (+ y 0.0007936500793651) z)))))
   (if (or (<= t_0 -2e+102) (not (<= t_0 5e+162)))
     (+
      (+ (- (* (+ x -0.5) (log x)) x) 0.91893853320467)
      (+
       (fma -0.0027777777777778 (/ z x) (/ 0.083333333333333 x))
       (* z (* z (+ (/ y x) (/ 0.0007936500793651 x))))))
     (+
      0.91893853320467
      (-
       (/
        (fma
         z
         (fma (+ y 0.0007936500793651) z -0.0027777777777778)
         0.083333333333333)
        x)
       (fma (log x) (- 0.5 x) (expm1 (log1p 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 * (-0.0027777777777778 + ((y + 0.0007936500793651) * z));
	double tmp;
	if ((t_0 <= -2e+102) || !(t_0 <= 5e+162)) {
		tmp = ((((x + -0.5) * log(x)) - x) + 0.91893853320467) + (fma(-0.0027777777777778, (z / x), (0.083333333333333 / x)) + (z * (z * ((y / x) + (0.0007936500793651 / x)))));
	} else {
		tmp = 0.91893853320467 + ((fma(z, fma((y + 0.0007936500793651), z, -0.0027777777777778), 0.083333333333333) / x) - fma(log(x), (0.5 - x), expm1(log1p(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(-0.0027777777777778 + Float64(Float64(y + 0.0007936500793651) * z)))
	tmp = 0.0
	if ((t_0 <= -2e+102) || !(t_0 <= 5e+162))
		tmp = Float64(Float64(Float64(Float64(Float64(x + -0.5) * log(x)) - x) + 0.91893853320467) + Float64(fma(-0.0027777777777778, Float64(z / x), Float64(0.083333333333333 / x)) + Float64(z * Float64(z * Float64(Float64(y / x) + Float64(0.0007936500793651 / x))))));
	else
		tmp = Float64(0.91893853320467 + Float64(Float64(fma(z, fma(Float64(y + 0.0007936500793651), z, -0.0027777777777778), 0.083333333333333) / x) - fma(log(x), Float64(0.5 - x), expm1(log1p(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[(-0.0027777777777778 + N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -2e+102], N[Not[LessEqual[t$95$0, 5e+162]], $MachinePrecision]], N[(N[(N[(N[(N[(x + -0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(-0.0027777777777778 * N[(z / x), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision] + N[(z * N[(z * N[(N[(y / x), $MachinePrecision] + N[(0.0007936500793651 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.91893853320467 + N[(N[(N[(z * N[(N[(y + 0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision] - N[(N[Log[x], $MachinePrecision] * N[(0.5 - x), $MachinePrecision] + N[(Exp[N[Log[1 + x], $MachinePrecision]] - 1), $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(-0.0027777777777778 + \left(y + 0.0007936500793651\right) \cdot z\right)\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{+102} \lor \neg \left(t_0 \leq 5 \cdot 10^{+162}\right):\\
\;\;\;\;\left(\left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(\mathsf{fma}\left(-0.0027777777777778, \frac{z}{x}, \frac{0.083333333333333}{x}\right) + z \cdot \left(z \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.91893853320467 + \left(\frac{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}{x} - \mathsf{fma}\left(\log x, 0.5 - x, \mathsf{expm1}\left(\mathsf{log1p}\left(x\right)\right)\right)\right)\\


\end{array}

Error?

Target

Original90.5%
Target97.8%
Herbie99.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. Split input into 2 regimes
  2. if (*.f64 (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000) z) < -1.99999999999999995e102 or 4.9999999999999997e162 < (*.f64 (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000) z)

    1. Initial program 56.9%

      \[\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. Applied egg-rr56.5%

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

      [Start]56.9

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

      add-cube-cbrt [=>]56.5

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

      pow3 [=>]56.5

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

      *-commutative [=>]56.5

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

      fma-def [=>]56.5

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

      fma-neg [=>]56.5

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

      metadata-eval [=>]56.5

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

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

      [Start]56.5

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

      rem-cube-cbrt [=>]56.9

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

      frac-2neg [=>]56.9

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

      clear-num [=>]56.9

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

      associate-/r/ [=>]56.9

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

      *-un-lft-identity [=>]56.9

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

      distribute-lft-neg-in [=>]56.9

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

      associate-/r* [=>]56.9

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

      metadata-eval [=>]56.9

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

      metadata-eval [=>]56.9

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

      neg-sub0 [=>]56.9

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

      metadata-eval [<=]56.9

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

      fma-udef [=>]56.9

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

      +-commutative [=>]56.9

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

      associate--r+ [=>]56.9

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

      metadata-eval [=>]56.9

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

      metadata-eval [=>]56.9

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

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

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

      [Start]70.4

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

      associate-+r+ [=>]70.4

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

      +-commutative [=>]70.4

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

      associate-*r/ [=>]70.4

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

      metadata-eval [=>]70.4

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

      metadata-eval [<=]70.4

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

      associate-*l/ [<=]70.4

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

      fma-def [=>]70.4

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

      associate-*l/ [=>]70.4

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

      metadata-eval [=>]70.4

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

      *-commutative [=>]70.4

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

      unpow2 [=>]70.4

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

      associate-*l* [=>]97.2

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

      associate-*r/ [=>]97.2

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

      metadata-eval [=>]97.2

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

    if -1.99999999999999995e102 < (*.f64 (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000) z) < 4.9999999999999997e162

    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}{0.91893853320467 + \left(\frac{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}{x} - \mathsf{fma}\left(\log x, 0.5 - x, x\right)\right)} \]
      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} \]

      +-commutative [=>]99.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} \]

      associate-+l+ [=>]99.4

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

      +-commutative [<=]99.4

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

      sub-neg [=>]99.4

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

      +-commutative [=>]99.4

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

      associate-+r+ [=>]99.4

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

      unsub-neg [=>]99.4

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

      associate-+l- [=>]99.4

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

      remove-double-neg [<=]99.4

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

      neg-mul-1 [=>]99.4

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

      *-commutative [<=]99.4

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

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

      [Start]99.5

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

      fma-udef [=>]99.4

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

      +-commutative [=>]99.4

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

      expm1-log1p-u [=>]99.5

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

      expm1-udef [=>]99.5

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

      associate-+l- [=>]99.5

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

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

      [Start]99.5

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

      associate--r- [=>]99.5

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

      +-commutative [<=]99.5

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

      fma-def [=>]99.7

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

      expm1-def [=>]99.7

      \[ 0.91893853320467 + \left(\frac{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}{x} - \mathsf{fma}\left(\log x, 0.5 - x, \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x\right)\right)}\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.2%

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

Alternatives

Alternative 1
Accuracy99.0%
Cost15945
\[\begin{array}{l} t_0 := \left(y + 0.0007936500793651\right) \cdot z\\ t_1 := z \cdot \left(-0.0027777777777778 + t_0\right)\\ \mathbf{if}\;t_1 \leq -2 \cdot 10^{+102} \lor \neg \left(t_1 \leq 5 \cdot 10^{+121}\right):\\ \;\;\;\;\left(\left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(\mathsf{fma}\left(-0.0027777777777778, \frac{z}{x}, \frac{0.083333333333333}{x}\right) + z \cdot \left(z \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.91893853320467 + \left(\frac{\left(0.083333333333333 + z \cdot t_0\right) + z \cdot -0.0027777777777778}{x} - \mathsf{fma}\left(\log x, 0.5 - x, x\right)\right)\\ \end{array} \]
Alternative 2
Accuracy98.7%
Cost15560
\[\begin{array}{l} t_0 := \left(y + 0.0007936500793651\right) \cdot z\\ t_1 := z \cdot \left(-0.0027777777777778 + t_0\right)\\ t_2 := \left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\\ \mathbf{if}\;t_1 \leq -5 \cdot 10^{+170}:\\ \;\;\;\;t_2 + \frac{y}{\frac{\frac{x}{z}}{z}}\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+192}:\\ \;\;\;\;0.91893853320467 + \left(\frac{\left(0.083333333333333 + z \cdot t_0\right) + z \cdot -0.0027777777777778}{x} - \mathsf{fma}\left(\log x, 0.5 - x, x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 + z \cdot \frac{t_0}{x}\\ \end{array} \]
Alternative 3
Accuracy98.7%
Cost9160
\[\begin{array}{l} t_0 := \left(y + 0.0007936500793651\right) \cdot z\\ t_1 := z \cdot \left(-0.0027777777777778 + t_0\right)\\ t_2 := \left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\\ \mathbf{if}\;t_1 \leq -5 \cdot 10^{+170}:\\ \;\;\;\;t_2 + \frac{y}{\frac{\frac{x}{z}}{z}}\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+192}:\\ \;\;\;\;t_2 + \frac{t_1 + 0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;t_2 + z \cdot \frac{t_0}{x}\\ \end{array} \]
Alternative 4
Accuracy80.0%
Cost7757
\[\begin{array}{l} t_0 := 0.91893853320467 + x \cdot \left(\log x + -1\right)\\ \mathbf{if}\;y \leq -2.2 \cdot 10^{+168}:\\ \;\;\;\;\frac{0.083333333333333}{x} + t_0\\ \mathbf{elif}\;y \leq -3.25 \cdot 10^{+106} \lor \neg \left(y \leq 6.2 \cdot 10^{+190}\right):\\ \;\;\;\;t_0 + \frac{y}{\frac{x}{z \cdot z}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{0.083333333333333}{x}\\ \end{array} \]
Alternative 5
Accuracy90.0%
Cost7752
\[\begin{array}{l} t_0 := 0.91893853320467 + x \cdot \left(\log x + -1\right)\\ \mathbf{if}\;x \leq 0.00158:\\ \;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) + \frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + 0.0007936500793651 \cdot z\right)}{x}\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+180}:\\ \;\;\;\;t_0 + \left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.083333333333333}{x} + t_0\\ \end{array} \]
Alternative 6
Accuracy91.4%
Cost7752
\[\begin{array}{l} t_0 := 0.91893853320467 + x \cdot \left(\log x + -1\right)\\ \mathbf{if}\;z \leq -7:\\ \;\;\;\;t_0 + \left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x}\\ \mathbf{elif}\;z \leq 0.015:\\ \;\;\;\;t_0 + \frac{0.083333333333333 + z \cdot \left(y \cdot z\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0 + \frac{z \cdot z}{\frac{x}{y + 0.0007936500793651}}\\ \end{array} \]
Alternative 7
Accuracy91.5%
Cost7752
\[\begin{array}{l} t_0 := 0.91893853320467 + x \cdot \left(\log x + -1\right)\\ \mathbf{if}\;z \leq -2.5 \cdot 10^{+26}:\\ \;\;\;\;\left(\left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + 0.0007936500793651 \cdot \left(z \cdot \frac{z}{x}\right)\\ \mathbf{elif}\;z \leq 0.015:\\ \;\;\;\;t_0 + \frac{0.083333333333333 + z \cdot \left(y \cdot z\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0 + \frac{z \cdot z}{\frac{x}{y + 0.0007936500793651}}\\ \end{array} \]
Alternative 8
Accuracy91.5%
Cost7752
\[\begin{array}{l} t_0 := 0.91893853320467 + x \cdot \left(\log x + -1\right)\\ \mathbf{if}\;z \leq -2 \cdot 10^{+25}:\\ \;\;\;\;\left(\left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + 0.0007936500793651 \cdot \frac{z}{\frac{x}{z}}\\ \mathbf{elif}\;z \leq 0.015:\\ \;\;\;\;t_0 + \frac{0.083333333333333 + z \cdot \left(y \cdot z\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0 + \frac{z \cdot z}{\frac{x}{y + 0.0007936500793651}}\\ \end{array} \]
Alternative 9
Accuracy95.5%
Cost7752
\[\begin{array}{l} \mathbf{if}\;x \leq 1:\\ \;\;\;\;\frac{z \cdot \left(-0.0027777777777778 + \left(y + 0.0007936500793651\right) \cdot z\right) + 0.083333333333333}{x} + \left(0.91893853320467 + \log x \cdot -0.5\right)\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+180}:\\ \;\;\;\;\left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right) + \left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + 0.0007936500793651 \cdot \left(z \cdot \frac{z}{x}\right)\\ \end{array} \]
Alternative 10
Accuracy97.0%
Cost7748
\[\begin{array}{l} t_0 := \left(y + 0.0007936500793651\right) \cdot z\\ \mathbf{if}\;x \leq 0.00175:\\ \;\;\;\;\frac{z \cdot \left(-0.0027777777777778 + t_0\right) + 0.083333333333333}{x} + \left(0.91893853320467 + \log x \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + z \cdot \frac{t_0}{x}\\ \end{array} \]
Alternative 11
Accuracy84.2%
Cost7624
\[\begin{array}{l} t_0 := 0.91893853320467 + x \cdot \left(\log x + -1\right)\\ \mathbf{if}\;x \leq 1.4 \cdot 10^{+19}:\\ \;\;\;\;\left(\left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{0.083333333333333}{x}\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+180}:\\ \;\;\;\;t_0 + \frac{z \cdot z}{\frac{x}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.083333333333333}{x} + t_0\\ \end{array} \]
Alternative 12
Accuracy88.0%
Cost7624
\[\begin{array}{l} t_0 := 0.91893853320467 + x \cdot \left(\log x + -1\right)\\ \mathbf{if}\;x \leq 0.00122:\\ \;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) + \frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + 0.0007936500793651 \cdot z\right)}{x}\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+181}:\\ \;\;\;\;t_0 + \frac{z \cdot z}{\frac{x}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.083333333333333}{x} + t_0\\ \end{array} \]
Alternative 13
Accuracy81.5%
Cost7232
\[\left(\left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{0.083333333333333}{x} \]
Alternative 14
Accuracy79.8%
Cost7104
\[\frac{0.083333333333333}{x} + \left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right) \]
Alternative 15
Accuracy31.8%
Cost6656
\[{\left(x \cdot 12.000000000000048\right)}^{-1} \]
Alternative 16
Accuracy31.8%
Cost192
\[\frac{0.083333333333333}{x} \]

Error

Reproduce?

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