Average Error: 6.0 → 0.4
Time: 18.9s
Precision: binary64
Cost: 26952
\[\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 \frac{y}{\frac{x}{z}}\\ t_1 := \left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\\ \mathbf{if}\;z \leq -1 \cdot 10^{+15}:\\ \;\;\;\;t_1 + \left(t_0 + \left(\frac{0.083333333333333}{x} + \frac{z}{x} \cdot \left(z \cdot 0.0007936500793651\right)\right)\right)\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-64}:\\ \;\;\;\;\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}\\ \mathbf{else}:\\ \;\;\;\;t_1 + \left(t_0 + \left(\frac{0.083333333333333}{x} + \frac{\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right)}{\frac{x}{z}}\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 (/ y (/ x z))))
        (t_1 (+ (- (* (+ x -0.5) (log x)) x) 0.91893853320467)))
   (if (<= z -1e+15)
     (+
      t_1
      (+ t_0 (+ (/ 0.083333333333333 x) (* (/ z x) (* z 0.0007936500793651)))))
     (if (<= z 2e-64)
       (+
        (fma (+ x -0.5) (log x) (- 0.91893853320467 x))
        (/
         (fma
          z
          (fma (+ y 0.0007936500793651) z -0.0027777777777778)
          0.083333333333333)
         x))
       (+
        t_1
        (+
         t_0
         (+
          (/ 0.083333333333333 x)
          (/ (fma 0.0007936500793651 z -0.0027777777777778) (/ x z)))))))))
