Average Error: 6.1 → 0.2
Time: 24.0s
Precision: binary64
Cost: 40776
\[\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 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\ t_1 := z \cdot \left(-0.0027777777777778 + \left(y + 0.0007936500793651\right) \cdot z\right)\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;t_0 + z \cdot \frac{y}{\frac{x}{z}}\\ \mathbf{elif}\;t_1 \leq 10^{+266}:\\ \;\;\;\;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)\\ \mathbf{else}:\\ \;\;\;\;t_0 + \left(\frac{0.083333333333333}{x} + \mathsf{fma}\left(-0.0027777777777778, \frac{z}{x}, z \cdot \left(z \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{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 (+ 0.91893853320467 (- (* (log x) (+ x -0.5)) x)))
        (t_1 (* z (+ -0.0027777777777778 (* (+ y 0.0007936500793651) z)))))
   (if (<= t_1 (- INFINITY))
     (+ t_0 (* z (/ y (/ x z))))
     (if (<= t_1 1e+266)
       (+
        0.91893853320467
        (-
         (/
          (fma
           z
           (fma (+ y 0.0007936500793651) z -0.0027777777777778)
           0.083333333333333)
          x)
         (fma (log x) (- 0.5 x) (expm1 (log1p x)))))
       (+
        t_0
        (+
         (/ 0.083333333333333 x)
         (fma
          -0.0027777777777778
          (/ z x)
          (* z (* z (+ (/ y x) (/ 0.0007936500793651 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 = 0.91893853320467 + ((log(x) * (x + -0.5)) - x);
	double t_1 = z * (-0.0027777777777778 + ((y + 0.0007936500793651) * z));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = t_0 + (z * (y / (x / z)));
	} else if (t_1 <= 1e+266) {
		tmp = 0.91893853320467 + ((fma(z, fma((y + 0.0007936500793651), z, -0.0027777777777778), 0.083333333333333) / x) - fma(log(x), (0.5 - x), expm1(log1p(x))));
	} else {
		tmp = t_0 + ((0.083333333333333 / x) + fma(-0.0027777777777778, (z / x), (z * (z * ((y / x) + (0.0007936500793651 / 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(0.91893853320467 + Float64(Float64(log(x) * Float64(x + -0.5)) - x))
	t_1 = Float64(z * Float64(-0.0027777777777778 + Float64(Float64(y + 0.0007936500793651) * z)))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(t_0 + Float64(z * Float64(y / Float64(x / z))));
	elseif (t_1 <= 1e+266)
		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)))));
	else
		tmp = Float64(t_0 + Float64(Float64(0.083333333333333 / x) + fma(-0.0027777777777778, Float64(z / x), Float64(z * Float64(z * Float64(Float64(y / x) + Float64(0.0007936500793651 / 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[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x + -0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(-0.0027777777777778 + N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(t$95$0 + N[(z * N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+266], 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], N[(t$95$0 + N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(-0.0027777777777778 * N[(z / x), $MachinePrecision] + N[(z * N[(z * N[(N[(y / x), $MachinePrecision] + N[(0.0007936500793651 / x), $MachinePrecision]), $MachinePrecision]), $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}
\begin{array}{l}
t_0 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\
t_1 := z \cdot \left(-0.0027777777777778 + \left(y + 0.0007936500793651\right) \cdot z\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_0 + z \cdot \frac{y}{\frac{x}{z}}\\

\mathbf{elif}\;t_1 \leq 10^{+266}:\\
\;\;\;\;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)\\

\mathbf{else}:\\
\;\;\;\;t_0 + \left(\frac{0.083333333333333}{x} + \mathsf{fma}\left(-0.0027777777777778, \frac{z}{x}, z \cdot \left(z \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right)\right)\right)\right)\\


\end{array}

Error

Target

Original6.1
Target1.1
Herbie0.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 3 regimes
  2. if (*.f64 (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000) z) < -inf.0

    1. Initial program 64.0

      \[\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 inf 64.0

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

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

      [Start]64.0

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

      associate-/l* [=>]19.2

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

      unpow2 [=>]19.2

      \[ \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{y}{\frac{x}{\color{blue}{z \cdot z}}} \]
    4. Applied egg-rr0.9

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

    if -inf.0 < (*.f64 (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000) z) < 1e266

    1. Initial program 0.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. Simplified0.3

      \[\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]0.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 [=>]0.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+ [=>]0.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 [<=]0.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 [=>]0.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 [=>]0.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+ [=>]0.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 [=>]0.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- [=>]0.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 [<=]0.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 [=>]0.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 [<=]0.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) \]

      *-commutative [=>]0.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) \]

      neg-mul-1 [<=]0.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) \]

      remove-double-neg [=>]0.4

      \[ 0.91893853320467 + \left(\color{blue}{\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) \]

      *-commutative [=>]0.4

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

      fma-def [=>]0.4

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

      fma-neg [=>]0.4

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

      metadata-eval [=>]0.4

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

      cancel-sign-sub-inv [=>]0.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 + \left(-\left(x - 0.5\right)\right) \cdot \log x\right)}\right) \]

      +-commutative [=>]0.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(\left(-\left(x - 0.5\right)\right) \cdot \log x + x\right)}\right) \]

      *-commutative [=>]0.4

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

      fma-def [=>]0.3

      \[ 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, -\left(x - 0.5\right), x\right)}\right) \]

      neg-sub0 [=>]0.3

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

      associate-+l- [<=]0.3

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

      neg-sub0 [<=]0.3

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

      +-commutative [<=]0.3

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

      unsub-neg [=>]0.3

      \[ 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, \color{blue}{0.5 - x}, x\right)\right) \]
    3. Applied egg-rr0.3

      \[\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) \]
    4. Simplified0.2

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

      \[ 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- [=>]0.3

      \[ 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 [<=]0.3

      \[ 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 [=>]0.2

      \[ 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 [=>]0.2

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

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

    1. Initial program 49.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-rr59.3

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

      \[\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)} \]
    4. Simplified0.4

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

      [Start]39.8

      \[ \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/ [=>]39.8

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

      metadata-eval [=>]39.8

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

      fma-def [=>]39.8

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

      *-commutative [=>]39.8

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

      unpow2 [=>]39.8

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

      associate-*l* [=>]0.4

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

      associate-*r/ [=>]0.4

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

      metadata-eval [=>]0.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot \left(-0.0027777777777778 + \left(y + 0.0007936500793651\right) \cdot z\right) \leq -\infty:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + z \cdot \frac{y}{\frac{x}{z}}\\ \mathbf{elif}\;z \cdot \left(-0.0027777777777778 + \left(y + 0.0007936500793651\right) \cdot z\right) \leq 10^{+266}:\\ \;\;\;\;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)\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + \left(\frac{0.083333333333333}{x} + \mathsf{fma}\left(-0.0027777777777778, \frac{z}{x}, z \cdot \left(z \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right)\right)\right)\right)\\ \end{array} \]

Alternatives

Alternative 1
Error0.4
Cost34632
\[\begin{array}{l} t_0 := \log x \cdot \left(x + -0.5\right)\\ t_1 := 0.91893853320467 + \left(t_0 - x\right)\\ t_2 := z \cdot \left(-0.0027777777777778 + \left(y + 0.0007936500793651\right) \cdot z\right)\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;t_1 + z \cdot \frac{y}{\frac{x}{z}}\\ \mathbf{elif}\;t_2 \leq 2 \cdot 10^{+105}:\\ \;\;\;\;\frac{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}{x} + \left(\left(\left(0.91893853320467 + t_0\right) - e^{\mathsf{log1p}\left(x\right)}\right) + 1\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 + \left(\frac{0.083333333333333}{x} + \mathsf{fma}\left(-0.0027777777777778, \frac{z}{x}, z \cdot \left(z \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right)\right)\right)\right)\\ \end{array} \]
Alternative 2
Error0.3
Cost27976
\[\begin{array}{l} t_0 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\ t_1 := z \cdot \left(-0.0027777777777778 + \left(y + 0.0007936500793651\right) \cdot z\right)\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;t_0 + z \cdot \frac{y}{\frac{x}{z}}\\ \mathbf{elif}\;t_1 \leq 10^{+266}:\\ \;\;\;\;\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}:\\ \;\;\;\;t_0 + \left(\frac{0.083333333333333}{x} + \mathsf{fma}\left(-0.0027777777777778, \frac{z}{x}, z \cdot \left(z \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right)\right)\right)\right)\\ \end{array} \]
Alternative 3
Error0.3
Cost15944
\[\begin{array}{l} t_0 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\ t_1 := z \cdot \left(-0.0027777777777778 + \left(y + 0.0007936500793651\right) \cdot z\right)\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;t_0 + z \cdot \frac{y}{\frac{x}{z}}\\ \mathbf{elif}\;t_1 \leq 10^{+266}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot -0.5 + x \cdot \left(\log x + -1\right)\right)\right) + \frac{t_1 + 0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0 + \left(\frac{0.083333333333333}{x} + \mathsf{fma}\left(-0.0027777777777778, \frac{z}{x}, z \cdot \left(z \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right)\right)\right)\right)\\ \end{array} \]
Alternative 4
Error0.7
Cost15688
\[\begin{array}{l} t_0 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\ t_1 := \left(y + 0.0007936500793651\right) \cdot z\\ t_2 := z \cdot \left(-0.0027777777777778 + t_1\right)\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;t_0 + z \cdot \frac{y}{\frac{x}{z}}\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{+212}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot -0.5 + x \cdot \left(\log x + -1\right)\right)\right) + \frac{t_2 + 0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0 + z \cdot \frac{t_1}{x}\\ \end{array} \]
Alternative 5
Error0.8
Cost9160
\[\begin{array}{l} t_0 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\ t_1 := \left(y + 0.0007936500793651\right) \cdot z\\ t_2 := z \cdot \left(-0.0027777777777778 + t_1\right)\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;t_0 + z \cdot \frac{y}{\frac{x}{z}}\\ \mathbf{elif}\;t_2 \leq 10^{+130}:\\ \;\;\;\;t_0 + \frac{t_2 + 0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0 + z \cdot \frac{t_1}{x}\\ \end{array} \]
Alternative 6
Error1.9
Cost9032
\[\begin{array}{l} t_0 := \left(y + 0.0007936500793651\right) \cdot z\\ t_1 := z \cdot \left(-0.0027777777777778 + t_0\right)\\ t_2 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{+19}:\\ \;\;\;\;t_2 + z \cdot \frac{y}{\frac{x}{z}}\\ \mathbf{elif}\;t_1 \leq 0.005:\\ \;\;\;\;t_2 + \left(-0.0027777777777778 \cdot \frac{z}{x} + 0.083333333333333 \cdot \frac{1}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 + z \cdot \frac{t_0}{x}\\ \end{array} \]
Alternative 7
Error1.9
Cost9032
\[\begin{array}{l} t_0 := \left(y + 0.0007936500793651\right) \cdot z\\ t_1 := z \cdot \left(-0.0027777777777778 + t_0\right)\\ t_2 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{+19}:\\ \;\;\;\;t_2 + z \cdot \frac{y}{\frac{x}{z}}\\ \mathbf{elif}\;t_1 \leq 0.005:\\ \;\;\;\;t_2 + \left(\frac{1}{\frac{x}{0.083333333333333}} + -0.0027777777777778 \cdot \frac{z}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 + z \cdot \frac{t_0}{x}\\ \end{array} \]
Alternative 8
Error2.0
Cost8904
\[\begin{array}{l} t_0 := \left(y + 0.0007936500793651\right) \cdot z\\ t_1 := z \cdot \left(-0.0027777777777778 + t_0\right)\\ t_2 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{+19}:\\ \;\;\;\;t_2 + z \cdot \frac{y}{\frac{x}{z}}\\ \mathbf{elif}\;t_1 \leq 0.005:\\ \;\;\;\;t_2 + \frac{0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;t_2 + z \cdot \frac{t_0}{x}\\ \end{array} \]
Alternative 9
Error9.7
Cost7753
\[\begin{array}{l} t_0 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\ \mathbf{if}\;z \leq -3.3 \cdot 10^{-78} \lor \neg \left(z \leq 1.9 \cdot 10^{-32}\right):\\ \;\;\;\;t_0 + z \cdot \frac{y}{\frac{x}{z}}\\ \mathbf{else}:\\ \;\;\;\;t_0 + \frac{0.083333333333333}{x}\\ \end{array} \]
Alternative 10
Error10.1
Cost7752
\[\begin{array}{l} t_0 := 0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\\ \mathbf{if}\;x \leq 11000:\\ \;\;\;\;t_0 + \frac{0.083333333333333}{x}\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+136}:\\ \;\;\;\;t_0 + \frac{y}{x} \cdot \left(z \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.083333333333333}{x} + \left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right)\\ \end{array} \]
Alternative 11
Error3.5
Cost7748
\[\begin{array}{l} \mathbf{if}\;x \leq 10:\\ \;\;\;\;\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{else}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + z \cdot \frac{y}{\frac{x}{z}}\\ \end{array} \]
Alternative 12
Error10.3
Cost7624
\[\begin{array}{l} \mathbf{if}\;x \leq 13000:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + \frac{0.083333333333333}{x}\\ \mathbf{elif}\;x \leq 2 \cdot 10^{+137}:\\ \;\;\;\;\left(0.91893853320467 + \left(x \cdot \log x - x\right)\right) + \frac{y}{\frac{x}{z \cdot z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.083333333333333}{x} + \left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right)\\ \end{array} \]
Alternative 13
Error13.5
Cost7497
\[\begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{+51} \lor \neg \left(z \leq -1.4 \cdot 10^{+19}\right):\\ \;\;\;\;\frac{0.083333333333333}{x} + \left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) + \frac{y}{\frac{x}{z \cdot z}}\\ \end{array} \]
Alternative 14
Error12.5
Cost7496
\[\begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{+51}:\\ \;\;\;\;\frac{0.083333333333333}{x} + \left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right)\\ \mathbf{elif}\;z \leq -2.8 \cdot 10^{+20}:\\ \;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) + \frac{y}{\frac{x}{z \cdot z}}\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + \frac{0.083333333333333}{x}\\ \end{array} \]
Alternative 15
Error12.9
Cost7104
\[\frac{0.083333333333333}{x} + \left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right) \]
Alternative 16
Error42.8
Cost6656
\[{\left(x \cdot 12.000000000000048\right)}^{-1} \]
Alternative 17
Error42.8
Cost448
\[\frac{0.083333333333333 + z \cdot -0.0027777777777778}{x} \]
Alternative 18
Error42.8
Cost192
\[\frac{0.083333333333333}{x} \]

Error

Reproduce

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