?

Average Error: 9.94% → 0.65%
Time: 25.9s
Precision: binary64
Cost: 33608

?

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

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

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


\end{array}

Error?

Target

Original9.94%
Target2.13%
Herbie0.65%
\[\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 z < -2.9e21

    1. Initial program 38.52

      \[\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 x around inf 38.47

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

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

      [Start]38.47

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

      *-commutative [=>]38.47

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

      sub-neg [=>]38.47

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

      metadata-eval [=>]38.47

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

      distribute-lft-in [=>]38.52

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

      mul-1-neg [=>]38.52

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

      log-rec [=>]38.52

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

      remove-double-neg [=>]38.52

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

      distribute-lft-in [<=]38.47

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

      \[\leadsto \left(x \cdot \left(\log x + -1\right) + 0.91893853320467\right) + \color{blue}{\frac{{z}^{2} \cdot \left(0.0007936500793651 + y\right)}{x}} \]
    5. Simplified24.42

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

      [Start]38.89

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

      associate-/l* [=>]24.42

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

      unpow2 [=>]24.42

      \[ \left(x \cdot \left(\log x + -1\right) + 0.91893853320467\right) + \frac{\color{blue}{z \cdot z}}{\frac{x}{0.0007936500793651 + y}} \]
    6. Applied egg-rr0.44

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

    if -2.9e21 < z < 4.9999999999999997e-37

    1. Initial program 0.6

      \[\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.52

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[ \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-rr0.53

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

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

      [Start]0.53

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

      associate-+l- [=>]0.53

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

      *-commutative [=>]0.53

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

    if 4.9999999999999997e-37 < z

    1. Initial program 26.13

      \[\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 26.2

      \[\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(\frac{{z}^{2} \cdot \left(0.0007936500793651 + y\right)}{x} + -0.0027777777777778 \cdot \frac{z}{x}\right)\right)} \]
    3. Simplified17.18

      \[\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) + \frac{z \cdot z}{x} \cdot \left(0.0007936500793651 + y\right)\right)} \]
      Proof

      [Start]26.2

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

      +-commutative [=>]26.2

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

      associate-+r+ [=>]26.2

      \[ \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) + \frac{{z}^{2} \cdot \left(0.0007936500793651 + y\right)}{x}\right)} \]

      +-commutative [=>]26.2

      \[ \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)} + \frac{{z}^{2} \cdot \left(0.0007936500793651 + y\right)}{x}\right) \]

      fma-def [=>]26.2

      \[ \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}, 0.083333333333333 \cdot \frac{1}{x}\right)} + \frac{{z}^{2} \cdot \left(0.0007936500793651 + y\right)}{x}\right) \]

      associate-*r/ [=>]26.19

      \[ \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{0.083333333333333 \cdot 1}{x}}\right) + \frac{{z}^{2} \cdot \left(0.0007936500793651 + y\right)}{x}\right) \]

      metadata-eval [=>]26.19

      \[ \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) + \frac{{z}^{2} \cdot \left(0.0007936500793651 + y\right)}{x}\right) \]

      associate-/l* [=>]17.72

      \[ \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}{\frac{{z}^{2}}{\frac{x}{0.0007936500793651 + y}}}\right) \]

      associate-/r/ [=>]17.18

      \[ \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}{\frac{{z}^{2}}{x} \cdot \left(0.0007936500793651 + y\right)}\right) \]

      unpow2 [=>]17.18

      \[ \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) + \frac{\color{blue}{z \cdot z}}{x} \cdot \left(0.0007936500793651 + y\right)\right) \]
    4. Taylor expanded in z around 0 26.19

      \[\leadsto \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}{\frac{{z}^{2} \cdot \left(0.0007936500793651 + y\right)}{x}}\right) \]
    5. Simplified1.26

      \[\leadsto \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(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right)}\right) \]
      Proof

      [Start]26.19

      \[ \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) + \frac{{z}^{2} \cdot \left(0.0007936500793651 + y\right)}{x}\right) \]

      unpow2 [=>]26.19

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

      associate-*l/ [<=]17.18

      \[ \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}{\frac{z \cdot z}{x} \cdot \left(0.0007936500793651 + y\right)}\right) \]

      associate-*r/ [<=]1.21

      \[ \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 \frac{z}{x}\right)} \cdot \left(0.0007936500793651 + y\right)\right) \]

      associate-*l* [=>]1.26

      \[ \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(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right)}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.65

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

Alternatives