double code(double x, double y, double z) {
	return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
double code(double x, double y, double z) {
	double t_0 = z * (y / (x / z));
	double t_1 = (((x + -0.5) * log(x)) - x) + 0.91893853320467;
	double tmp;
	if (z <= -1e+15) {
		tmp = t_1 + (t_0 + ((0.083333333333333 / x) + ((z / x) * (z * 0.0007936500793651))));
	} else if (z <= 2e-64) {
		tmp = fma((x + -0.5), log(x), (0.91893853320467 - x)) + (fma(z, fma((y + 0.0007936500793651), z, -0.0027777777777778), 0.083333333333333) / x);
	} else {
		tmp = t_1 + (t_0 + ((0.083333333333333 / x) + (fma(0.0007936500793651, z, -0.0027777777777778) / (x / z))));
	}
	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(y / Float64(x / z)))
	t_1 = Float64(Float64(Float64(Float64(x + -0.5) * log(x)) - x) + 0.91893853320467)
	tmp = 0.0
	if (z <= -1e+15)
		tmp = Float64(t_1 + Float64(t_0 + Float64(Float64(0.083333333333333 / x) + Float64(Float64(z / x) * Float64(z * 0.0007936500793651)))));
	elseif (z <= 2e-64)
		tmp = Float64(fma(Float64(x + -0.5), log(x), Float64(0.91893853320467 - x)) + Float64(fma(z, fma(Float64(y + 0.0007936500793651), z, -0.0027777777777778), 0.083333333333333) / x));
	else
		tmp = Float64(t_1 + Float64(t_0 + Float64(Float64(0.083333333333333 / x) + Float64(fma(0.0007936500793651, z, -0.0027777777777778) / Float64(x / z)))));
	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[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(x + -0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision]}, If[LessEqual[z, -1e+15], N[(t$95$1 + N[(t$95$0 + N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(N[(z / x), $MachinePrecision] * N[(z * 0.0007936500793651), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e-64], N[(N[(N[(x + -0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision] + N[(N[(z * N[(N[(y + 0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(t$95$0 + N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(N[(0.0007936500793651 * z + -0.0027777777777778), $MachinePrecision] / N[(x / z), $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 := z \cdot \frac{y}{\frac{x}{z}}\\
t_1 := \left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\\
\mathbf{if}\;z \leq -1 \cdot 10^{+15}:\\
\;\;\;\;t_1 + \left(t_0 + \left(\frac{0.083333333333333}{x} + \frac{z}{x} \cdot \left(z \cdot 0.0007936500793651\right)\right)\right)\\

\mathbf{elif}\;z \leq 2 \cdot 10^{-64}:\\
\;\;\;\;\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}\\

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


\end{array}

Error

Target

Original6.0
Target1.4
Herbie0.4
\[\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 < -1e15

    1. Initial program 22.7

      \[\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 0 22.9

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

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \color{blue}{\left(\frac{y}{\frac{x}{z \cdot z}} + \left(\frac{0.083333333333333}{x} + \frac{\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right)}{\frac{x}{z}}\right)\right)} \]
      Proof
      (+.f64 (/.f64 y (/.f64 x (*.f64 z z))) (+.f64 (/.f64 83333333333333/1000000000000000 x) (/.f64 (fma.f64 7936500793651/10000000000000000 z -13888888888889/5000000000000000) (/.f64 x z)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 y (/.f64 x (Rewrite<= unpow2_binary64 (pow.f64 z 2)))) (+.f64 (/.f64 83333333333333/1000000000000000 x) (/.f64 (fma.f64 7936500793651/10000000000000000 z -13888888888889/5000000000000000) (/.f64 x z)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 y (pow.f64 z 2)) x)) (+.f64 (/.f64 83333333333333/1000000000000000 x) (/.f64 (fma.f64 7936500793651/10000000000000000 z -13888888888889/5000000000000000) (/.f64 x z)))): 22 points increase in error, 6 points decrease in error
      (+.f64 (/.f64 (*.f64 y (pow.f64 z 2)) x) (+.f64 (/.f64 (Rewrite<= metadata-eval (*.f64 83333333333333/1000000000000000 1)) x) (/.f64 (fma.f64 7936500793651/10000000000000000 z -13888888888889/5000000000000000) (/.f64 x z)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 y (pow.f64 z 2)) x) (+.f64 (Rewrite<= associate-*r/_binary64 (*.f64 83333333333333/1000000000000000 (/.f64 1 x))) (/.f64 (fma.f64 7936500793651/10000000000000000 z -13888888888889/5000000000000000) (/.f64 x z)))): 31 points increase in error, 20 points decrease in error
      (+.f64 (/.f64 (*.f64 y (pow.f64 z 2)) x) (+.f64 (*.f64 83333333333333/1000000000000000 (/.f64 1 x)) (/.f64 (fma.f64 7936500793651/10000000000000000 z (Rewrite<= metadata-eval (neg.f64 13888888888889/5000000000000000))) (/.f64 x z)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 y (pow.f64 z 2)) x) (+.f64 (*.f64 83333333333333/1000000000000000 (/.f64 1 x)) (/.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 7936500793651/10000000000000000 z) 13888888888889/5000000000000000)) (/.f64 x z)))): 1 points increase in error, 1 points decrease in error
      (+.f64 (/.f64 (*.f64 y (pow.f64 z 2)) x) (+.f64 (*.f64 83333333333333/1000000000000000 (/.f64 1 x)) (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (-.f64 (*.f64 7936500793651/10000000000000000 z) 13888888888889/5000000000000000) z) x)))): 4 points increase in error, 6 points decrease in error
    4. Applied egg-rr0.4

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

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

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(\frac{y}{\frac{x}{z}} \cdot z + \left(\frac{0.083333333333333}{x} + \color{blue}{\frac{z}{x} \cdot \left(z \cdot 0.0007936500793651\right)}\right)\right) \]
      Proof
      (*.f64 (/.f64 z x) (*.f64 z 7936500793651/10000000000000000)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 (/.f64 z x) z) 7936500793651/10000000000000000)): 20 points increase in error, 31 points decrease in error
      (*.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 z z) x)) 7936500793651/10000000000000000): 53 points increase in error, 11 points decrease in error
      (*.f64 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 z 2)) x) 7936500793651/10000000000000000): 0 points increase in error, 0 points decrease in error
      (Rewrite<= *-commutative_binary64 (*.f64 7936500793651/10000000000000000 (/.f64 (pow.f64 z 2) x))): 0 points increase in error, 0 points decrease in error

    if -1e15 < z < 1.99999999999999993e-64

    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}{\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
      (+.f64 (fma.f64 (+.f64 x -1/2) (log.f64 x) (-.f64 91893853320467/100000000000000 x)) (/.f64 (fma.f64 z (fma.f64 (+.f64 y 7936500793651/10000000000000000) z -13888888888889/5000000000000000) 83333333333333/1000000000000000) x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (fma.f64 (+.f64 x (Rewrite<= metadata-eval (neg.f64 1/2))) (log.f64 x) (-.f64 91893853320467/100000000000000 x)) (/.f64 (fma.f64 z (fma.f64 (+.f64 y 7936500793651/10000000000000000) z -13888888888889/5000000000000000) 83333333333333/1000000000000000) x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (fma.f64 (Rewrite<= sub-neg_binary64 (-.f64 x 1/2)) (log.f64 x) (-.f64 91893853320467/100000000000000 x)) (/.f64 (fma.f64 z (fma.f64 (+.f64 y 7936500793651/10000000000000000) z -13888888888889/5000000000000000) 83333333333333/1000000000000000) x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (fma.f64 (-.f64 x 1/2) (log.f64 x) (Rewrite<= unsub-neg_binary64 (+.f64 91893853320467/100000000000000 (neg.f64 x)))) (/.f64 (fma.f64 z (fma.f64 (+.f64 y 7936500793651/10000000000000000) z -13888888888889/5000000000000000) 83333333333333/1000000000000000) x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (fma.f64 (-.f64 x 1/2) (log.f64 x) (Rewrite<= +-commutative_binary64 (+.f64 (neg.f64 x) 91893853320467/100000000000000))) (/.f64 (fma.f64 z (fma.f64 (+.f64 y 7936500793651/10000000000000000) z -13888888888889/5000000000000000) 83333333333333/1000000000000000) x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (-.f64 x 1/2) (log.f64 x)) (+.f64 (neg.f64 x) 91893853320467/100000000000000))) (/.f64 (fma.f64 z (fma.f64 (+.f64 y 7936500793651/10000000000000000) z -13888888888889/5000000000000000) 83333333333333/1000000000000000) x)): 19 points increase in error, 11 points decrease in error
      (+.f64 (+.f64 (*.f64 (-.f64 x 1/2) (log.f64 x)) (Rewrite=> +-commutative_binary64 (+.f64 91893853320467/100000000000000 (neg.f64 x)))) (/.f64 (fma.f64 z (fma.f64 (+.f64 y 7936500793651/10000000000000000) z -13888888888889/5000000000000000) 83333333333333/1000000000000000) x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 (*.f64 (-.f64 x 1/2) (log.f64 x)) 91893853320467/100000000000000) (neg.f64 x))) (/.f64 (fma.f64 z (fma.f64 (+.f64 y 7936500793651/10000000000000000) z -13888888888889/5000000000000000) 83333333333333/1000000000000000) x)): 1 points increase in error, 1 points decrease in error
      (+.f64 (+.f64 (Rewrite<= +-commutative_binary64 (+.f64 91893853320467/100000000000000 (*.f64 (-.f64 x 1/2) (log.f64 x)))) (neg.f64 x)) (/.f64 (fma.f64 z (fma.f64 (+.f64 y 7936500793651/10000000000000000) z -13888888888889/5000000000000000) 83333333333333/1000000000000000) x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (+.f64 91893853320467/100000000000000 (*.f64 (-.f64 x 1/2) (log.f64 x))) (neg.f64 x)) (/.f64 (fma.f64 z (fma.f64 (+.f64 y 7936500793651/10000000000000000) z (Rewrite<= metadata-eval (neg.f64 13888888888889/5000000000000000))) 83333333333333/1000000000000000) x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (+.f64 91893853320467/100000000000000 (*.f64 (-.f64 x 1/2) (log.f64 x))) (neg.f64 x)) (/.f64 (fma.f64 z (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000)) 83333333333333/1000000000000000) x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (+.f64 91893853320467/100000000000000 (*.f64 (-.f64 x 1/2) (log.f64 x))) (neg.f64 x)) (/.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 z (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000)) 83333333333333/1000000000000000)) x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (+.f64 91893853320467/100000000000000 (*.f64 (-.f64 x 1/2) (log.f64 x))) (neg.f64 x)) (/.f64 (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000) z)) 83333333333333/1000000000000000) x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= associate-+r+_binary64 (+.f64 91893853320467/100000000000000 (+.f64 (*.f64 (-.f64 x 1/2) (log.f64 x)) (neg.f64 x)))) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000) z) 83333333333333/1000000000000000) x)): 0 points increase in error, 1 points decrease in error
      (+.f64 (+.f64 91893853320467/100000000000000 (Rewrite<= sub-neg_binary64 (-.f64 (*.f64 (-.f64 x 1/2) (log.f64 x)) x))) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000) z) 83333333333333/1000000000000000) x)): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= +-commutative_binary64 (+.f64 (-.f64 (*.f64 (-.f64 x 1/2) (log.f64 x)) x) 91893853320467/100000000000000)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y 7936500793651/10000000000000000) z) 13888888888889/5000000000000000) z) 83333333333333/1000000000000000) x)): 0 points increase in error, 0 points decrease in error

    if 1.99999999999999993e-64 < z

    1. Initial program 13.3

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

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

      \[\leadsto \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \color{blue}{\left(\frac{y}{\frac{x}{z \cdot z}} + \left(\frac{0.083333333333333}{x} + \frac{\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right)}{\frac{x}{z}}\right)\right)} \]
      Proof
      (+.f64 (/.f64 y (/.f64 x (*.f64 z z))) (+.f64 (/.f64 83333333333333/1000000000000000 x) (/.f64 (fma.f64 7936500793651/10000000000000000 z -13888888888889/5000000000000000) (/.f64 x z)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 y (/.f64 x (Rewrite<= unpow2_binary64 (pow.f64 z 2)))) (+.f64 (/.f64 83333333333333/1000000000000000 x) (/.f64 (fma.f64 7936500793651/10000000000000000 z -13888888888889/5000000000000000) (/.f64 x z)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 y (pow.f64 z 2)) x)) (+.f64 (/.f64 83333333333333/1000000000000000 x) (/.f64 (fma.f64 7936500793651/10000000000000000 z -13888888888889/5000000000000000) (/.f64 x z)))): 22 points increase in error, 6 points decrease in error
      (+.f64 (/.f64 (*.f64 y (pow.f64 z 2)) x) (+.f64 (/.f64 (Rewrite<= metadata-eval (*.f64 83333333333333/1000000000000000 1)) x) (/.f64 (fma.f64 7936500793651/10000000000000000 z -13888888888889/5000000000000000) (/.f64 x z)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 y (pow.f64 z 2)) x) (+.f64 (Rewrite<= associate-*r/_binary64 (*.f64 83333333333333/1000000000000000 (/.f64 1 x))) (/.f64 (fma.f64 7936500793651/10000000000000000 z -13888888888889/5000000000000000) (/.f64 x z)))): 31 points increase in error, 20 points decrease in error
      (+.f64 (/.f64 (*.f64 y (pow.f64 z 2)) x) (+.f64 (*.f64 83333333333333/1000000000000000 (/.f64 1 x)) (/.f64 (fma.f64 7936500793651/10000000000000000 z (Rewrite<= metadata-eval (neg.f64 13888888888889/5000000000000000))) (/.f64 x z)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 (*.f64 y (pow.f64 z 2)) x) (+.f64 (*.f64 83333333333333/1000000000000000 (/.f64 1 x)) (/.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 7936500793651/10000000000000000 z) 13888888888889/5000000000000000)) (/.f64 x z)))): 1 points increase in error, 1 points decrease in error
      (+.f64 (/.f64 (*.f64 y (pow.f64 z 2)) x) (+.f64 (*.f64 83333333333333/1000000000000000 (/.f64 1 x)) (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (-.f64 (*.f64 7936500793651/10000000000000000 z) 13888888888889/5000000000000000) z) x)))): 4 points increase in error, 6 points decrease in error
    4. Applied egg-rr0.8

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

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

