Average Error: 26.6 → 0.9
Time: 27.0s
Precision: binary64
Cost: 7624
\[\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606} \]
\[\begin{array}{l} t_0 := 47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(x + 43.3400022514\right)\right)\right)\\ t_1 := \mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right) + \left(\frac{3655.1204654076414}{x} + \frac{y + -130977.50649958357}{x \cdot x}\right)\\ \mathbf{if}\;x \leq -1.0384319402927958 \cdot 10^{+44}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.798492075447013 \cdot 10^{+53}:\\ \;\;\;\;\left(x + -2\right) \cdot \left(\frac{x \cdot \left(y + x \cdot \left(137.519416416 + x \cdot \left(78.6994924154 + x \cdot 4.16438922228\right)\right)\right)}{t_0} + \frac{z}{t_0}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
(FPCore (x y z)
 :precision binary64
 (/
  (*
   (- x 2.0)
   (+
    (*
     (+ (* (+ (* (+ (* x 4.16438922228) 78.6994924154) x) 137.519416416) x) y)
     x)
    z))
  (+
   (* (+ (* (+ (* (+ x 43.3400022514) x) 263.505074721) x) 313.399215894) x)
   47.066876606)))
(FPCore (x y z)
 :precision binary64
 (let* ((t_0
         (+
          47.066876606
          (*
           x
           (+
            313.399215894
            (* x (+ 263.505074721 (* x (+ x 43.3400022514))))))))
        (t_1
         (+
          (fma x 4.16438922228 -110.1139242984811)
          (+ (/ 3655.1204654076414 x) (/ (+ y -130977.50649958357) (* x x))))))
   (if (<= x -1.0384319402927958e+44)
     t_1
     (if (<= x 5.798492075447013e+53)
       (*
        (+ x -2.0)
        (+
         (/
          (*
           x
           (+
            y
            (*
             x
             (+ 137.519416416 (* x (+ 78.6994924154 (* x 4.16438922228)))))))
          t_0)
         (/ z t_0)))
       t_1))))
double code(double x, double y, double z) {
	return ((x - 2.0) * ((((((((x * 4.16438922228) + 78.6994924154) * x) + 137.519416416) * x) + y) * x) + z)) / (((((((x + 43.3400022514) * x) + 263.505074721) * x) + 313.399215894) * x) + 47.066876606);
}
double code(double x, double y, double z) {
	double t_0 = 47.066876606 + (x * (313.399215894 + (x * (263.505074721 + (x * (x + 43.3400022514))))));
	double t_1 = fma(x, 4.16438922228, -110.1139242984811) + ((3655.1204654076414 / x) + ((y + -130977.50649958357) / (x * x)));
	double tmp;
	if (x <= -1.0384319402927958e+44) {
		tmp = t_1;
	} else if (x <= 5.798492075447013e+53) {
		tmp = (x + -2.0) * (((x * (y + (x * (137.519416416 + (x * (78.6994924154 + (x * 4.16438922228))))))) / t_0) + (z / t_0));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z)
	return Float64(Float64(Float64(x - 2.0) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * 4.16438922228) + 78.6994924154) * x) + 137.519416416) * x) + y) * x) + z)) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(x + 43.3400022514) * x) + 263.505074721) * x) + 313.399215894) * x) + 47.066876606))