Alternative 1
Error0.86%
Cost15689
\[\begin{array}{l} t_0 := z \cdot \left(-0.0027777777777778 + z \cdot \left(0.0007936500793651 + y\right)\right)\\ t_1 := x \cdot \left(\log x + -1\right)\\ \mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 10^{+46}\right):\\ \;\;\;\;\left(0.91893853320467 + t_1\right) + z \cdot \left(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot -0.5 + t_1\right)\right) + \frac{0.083333333333333 + t_0}{x}\\ \end{array} \]
Alternative 2
Error0.92%
Cost14792
\[\begin{array}{l} t_0 := x \cdot \left(\log x + -1\right)\\ t_1 := z \cdot \left(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right)\\ \mathbf{if}\;z \leq -1.2 \cdot 10^{+22}:\\ \;\;\;\;\left(0.91893853320467 + t_0\right) + t_1\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{-93}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot -0.5 + t_0\right)\right) + \frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot \left(0.0007936500793651 + y\right)\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + \left(\mathsf{fma}\left(-0.0027777777777778, \frac{z}{x}, \frac{0.083333333333333}{x}\right) + t_1\right)\\ \end{array} \]
Alternative 3
Error8.05%
Cost9292
\[\begin{array}{l} t_0 := z \cdot \left(-0.0027777777777778 + z \cdot \left(0.0007936500793651 + y\right)\right)\\ t_1 := 0.91893853320467 + x \cdot \left(\log x + -1\right)\\ \mathbf{if}\;t_0 \leq -5:\\ \;\;\;\;t_1 + \frac{y}{\frac{x}{z \cdot z}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{-7}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + \frac{0.083333333333333}{x}\\ \mathbf{elif}\;t_0 \leq 10^{+21}:\\ \;\;\;\;\frac{0.083333333333333 + t_0}{x} - x\\ \mathbf{else}:\\ \;\;\;\;t_1 + \frac{z}{x} \cdot \left(z \cdot 0.0007936500793651\right)\\ \end{array} \]
Alternative 4
Error0.86%
Cost9161
\[\begin{array}{l} t_0 := z \cdot \left(-0.0027777777777778 + z \cdot \left(0.0007936500793651 + y\right)\right)\\ \mathbf{if}\;t_0 \leq -5 \cdot 10^{+249} \lor \neg \left(t_0 \leq 8 \cdot 10^{+60}\right):\\ \;\;\;\;\left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right) + z \cdot \left(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)\right) + \frac{0.083333333333333 + t_0}{x}\\ \end{array} \]
Alternative 5
Error0.56%
Cost8260
\[\begin{array}{l} \mathbf{if}\;x \leq 6.2 \cdot 10^{+18}:\\ \;\;\;\;\frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot \left(0.0007936500793651 + y\right)\right)}{x} + \frac{1}{\frac{1}{0.91893853320467 + \left(\log x \cdot \left(x + -0.5\right) - x\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right) + z \cdot \left(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right)\\ \end{array} \]
Alternative 6
Error1.64%
Cost7748
\[\begin{array}{l} \mathbf{if}\;x \leq 1.05:\\ \;\;\;\;\frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot \left(0.0007936500793651 + y\right)\right)}{x} + \left(0.91893853320467 + \log x \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right) + z \cdot \left(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right)\\ \end{array} \]
Alternative 7
Error2.13%
Cost7620
\[\begin{array}{l} \mathbf{if}\;x \leq 0.155:\\ \;\;\;\;\frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot \left(0.0007936500793651 + y\right)\right)}{x} - x\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right) + z \cdot \left(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right)\\ \end{array} \]
Alternative 8
Error7.38%
Cost7492
\[\begin{array}{l} \mathbf{if}\;x \leq 2750000000:\\ \;\;\;\;\frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot \left(0.0007936500793651 + y\right)\right)}{x} - x\\ \mathbf{else}:\\ \;\;\;\;\left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right) + z \cdot \left(\frac{z}{x} \cdot 0.0007936500793651\right)\\ \end{array} \]
Alternative 9
Error11.38%
Cost6980
\[\begin{array}{l} \mathbf{if}\;x \leq 3400000000:\\ \;\;\;\;\frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot \left(0.0007936500793651 + y\right)\right)}{x} - x\\ \mathbf{else}:\\ \;\;\;\;0.91893853320467 + x \cdot \left(\log x + -1\right)\\ \end{array} \]
Alternative 10
Error11.38%
Cost6980
\[\begin{array}{l} \mathbf{if}\;x \leq 3850000000:\\ \;\;\;\;\frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot \left(0.0007936500793651 + y\right)\right)}{x} - x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-1 - \log \left(\frac{1}{x}\right)\right)\\ \end{array} \]
Alternative 11
Error50.2%
Cost1092
\[\begin{array}{l} \mathbf{if}\;x \leq 1.26 \cdot 10^{+70}:\\ \;\;\;\;\frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot \left(0.0007936500793651 + y\right)\right)}{x} - x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{0.083333333333333}{x}\\ \end{array} \]
Alternative 12
Error53.71%
Cost969
\[\begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{-38} \lor \neg \left(z \leq 1.7 \cdot 10^{-16}\right):\\ \;\;\;\;\left(0.0007936500793651 + y\right) \cdot \frac{z \cdot z}{x} - x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{0.083333333333333}{x}\\ \end{array} \]
Alternative 13
Error54.29%
Cost968
\[\begin{array}{l} \mathbf{if}\;x \leq 1.1 \cdot 10^{-5}:\\ \;\;\;\;\frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot 0.0007936500793651\right)}{x} - x\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{+103}:\\ \;\;\;\;\frac{z \cdot z}{\frac{x}{0.0007936500793651 + y}} - x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{0.083333333333333}{x}\\ \end{array} \]
Alternative 14
Error60.88%
Cost841
\[\begin{array}{l} \mathbf{if}\;x \leq 0.00185 \lor \neg \left(x \leq 1.6 \cdot 10^{+49}\right):\\ \;\;\;\;x + \frac{0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{x}{z \cdot z}} - x\\ \end{array} \]
Alternative 15
Error60.89%
Cost841
\[\begin{array}{l} \mathbf{if}\;x \leq 0.00023 \lor \neg \left(x \leq 1.9 \cdot 10^{+49}\right):\\ \;\;\;\;x + \frac{0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot z}{\frac{x}{y}} - x\\ \end{array} \]
Alternative 16
Error61.53%
Cost320
\[x + \frac{0.083333333333333}{x} \]
Alternative 17
Error66.92%
Cost192
\[\frac{0.083333333333333}{x} \]
Alternative 18
Error98.82%
Cost128
\[-x \]

Error

Reproduce?

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