Alternatives

Alternative 1
Error0.4
Cost21252
\[\begin{array}{l} t_0 := \left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\\ \mathbf{if}\;x \leq 10^{-21}:\\ \;\;\;\;t_0 + \left(\frac{y}{\frac{x}{z \cdot z}} + \left(\frac{\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right)}{\frac{x}{z}} + {\left(x \cdot 12.000000000000048\right)}^{-1}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 + \left(z \cdot \frac{y}{\frac{x}{z}} + \left(\frac{z}{x} \cdot \left(z \cdot 0.0007936500793651\right) + \sqrt{\frac{\frac{0.0069444444444443885}{x}}{x}}\right)\right)\\ \end{array} \]
Alternative 2
Error0.4
Cost14916
\[\begin{array}{l} t_0 := \left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\\ \mathbf{if}\;x \leq 10^{-23}:\\ \;\;\;\;t_0 + \left(\left(\frac{0.083333333333333}{x} + \frac{\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right)}{\frac{x}{z}}\right) + \frac{y}{\frac{x}{z \cdot z}}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 + \left(z \cdot \frac{y}{\frac{x}{z}} + \left(\frac{z}{x} \cdot \left(z \cdot 0.0007936500793651\right) + \sqrt{\frac{\frac{0.0069444444444443885}{x}}{x}}\right)\right)\\ \end{array} \]
Alternative 3
Error0.4
Cost14788
\[\begin{array}{l} t_0 := \left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\\ \mathbf{if}\;x \leq 5 \cdot 10^{-22}:\\ \;\;\;\;t_0 + \left(\left(\frac{0.083333333333333}{x} + \frac{\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right)}{\frac{x}{z}}\right) + \frac{y}{\frac{x}{z \cdot z}}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 + \left(z \cdot \frac{y}{\frac{x}{z}} + \left(\frac{0.083333333333333}{x} + \frac{z}{x} \cdot \left(z \cdot 0.0007936500793651\right)\right)\right)\\ \end{array} \]
Alternative 4
Error0.4
Cost9544
\[\begin{array}{l} t_0 := \left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\\ t_1 := z \cdot \left(-0.0027777777777778 + z \cdot \left(y + 0.0007936500793651\right)\right)\\ t_2 := z \cdot \frac{y}{\frac{x}{z}}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;t_0 + t_2\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+127}:\\ \;\;\;\;t_0 + \frac{0.083333333333333 + t_1}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0 + \left(t_2 + \left(\frac{0.083333333333333}{x} + \frac{z}{x} \cdot \left(z \cdot 0.0007936500793651\right)\right)\right)\\ \end{array} \]
Alternative 5
Error2.0
Cost9160
\[\begin{array}{l} t_0 := \left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\\ t_1 := z \cdot \left(-0.0027777777777778 + z \cdot \left(y + 0.0007936500793651\right)\right)\\ t_2 := t_0 + z \cdot \frac{y}{\frac{x}{z}}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 10^{+279}:\\ \;\;\;\;t_0 + \frac{0.083333333333333 + t_1}{x}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Error11.3
Cost7884
\[\begin{array}{l} t_0 := \left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\\ t_1 := t_0 + \left(z \cdot z\right) \cdot \frac{y}{x}\\ \mathbf{if}\;z \leq -2.6 \cdot 10^{+70}:\\ \;\;\;\;0.91893853320467 + \left(z \cdot \left(z \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right)\right) - x\right)\\ \mathbf{elif}\;z \leq -1.9 \cdot 10^{-12}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-63}:\\ \;\;\;\;t_0 + \frac{0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error2.5
Cost7880
\[\begin{array}{l} t_0 := \left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\\ \mathbf{if}\;x \leq 0.195:\\ \;\;\;\;\frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot \left(y + 0.0007936500793651\right)\right)}{x} + \left(0.91893853320467 + \log x \cdot -0.5\right)\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+83}:\\ \;\;\;\;t_0 + \frac{z \cdot z}{\frac{x}{y + 0.0007936500793651}}\\ \mathbf{else}:\\ \;\;\;\;t_0 + z \cdot \frac{y}{\frac{x}{z}}\\ \end{array} \]
Alternative 8
Error11.2
Cost7756
\[\begin{array}{l} t_0 := \frac{y}{\frac{x}{z \cdot z}} + \left(0.91893853320467 + \left(x \cdot \log x - x\right)\right)\\ \mathbf{if}\;z \leq -3.2 \cdot 10^{+70}:\\ \;\;\;\;0.91893853320467 + \left(z \cdot \left(z \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right)\right) - x\right)\\ \mathbf{elif}\;z \leq -3 \cdot 10^{-9}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{-63}:\\ \;\;\;\;\left(\left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{0.083333333333333}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error3.8
Cost7748
\[\begin{array}{l} \mathbf{if}\;x \leq 7.4:\\ \;\;\;\;\frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot \left(y + 0.0007936500793651\right)\right)}{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{y}{\frac{x}{z}}\\ \end{array} \]
Alternative 10
Error7.1
Cost7620
\[\begin{array}{l} \mathbf{if}\;x \leq 46:\\ \;\;\;\;0.91893853320467 + \frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot 0.0007936500793651\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + z \cdot \frac{y}{\frac{x}{z}}\\ \end{array} \]
Alternative 11
Error12.2
Cost7364
\[\begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{+70}:\\ \;\;\;\;0.91893853320467 + \left(z \cdot \left(z \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right)\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(x + -0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{0.083333333333333}{x}\\ \end{array} \]
Alternative 12
Error10.3
Cost6980
\[\begin{array}{l} \mathbf{if}\;x \leq 1560000:\\ \;\;\;\;0.91893853320467 + \frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot 0.0007936500793651\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;0.91893853320467 + x \cdot \left(\log x + -1\right)\\ \end{array} \]
Alternative 13
Error35.0
Cost1224
\[\begin{array}{l} t_0 := 0.91893853320467 + \left(z \cdot \left(z \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right)\right) - x\right)\\ \mathbf{if}\;z \leq -150000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-63}:\\ \;\;\;\;0.91893853320467 + \frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot 0.0007936500793651\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 14
Error36.0
Cost1096
\[\begin{array}{l} \mathbf{if}\;z \leq -14500000:\\ \;\;\;\;0.91893853320467 + \left(\frac{z}{\frac{x}{z \cdot \left(y + 0.0007936500793651\right)}} - x\right)\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{-63}:\\ \;\;\;\;0.91893853320467 + \frac{0.083333333333333 + z \cdot \left(-0.0027777777777778 + z \cdot 0.0007936500793651\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;0.91893853320467 + \left(z \cdot z\right) \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right)\\ \end{array} \]
Alternative 15
Error52.1
Cost968
\[\begin{array}{l} t_0 := 0.91893853320467 + \left(z \cdot \left(y \cdot \frac{z}{x}\right) - x\right)\\ \mathbf{if}\;y \leq -0.0008:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.00078:\\ \;\;\;\;0.91893853320467 + \left(z \cdot \left(\frac{z}{x} \cdot 0.0007936500793651\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 16
Error52.1
Cost968
\[\begin{array}{l} t_0 := 0.91893853320467 + \left(z \cdot \left(y \cdot \frac{z}{x}\right) - x\right)\\ \mathbf{if}\;y \leq -0.00082:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.00078:\\ \;\;\;\;0.91893853320467 + \left(z \cdot \left(z \cdot \frac{0.0007936500793651}{x}\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 17
Error52.2
Cost968
\[\begin{array}{l} \mathbf{if}\;y \leq -0.00085:\\ \;\;\;\;0.91893853320467 + \left(z \cdot \left(y \cdot \frac{z}{x}\right) - x\right)\\ \mathbf{elif}\;y \leq 0.00078:\\ \;\;\;\;0.91893853320467 + \left(z \cdot \left(z \cdot \frac{0.0007936500793651}{x}\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;0.91893853320467 + \left(\frac{z}{x} \cdot \left(z \cdot y\right) - x\right)\\ \end{array} \]
Alternative 18
Error52.2
Cost968
\[\begin{array}{l} \mathbf{if}\;y \leq -9.2 \cdot 10^{-10}:\\ \;\;\;\;0.91893853320467 + \left(\frac{y}{\frac{x}{z \cdot z}} - x\right)\\ \mathbf{elif}\;y \leq 0.00078:\\ \;\;\;\;0.91893853320467 + \left(z \cdot \left(z \cdot \frac{0.0007936500793651}{x}\right) - x\right)\\ \mathbf{else}:\\ \;\;\;\;0.91893853320467 + \left(\frac{z}{x} \cdot \left(z \cdot y\right) - x\right)\\ \end{array} \]
Alternative 19
Error53.1
Cost832
\[0.91893853320467 + \left(z \cdot z\right) \cdot \left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right) \]
Alternative 20
Error57.2
Cost704
\[0.91893853320467 + \left(0.0007936500793651 \cdot \left(z \cdot \frac{z}{x}\right) - x\right) \]
Alternative 21
Error57.2
Cost704
\[0.91893853320467 + \left(z \cdot \left(\frac{z}{x} \cdot 0.0007936500793651\right) - x\right) \]
Alternative 22
Error62.4
Cost192
\[0.91893853320467 - x \]
Alternative 23
Error63.3
Cost128
\[-x \]

Error

Reproduce

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