end
function code(x, y, z)
	t_0 = Float64(47.066876606 + Float64(x * Float64(313.399215894 + Float64(x * Float64(263.505074721 + Float64(x * Float64(x + 43.3400022514)))))))
	t_1 = Float64(fma(x, 4.16438922228, -110.1139242984811) + Float64(Float64(3655.1204654076414 / x) + Float64(Float64(y + -130977.50649958357) / Float64(x * x))))
	tmp = 0.0
	if (x <= -1.0384319402927958e+44)
		tmp = t_1;
	elseif (x <= 5.798492075447013e+53)
		tmp = Float64(Float64(x + -2.0) * Float64(Float64(Float64(x * Float64(y + Float64(x * Float64(137.519416416 + Float64(x * Float64(78.6994924154 + Float64(x * 4.16438922228))))))) / t_0) + Float64(z / t_0)));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_] := N[(N[(N[(x - 2.0), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(N[(x * 4.16438922228), $MachinePrecision] + 78.6994924154), $MachinePrecision] * x), $MachinePrecision] + 137.519416416), $MachinePrecision] * x), $MachinePrecision] + y), $MachinePrecision] * x), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(x + 43.3400022514), $MachinePrecision] * x), $MachinePrecision] + 263.505074721), $MachinePrecision] * x), $MachinePrecision] + 313.399215894), $MachinePrecision] * x), $MachinePrecision] + 47.066876606), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(47.066876606 + N[(x * N[(313.399215894 + N[(x * N[(263.505074721 + N[(x * N[(x + 43.3400022514), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * 4.16438922228 + -110.1139242984811), $MachinePrecision] + N[(N[(3655.1204654076414 / x), $MachinePrecision] + N[(N[(y + -130977.50649958357), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.0384319402927958e+44], t$95$1, If[LessEqual[x, 5.798492075447013e+53], N[(N[(x + -2.0), $MachinePrecision] * N[(N[(N[(x * N[(y + N[(x * N[(137.519416416 + N[(x * N[(78.6994924154 + N[(x * 4.16438922228), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] + N[(z / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606}
\begin{array}{l}
t_0 := 47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(x + 43.3400022514\right)\right)\right)\\
t_1 := \mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right) + \left(\frac{3655.1204654076414}{x} + \frac{y + -130977.50649958357}{x \cdot x}\right)\\
\mathbf{if}\;x \leq -1.0384319402927958 \cdot 10^{+44}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 5.798492075447013 \cdot 10^{+53}:\\
\;\;\;\;\left(x + -2\right) \cdot \left(\frac{x \cdot \left(y + x \cdot \left(137.519416416 + x \cdot \left(78.6994924154 + x \cdot 4.16438922228\right)\right)\right)}{t_0} + \frac{z}{t_0}\right)\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error

Target

Original26.6
Target0.8
Herbie0.9
\[\begin{array}{l} \mathbf{if}\;x < -3.326128725870005 \cdot 10^{+62}:\\ \;\;\;\;\left(\frac{y}{x \cdot x} + 4.16438922228 \cdot x\right) - 110.1139242984811\\ \mathbf{elif}\;x < 9.429991714554673 \cdot 10^{+55}:\\ \;\;\;\;\frac{x - 2}{1} \cdot \frac{\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z}{\left(\left(263.505074721 \cdot x + \left(43.3400022514 \cdot \left(x \cdot x\right) + x \cdot \left(x \cdot x\right)\right)\right) + 313.399215894\right) \cdot x + 47.066876606}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{x \cdot x} + 4.16438922228 \cdot x\right) - 110.1139242984811\\ \end{array} \]

Derivation

  1. Split input into 2 regimes
  2. if x < -1.0384319402927958e44 or 5.79849207544701291e53 < x

    1. Initial program 61.6

      \[\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606} \]
    2. Taylor expanded in x around inf 1.2

      \[\leadsto \color{blue}{\left(\frac{y}{{x}^{2}} + \left(4.16438922228 \cdot x + 3655.1204654076414 \cdot \frac{1}{x}\right)\right) - \left(110.1139242984811 + 130977.50649958357 \cdot \frac{1}{{x}^{2}}\right)} \]
    3. Simplified1.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right) + \left(\frac{3655.1204654076414}{x} - \frac{130977.50649958357 - y}{x \cdot x}\right)} \]
      Proof
      (+.f64 (fma.f64 x 104109730557/25000000000 -13764240537310136880149/125000000000000000000) (-.f64 (/.f64 2284450290879775841688574159837293/625000000000000000000000000000 x) (/.f64 (-.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 y) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (fma.f64 x 104109730557/25000000000 (Rewrite<= metadata-eval (neg.f64 13764240537310136880149/125000000000000000000))) (-.f64 (/.f64 2284450290879775841688574159837293/625000000000000000000000000000 x) (/.f64 (-.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 y) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 x 104109730557/25000000000) 13764240537310136880149/125000000000000000000)) (-.f64 (/.f64 2284450290879775841688574159837293/625000000000000000000000000000 x) (/.f64 (-.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 y) (*.f64 x x)))): 1 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 (Rewrite<= *-commutative_binary64 (*.f64 104109730557/25000000000 x)) 13764240537310136880149/125000000000000000000) (-.f64 (/.f64 2284450290879775841688574159837293/625000000000000000000000000000 x) (/.f64 (-.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 y) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 (*.f64 104109730557/25000000000 x) 13764240537310136880149/125000000000000000000) (-.f64 (/.f64 (Rewrite<= metadata-eval (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 1)) x) (/.f64 (-.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 y) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 (*.f64 104109730557/25000000000 x) 13764240537310136880149/125000000000000000000) (-.f64 (Rewrite<= associate-*r/_binary64 (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x))) (/.f64 (-.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 y) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 (*.f64 104109730557/25000000000 x) 13764240537310136880149/125000000000000000000) (-.f64 (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x)) (/.f64 (-.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 y) (Rewrite<= unpow2_binary64 (pow.f64 x 2))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 (*.f64 104109730557/25000000000 x) 13764240537310136880149/125000000000000000000) (-.f64 (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x)) (/.f64 (Rewrite<= unsub-neg_binary64 (+.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 (neg.f64 y))) (pow.f64 x 2)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (-.f64 (*.f64 104109730557/25000000000 x) 13764240537310136880149/125000000000000000000) (-.f64 (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x)) (/.f64 (+.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 (Rewrite<= mul-1-neg_binary64 (*.f64 -1 y))) (pow.f64 x 2)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (-.f64 (*.f64 104109730557/25000000000 x) 13764240537310136880149/125000000000000000000) (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x))) (/.f64 (+.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 (*.f64 -1 y)) (pow.f64 x 2)))): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x)) (-.f64 (*.f64 104109730557/25000000000 x) 13764240537310136880149/125000000000000000000))) (/.f64 (+.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 (*.f64 -1 y)) (pow.f64 x 2))): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x)) (*.f64 104109730557/25000000000 x)) 13764240537310136880149/125000000000000000000)) (/.f64 (+.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 (*.f64 -1 y)) (pow.f64 x 2))): 0 points increase in error, 0 points decrease in error
      (-.f64 (-.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x)))) 13764240537310136880149/125000000000000000000) (/.f64 (+.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 (*.f64 -1 y)) (pow.f64 x 2))): 0 points increase in error, 0 points decrease in error
      (-.f64 (-.f64 (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x))) 13764240537310136880149/125000000000000000000) (/.f64 (+.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 (Rewrite=> mul-1-neg_binary64 (neg.f64 y))) (pow.f64 x 2))): 0 points increase in error, 0 points decrease in error
      (-.f64 (-.f64 (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x))) 13764240537310136880149/125000000000000000000) (/.f64 (Rewrite=> unsub-neg_binary64 (-.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 y)) (pow.f64 x 2))): 0 points increase in error, 0 points decrease in error
      (-.f64 (-.f64 (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x))) 13764240537310136880149/125000000000000000000) (Rewrite=> div-sub_binary64 (-.f64 (/.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 (pow.f64 x 2)) (/.f64 y (pow.f64 x 2))))): 1 points increase in error, 0 points decrease in error
      (-.f64 (-.f64 (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x))) 13764240537310136880149/125000000000000000000) (-.f64 (/.f64 (Rewrite<= metadata-eval (*.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 1)) (pow.f64 x 2)) (/.f64 y (pow.f64 x 2)))): 0 points increase in error, 0 points decrease in error
      (-.f64 (-.f64 (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x))) 13764240537310136880149/125000000000000000000) (-.f64 (Rewrite<= associate-*r/_binary64 (*.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 (/.f64 1 (pow.f64 x 2)))) (/.f64 y (pow.f64 x 2)))): 4 points increase in error, 1 points decrease in error
      (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 (-.f64 (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x))) 13764240537310136880149/125000000000000000000) (*.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 (/.f64 1 (pow.f64 x 2)))) (/.f64 y (pow.f64 x 2)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= associate--r+_binary64 (-.f64 (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x))) (+.f64 13764240537310136880149/125000000000000000000 (*.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 (/.f64 1 (pow.f64 x 2)))))) (/.f64 y (pow.f64 x 2))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (/.f64 y (pow.f64 x 2)) (-.f64 (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x))) (+.f64 13764240537310136880149/125000000000000000000 (*.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 (/.f64 1 (pow.f64 x 2))))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (/.f64 y (pow.f64 x 2)) (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 2284450290879775841688574159837293/625000000000000000000000000000 (/.f64 1 x)))) (+.f64 13764240537310136880149/125000000000000000000 (*.f64 409304707811198655637810418659684985388407301/3125000000000000000000000000000000000000 (/.f64 1 (pow.f64 x 2)))))): 0 points increase in error, 0 points decrease in error

    if -1.0384319402927958e44 < x < 5.79849207544701291e53

    1. Initial program 1.5

      \[\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606} \]
    2. Simplified0.6

      \[\leadsto \color{blue}{\left(x + -2\right) \cdot \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, 4.16438922228, 78.6994924154\right), 137.519416416\right), y\right), z\right)}{\mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, x + 43.3400022514, 263.505074721\right), 313.399215894\right), 47.066876606\right)}} \]
      Proof
      (*.f64 (+.f64 x -2) (/.f64 (fma.f64 x (fma.f64 x (fma.f64 x (fma.f64 x 104109730557/25000000000 393497462077/5000000000) 4297481763/31250000) y) z) (fma.f64 x (fma.f64 x (fma.f64 x (+.f64 x 216700011257/5000000000) 263505074721/1000000000) 156699607947/500000000) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (+.f64 x (Rewrite<= metadata-eval (neg.f64 2))) (/.f64 (fma.f64 x (fma.f64 x (fma.f64 x (fma.f64 x 104109730557/25000000000 393497462077/5000000000) 4297481763/31250000) y) z) (fma.f64 x (fma.f64 x (fma.f64 x (+.f64 x 216700011257/5000000000) 263505074721/1000000000) 156699607947/500000000) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= sub-neg_binary64 (-.f64 x 2)) (/.f64 (fma.f64 x (fma.f64 x (fma.f64 x (fma.f64 x 104109730557/25000000000 393497462077/5000000000) 4297481763/31250000) y) z) (fma.f64 x (fma.f64 x (fma.f64 x (+.f64 x 216700011257/5000000000) 263505074721/1000000000) 156699607947/500000000) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 x 2) (/.f64 (fma.f64 x (fma.f64 x (fma.f64 x (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000)) 4297481763/31250000) y) z) (fma.f64 x (fma.f64 x (fma.f64 x (+.f64 x 216700011257/5000000000) 263505074721/1000000000) 156699607947/500000000) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 x 2) (/.f64 (fma.f64 x (fma.f64 x (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000)) 4297481763/31250000)) y) z) (fma.f64 x (fma.f64 x (fma.f64 x (+.f64 x 216700011257/5000000000) 263505074721/1000000000) 156699607947/500000000) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 x 2) (/.f64 (fma.f64 x (fma.f64 x (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000) x)) 4297481763/31250000) y) z) (fma.f64 x (fma.f64 x (fma.f64 x (+.f64 x 216700011257/5000000000) 263505074721/1000000000) 156699607947/500000000) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 x 2) (/.f64 (fma.f64 x (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x (+.f64 (*.f64 (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000) x) 4297481763/31250000)) y)) z) (fma.f64 x (fma.f64 x (fma.f64 x (+.f64 x 216700011257/5000000000) 263505074721/1000000000) 156699607947/500000000) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 x 2) (/.f64 (fma.f64 x (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000) x) 4297481763/31250000) x)) y) z) (fma.f64 x (fma.f64 x (fma.f64 x (+.f64 x 216700011257/5000000000) 263505074721/1000000000) 156699607947/500000000) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 x 2) (/.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000) x) 4297481763/31250000) x) y)) z)) (fma.f64 x (fma.f64 x (fma.f64 x (+.f64 x 216700011257/5000000000) 263505074721/1000000000) 156699607947/500000000) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 x 2) (/.f64 (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000) x) 4297481763/31250000) x) y) x)) z) (fma.f64 x (fma.f64 x (fma.f64 x (+.f64 x 216700011257/5000000000) 263505074721/1000000000) 156699607947/500000000) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 x 2) (/.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000) x) 4297481763/31250000) x) y) x) z) (fma.f64 x (fma.f64 x (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x (+.f64 x 216700011257/5000000000)) 263505074721/1000000000)) 156699607947/500000000) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 x 2) (/.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000) x) 4297481763/31250000) x) y) x) z) (fma.f64 x (fma.f64 x (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 (+.f64 x 216700011257/5000000000) x)) 263505074721/1000000000) 156699607947/500000000) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 x 2) (/.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000) x) 4297481763/31250000) x) y) x) z) (fma.f64 x (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x (+.f64 (*.f64 (+.f64 x 216700011257/5000000000) x) 263505074721/1000000000)) 156699607947/500000000)) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 x 2) (/.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000) x) 4297481763/31250000) x) y) x) z) (fma.f64 x (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 (+.f64 (*.f64 (+.f64 x 216700011257/5000000000) x) 263505074721/1000000000) x)) 156699607947/500000000) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 x 2) (/.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000) x) 4297481763/31250000) x) y) x) z) (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 x 216700011257/5000000000) x) 263505074721/1000000000) x) 156699607947/500000000)) 23533438303/500000000)))): 0 points increase in error, 0 points decrease in error
      (*.f64 (-.f64 x 2) (/.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000) x) 4297481763/31250000) x) y) x) z) (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 x 216700011257/5000000000) x) 263505074721/1000000000) x) 156699607947/500000000) x)) 23533438303/500000000))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (-.f64 x 2) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 x 104109730557/25000000000) 393497462077/5000000000) x) 4297481763/31250000) x) y) x) z)) (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 (*.f64 (+.f64 x 216700011257/5000000000) x) 263505074721/1000000000) x) 156699607947/500000000) x) 23533438303/500000000))): 10 points increase in error, 9 points decrease in error
    3. Taylor expanded in z around 0 0.6

      \[\leadsto \left(x + -2\right) \cdot \color{blue}{\left(\frac{\left(\left(137.519416416 + \left(78.6994924154 + 4.16438922228 \cdot x\right) \cdot x\right) \cdot x + y\right) \cdot x}{\left(313.399215894 + \left(263.505074721 + x \cdot \left(43.3400022514 + x\right)\right) \cdot x\right) \cdot x + 47.066876606} + \frac{z}{\left(313.399215894 + \left(263.505074721 + x \cdot \left(43.3400022514 + x\right)\right) \cdot x\right) \cdot x + 47.066876606}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.0384319402927958 \cdot 10^{+44}:\\ \;\;\;\;\mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right) + \left(\frac{3655.1204654076414}{x} + \frac{y + -130977.50649958357}{x \cdot x}\right)\\ \mathbf{elif}\;x \leq 5.798492075447013 \cdot 10^{+53}:\\ \;\;\;\;\left(x + -2\right) \cdot \left(\frac{x \cdot \left(y + x \cdot \left(137.519416416 + x \cdot \left(78.6994924154 + x \cdot 4.16438922228\right)\right)\right)}{47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(x + 43.3400022514\right)\right)\right)} + \frac{z}{47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(x + 43.3400022514\right)\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right) + \left(\frac{3655.1204654076414}{x} + \frac{y + -130977.50649958357}{x \cdot x}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error1.9
Cost7240
\[\begin{array}{l} t_0 := 47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(x + 43.3400022514\right)\right)\right)\\ t_1 := x \cdot \left(y + x \cdot \left(137.519416416 + x \cdot \left(78.6994924154 + x \cdot 4.16438922228\right)\right)\right)\\ t_2 := \frac{\left(x + -2\right) \cdot \left(z + t_1\right)}{t_0}\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;\left(x + -2\right) \cdot \frac{t_1}{t_0}\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{+303}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 2
Error1.4
Cost3656
\[\begin{array}{l} t_0 := 47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(x + 43.3400022514\right)\right)\right)\\ \mathbf{if}\;x \leq -1.2165070864447848 \cdot 10^{+69}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 5.798492075447013 \cdot 10^{+53}:\\ \;\;\;\;\left(x + -2\right) \cdot \left(\frac{x \cdot \left(y + x \cdot \left(137.519416416 + x \cdot \left(78.6994924154 + x \cdot 4.16438922228\right)\right)\right)}{t_0} + \frac{z}{t_0}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 3
Error4.0
Cost2120
\[\begin{array}{l} \mathbf{if}\;x \leq -1.0384319402927958 \cdot 10^{+44}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 1.545585776961648 \cdot 10^{+27}:\\ \;\;\;\;\frac{\left(x + -2\right) \cdot \left(z + x \cdot \left(y + x \cdot 137.519416416\right)\right)}{47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(x + 43.3400022514\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 4
Error6.7
Cost1992
\[\begin{array}{l} \mathbf{if}\;x \leq -2.7181528523968675 \cdot 10^{+30}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 2.503516814831128:\\ \;\;\;\;\left(x + -2\right) \cdot \left(\frac{z}{47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(x + 43.3400022514\right)\right)\right)} + x \cdot \left(y \cdot 0.0212463641547976\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x + -2\right) \cdot \left(\left(4.16438922228 - \frac{101.7851458539211}{x}\right) + \frac{3451.550173699799}{x \cdot x}\right)\\ \end{array} \]
Alternative 5
Error16.3
Cost1364
\[\begin{array}{l} \mathbf{if}\;x \leq -42200211380.01475:\\ \;\;\;\;-110.1139242984811 + x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq -4.413705403003911 \cdot 10^{-72}:\\ \;\;\;\;y \cdot \left(x \cdot \left(-0.0424927283095952 - x \cdot -0.3041881842569256\right)\right)\\ \mathbf{elif}\;x \leq -2.59428773602649 \cdot 10^{-155}:\\ \;\;\;\;\frac{z}{\frac{47.066876606}{x + -2}}\\ \mathbf{elif}\;x \leq -1.0376910879290751 \cdot 10^{-195}:\\ \;\;\;\;-0.0424927283095952 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;x \leq 3.838604336495961 \cdot 10^{-9}:\\ \;\;\;\;\frac{z}{x \cdot -168.4663270985 + -23.533438303}\\ \mathbf{else}:\\ \;\;\;\;-110.1139242984811 + \left(x \cdot 4.16438922228 + 3655.1204654076414 \cdot \frac{1}{x}\right)\\ \end{array} \]
Alternative 6
Error16.3
Cost1364
\[\begin{array}{l} t_0 := \frac{y \cdot \left(x \cdot \left(x + -2\right)\right)}{47.066876606 + x \cdot 313.399215894}\\ \mathbf{if}\;x \leq -8771024806.594938:\\ \;\;\;\;-110.1139242984811 + x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq -4.413705403003911 \cdot 10^{-72}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -2.59428773602649 \cdot 10^{-155}:\\ \;\;\;\;\frac{z}{\frac{47.066876606}{x + -2}}\\ \mathbf{elif}\;x \leq -1.0376910879290751 \cdot 10^{-195}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 3.838604336495961 \cdot 10^{-9}:\\ \;\;\;\;\frac{z}{x \cdot -168.4663270985 + -23.533438303}\\ \mathbf{else}:\\ \;\;\;\;-110.1139242984811 + \left(x \cdot 4.16438922228 + 3655.1204654076414 \cdot \frac{1}{x}\right)\\ \end{array} \]
Alternative 7
Error7.1
Cost1224
\[\begin{array}{l} \mathbf{if}\;x \leq -42200211380.01475:\\ \;\;\;\;-110.1139242984811 + x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 5.593040840641525 \cdot 10^{-9}:\\ \;\;\;\;x \cdot \left(y \cdot -0.0424927283095952 + z \cdot 0.3041881842569256\right) + z \cdot -0.0424927283095952\\ \mathbf{else}:\\ \;\;\;\;\left(x + -2\right) \cdot \left(\left(4.16438922228 - \frac{101.7851458539211}{x}\right) + \frac{3451.550173699799}{x \cdot x}\right)\\ \end{array} \]
Alternative 8
Error16.3
Cost1108
\[\begin{array}{l} \mathbf{if}\;x \leq -42200211380.01475:\\ \;\;\;\;-110.1139242984811 + x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq -4.413705403003911 \cdot 10^{-72}:\\ \;\;\;\;y \cdot \left(x \cdot \left(-0.0424927283095952 - x \cdot -0.3041881842569256\right)\right)\\ \mathbf{elif}\;x \leq -2.59428773602649 \cdot 10^{-155}:\\ \;\;\;\;\frac{z}{\frac{47.066876606}{x + -2}}\\ \mathbf{elif}\;x \leq -1.0376910879290751 \cdot 10^{-195}:\\ \;\;\;\;-0.0424927283095952 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;x \leq 5.593040840641525 \cdot 10^{-9}:\\ \;\;\;\;\frac{z}{x \cdot -168.4663270985 + -23.533438303}\\ \mathbf{else}:\\ \;\;\;\;4.16438922228 \cdot \left(x + -2\right)\\ \end{array} \]
Alternative 9
Error7.1
Cost1096
\[\begin{array}{l} \mathbf{if}\;x \leq -42200211380.01475:\\ \;\;\;\;-110.1139242984811 + x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 1.7895974609752078 \cdot 10^{-6}:\\ \;\;\;\;x \cdot \left(y \cdot -0.0424927283095952 + z \cdot 0.3041881842569256\right) + z \cdot -0.0424927283095952\\ \mathbf{else}:\\ \;\;\;\;-110.1139242984811 + \left(x \cdot 4.16438922228 + 3655.1204654076414 \cdot \frac{1}{x}\right)\\ \end{array} \]
Alternative 10
Error16.3
Cost980
\[\begin{array}{l} t_0 := -110.1139242984811 + x \cdot 4.16438922228\\ \mathbf{if}\;x \leq -42200211380.01475:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -4.413705403003911 \cdot 10^{-72}:\\ \;\;\;\;y \cdot \left(x \cdot -0.0424927283095952\right)\\ \mathbf{elif}\;x \leq -2.59428773602649 \cdot 10^{-155}:\\ \;\;\;\;\frac{z}{-23.533438303}\\ \mathbf{elif}\;x \leq -1.0376910879290751 \cdot 10^{-195}:\\ \;\;\;\;-0.0424927283095952 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;x \leq 5.593040840641525 \cdot 10^{-9}:\\ \;\;\;\;\frac{z}{-23.533438303}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 11
Error16.4
Cost980
\[\begin{array}{l} \mathbf{if}\;x \leq -42200211380.01475:\\ \;\;\;\;-110.1139242984811 + x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq -4.413705403003911 \cdot 10^{-72}:\\ \;\;\;\;y \cdot \left(x \cdot -0.0424927283095952\right)\\ \mathbf{elif}\;x \leq -2.59428773602649 \cdot 10^{-155}:\\ \;\;\;\;\frac{z}{-23.533438303}\\ \mathbf{elif}\;x \leq -1.0376910879290751 \cdot 10^{-195}:\\ \;\;\;\;-0.0424927283095952 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;x \leq 5.593040840641525 \cdot 10^{-9}:\\ \;\;\;\;\frac{z}{-23.533438303}\\ \mathbf{else}:\\ \;\;\;\;4.16438922228 \cdot \left(x + -2\right)\\ \end{array} \]
Alternative 12
Error16.4
Cost852
\[\begin{array}{l} t_0 := y \cdot \left(x \cdot -0.0424927283095952\right)\\ \mathbf{if}\;x \leq -42200211380.01475:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq -4.413705403003911 \cdot 10^{-72}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -2.59428773602649 \cdot 10^{-155}:\\ \;\;\;\;\frac{z}{-23.533438303}\\ \mathbf{elif}\;x \leq -1.0376910879290751 \cdot 10^{-195}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 3.838604336495961 \cdot 10^{-9}:\\ \;\;\;\;\frac{z}{-23.533438303}\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 13
Error16.4
Cost852
\[\begin{array}{l} \mathbf{if}\;x \leq -42200211380.01475:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq -4.413705403003911 \cdot 10^{-72}:\\ \;\;\;\;y \cdot \left(x \cdot -0.0424927283095952\right)\\ \mathbf{elif}\;x \leq -2.59428773602649 \cdot 10^{-155}:\\ \;\;\;\;\frac{z}{-23.533438303}\\ \mathbf{elif}\;x \leq -1.0376910879290751 \cdot 10^{-195}:\\ \;\;\;\;-0.0424927283095952 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;x \leq 3.838604336495961 \cdot 10^{-9}:\\ \;\;\;\;\frac{z}{-23.533438303}\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 14
Error15.2
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -4.211024389130497 \cdot 10^{-8}:\\ \;\;\;\;-110.1139242984811 + x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 5.593040840641525 \cdot 10^{-9}:\\ \;\;\;\;\frac{z}{x \cdot -168.4663270985 + -23.533438303}\\ \mathbf{else}:\\ \;\;\;\;4.16438922228 \cdot \left(x + -2\right)\\ \end{array} \]
Alternative 15
Error15.3
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -42200211380.01475:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 3.838604336495961 \cdot 10^{-9}:\\ \;\;\;\;\frac{z}{-23.533438303}\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 16
Error61.8
Cost192
\[y \cdot 0.0037949933262530263 \]
Alternative 17
Error41.8
Cost192
\[z \cdot -0.0424927283095952 \]
Alternative 18
Error41.7
Cost192
\[\frac{z}{-23.533438303} \]

Error

Reproduce

herbie shell --seed 2022308 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, C"
  :precision binary64

  :herbie-target
  (if (< x -3.326128725870005e+62) (- (+ (/ y (* x x)) (* 4.16438922228 x)) 110.1139242984811) (if (< x 9.429991714554673e+55) (* (/ (- x 2.0) 1.0) (/ (+ (* (+ (* (+ (* (+ (* x 4.16438922228) 78.6994924154) x) 137.519416416) x) y) x) z) (+ (* (+ (+ (* 263.505074721 x) (+ (* 43.3400022514 (* x x)) (* x (* x x)))) 313.399215894) x) 47.066876606))) (- (+ (/ y (* x x)) (* 4.16438922228 x)) 110.1139242984811)))

  (/ (* (- x 2.0) (+ (* (+ (* (+ (* (+ (* x 4.16438922228) 78.6994924154) x) 137.519416416) x) y) x) z)) (+ (* (+ (* (+ (* (+ x 43.3400022514) x) 263.505074721) x) 313.399215894) x) 47.066876606)))