?

Average Error: 26.8 → 1.0
Time: 29.2s
Precision: binary64
Cost: 7748

?

\[\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} \mathbf{if}\;x \leq -2.1 \cdot 10^{+46}:\\ \;\;\;\;\frac{\frac{y}{x}}{x} + \left(\left(\frac{3655.1204654076414}{x} + \mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right)\right) + \frac{-130977.50649958357}{x \cdot x}\right)\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{+59}:\\ \;\;\;\;\frac{x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z}{\frac{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}{x + -2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + -2}{0.24013125253755718}\\ \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
 (if (<= x -2.1e+46)
   (+
    (/ (/ y x) x)
    (+
     (+ (/ 3655.1204654076414 x) (fma x 4.16438922228 -110.1139242984811))
     (/ -130977.50649958357 (* x x))))
   (if (<= x 3.8e+59)
     (/
      (+
       (*
        x
        (+
         y
         (* x (+ (* x (+ (* x 4.16438922228) 78.6994924154)) 137.519416416))))
       z)
      (/
       (+
        (*
         x
         (+ (* x (+ (* x (+ x 43.3400022514)) 263.505074721)) 313.399215894))
        47.066876606)
       (+ x -2.0)))
     (/ (+ x -2.0) 0.24013125253755718))))
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 tmp;
	if (x <= -2.1e+46) {
		tmp = ((y / x) / x) + (((3655.1204654076414 / x) + fma(x, 4.16438922228, -110.1139242984811)) + (-130977.50649958357 / (x * x)));
	} else if (x <= 3.8e+59) {
		tmp = ((x * (y + (x * ((x * ((x * 4.16438922228) + 78.6994924154)) + 137.519416416)))) + z) / (((x * ((x * ((x * (x + 43.3400022514)) + 263.505074721)) + 313.399215894)) + 47.066876606) / (x + -2.0));
	} else {
		tmp = (x + -2.0) / 0.24013125253755718;
	}
	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)
	tmp = 0.0
	if (x <= -2.1e+46)
		tmp = Float64(Float64(Float64(y / x) / x) + Float64(Float64(Float64(3655.1204654076414 / x) + fma(x, 4.16438922228, -110.1139242984811)) + Float64(-130977.50649958357 / Float64(x * x))));
	elseif (x <= 3.8e+59)
		tmp = Float64(Float64(Float64(x * Float64(y + Float64(x * Float64(Float64(x * Float64(Float64(x * 4.16438922228) + 78.6994924154)) + 137.519416416)))) + z) / Float64(Float64(Float64(x * Float64(Float64(x * Float64(Float64(x * Float64(x + 43.3400022514)) + 263.505074721)) + 313.399215894)) + 47.066876606) / Float64(x + -2.0)));
	else
		tmp = Float64(Float64(x + -2.0) / 0.24013125253755718);
	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_] := If[LessEqual[x, -2.1e+46], N[(N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision] + N[(N[(N[(3655.1204654076414 / x), $MachinePrecision] + N[(x * 4.16438922228 + -110.1139242984811), $MachinePrecision]), $MachinePrecision] + N[(-130977.50649958357 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.8e+59], N[(N[(N[(x * N[(y + N[(x * N[(N[(x * N[(N[(x * 4.16438922228), $MachinePrecision] + 78.6994924154), $MachinePrecision]), $MachinePrecision] + 137.519416416), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] / N[(N[(N[(x * N[(N[(x * N[(N[(x * N[(x + 43.3400022514), $MachinePrecision]), $MachinePrecision] + 263.505074721), $MachinePrecision]), $MachinePrecision] + 313.399215894), $MachinePrecision]), $MachinePrecision] + 47.066876606), $MachinePrecision] / N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + -2.0), $MachinePrecision] / 0.24013125253755718), $MachinePrecision]]]
\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}
\mathbf{if}\;x \leq -2.1 \cdot 10^{+46}:\\
\;\;\;\;\frac{\frac{y}{x}}{x} + \left(\left(\frac{3655.1204654076414}{x} + \mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right)\right) + \frac{-130977.50649958357}{x \cdot x}\right)\\

\mathbf{elif}\;x \leq 3.8 \cdot 10^{+59}:\\
\;\;\;\;\frac{x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z}{\frac{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}{x + -2}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + -2}{0.24013125253755718}\\


\end{array}

Error?

Target

Original26.8
Target0.8
Herbie1.0
\[\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 3 regimes
  2. if x < -2.1e46

    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. Simplified57.8

      \[\leadsto \color{blue}{\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) \cdot \frac{x + -2}{\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

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

      associate-*l/ [<=]57.8

      \[ \color{blue}{\frac{x - 2}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606} \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)} \]

      *-commutative [=>]57.8

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

      *-commutative [=>]57.8

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

      fma-def [=>]57.8

      \[ \color{blue}{\mathsf{fma}\left(x, \left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y, z\right)} \cdot \frac{x - 2}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606} \]

      *-commutative [=>]57.8

      \[ \mathsf{fma}\left(x, \color{blue}{x \cdot \left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right)} + y, z\right) \cdot \frac{x - 2}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606} \]

      fma-def [=>]57.8

      \[ \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, \left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416, y\right)}, z\right) \cdot \frac{x - 2}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606} \]

      *-commutative [=>]57.8

      \[ \mathsf{fma}\left(x, \mathsf{fma}\left(x, \color{blue}{x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right)} + 137.519416416, y\right), z\right) \cdot \frac{x - 2}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606} \]

      fma-def [=>]57.8

      \[ \mathsf{fma}\left(x, \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, x \cdot 4.16438922228 + 78.6994924154, 137.519416416\right)}, y\right), z\right) \cdot \frac{x - 2}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606} \]

      fma-def [=>]57.8

      \[ \mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 4.16438922228, 78.6994924154\right)}, 137.519416416\right), y\right), z\right) \cdot \frac{x - 2}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606} \]

      sub-neg [=>]57.8

      \[ \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) \cdot \frac{\color{blue}{x + \left(-2\right)}}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606} \]

      metadata-eval [=>]57.8

      \[ \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) \cdot \frac{x + \color{blue}{-2}}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606} \]
    3. 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)} \]
    4. Simplified1.2

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x} + \left(\left(\frac{3655.1204654076414}{x} + \mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right)\right) - \frac{130977.50649958357}{x \cdot x}\right)} \]
      Proof

      [Start]1.2

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

      associate--l+ [=>]1.2

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

      unpow2 [=>]1.2

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

      associate-/r* [=>]1.2

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

      associate--r+ [=>]1.2

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

      sub-neg [=>]1.2

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

      +-commutative [=>]1.2

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

      *-commutative [<=]1.2

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

      associate-+l+ [=>]1.2

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

      associate-*r/ [=>]1.2

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

      metadata-eval [=>]1.2

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

      fma-def [=>]1.2

      \[ \frac{\frac{y}{x}}{x} + \left(\left(\frac{3655.1204654076414}{x} + \color{blue}{\mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right)}\right) - 130977.50649958357 \cdot \frac{1}{{x}^{2}}\right) \]

      metadata-eval [=>]1.2

      \[ \frac{\frac{y}{x}}{x} + \left(\left(\frac{3655.1204654076414}{x} + \mathsf{fma}\left(x, 4.16438922228, \color{blue}{-110.1139242984811}\right)\right) - 130977.50649958357 \cdot \frac{1}{{x}^{2}}\right) \]

      associate-*r/ [=>]1.2

      \[ \frac{\frac{y}{x}}{x} + \left(\left(\frac{3655.1204654076414}{x} + \mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right)\right) - \color{blue}{\frac{130977.50649958357 \cdot 1}{{x}^{2}}}\right) \]

      metadata-eval [=>]1.2

      \[ \frac{\frac{y}{x}}{x} + \left(\left(\frac{3655.1204654076414}{x} + \mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right)\right) - \frac{\color{blue}{130977.50649958357}}{{x}^{2}}\right) \]

      unpow2 [=>]1.2

      \[ \frac{\frac{y}{x}}{x} + \left(\left(\frac{3655.1204654076414}{x} + \mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right)\right) - \frac{130977.50649958357}{\color{blue}{x \cdot x}}\right) \]

    if -2.1e46 < x < 3.8000000000000001e59

    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. Applied egg-rr0.9

      \[\leadsto \color{blue}{\frac{x - 2}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606} \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)} \]
    3. Applied egg-rr0.7

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

    if 3.8000000000000001e59 < x

    1. Initial program 63.8

      \[\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. Simplified60.4

      \[\leadsto \color{blue}{\frac{x + -2}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x + 43.3400022514, x, 263.505074721\right), x, 313.399215894\right), x, 47.066876606\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x, 4.16438922228, 78.6994924154\right), x, 137.519416416\right), x, y\right), x, z\right)}}} \]
      Proof

      [Start]63.8

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

      associate-/l* [=>]60.4

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

      sub-neg [=>]60.4

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

      metadata-eval [=>]60.4

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

      fma-def [=>]60.4

      \[ \frac{x + -2}{\frac{\color{blue}{\mathsf{fma}\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894, x, 47.066876606\right)}}{\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z}} \]

      fma-def [=>]60.4

      \[ \frac{x + -2}{\frac{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721, x, 313.399215894\right)}, x, 47.066876606\right)}{\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z}} \]

      fma-def [=>]60.4

      \[ \frac{x + -2}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(x + 43.3400022514, x, 263.505074721\right)}, x, 313.399215894\right), x, 47.066876606\right)}{\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z}} \]

      fma-def [=>]60.4

      \[ \frac{x + -2}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x + 43.3400022514, x, 263.505074721\right), x, 313.399215894\right), x, 47.066876606\right)}{\color{blue}{\mathsf{fma}\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y, x, z\right)}}} \]

      fma-def [=>]60.4

      \[ \frac{x + -2}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x + 43.3400022514, x, 263.505074721\right), x, 313.399215894\right), x, 47.066876606\right)}{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416, x, y\right)}, x, z\right)}} \]

      fma-def [=>]60.4

      \[ \frac{x + -2}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x + 43.3400022514, x, 263.505074721\right), x, 313.399215894\right), x, 47.066876606\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(x \cdot 4.16438922228 + 78.6994924154, x, 137.519416416\right)}, x, y\right), x, z\right)}} \]

      fma-def [=>]60.4

      \[ \frac{x + -2}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x + 43.3400022514, x, 263.505074721\right), x, 313.399215894\right), x, 47.066876606\right)}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(x, 4.16438922228, 78.6994924154\right)}, x, 137.519416416\right), x, y\right), x, z\right)}} \]
    3. Taylor expanded in x around inf 1.4

      \[\leadsto \frac{x + -2}{\color{blue}{0.24013125253755718}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.0

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

Alternatives

Alternative 1
Error1.0
Cost7492
\[\begin{array}{l} \mathbf{if}\;x \leq -6 \cdot 10^{+41}:\\ \;\;\;\;\mathsf{fma}\left(x, 4.16438922228, \frac{3655.1204654076414}{x}\right) + \left(-110.1139242984811 - \frac{130977.50649958357 - y}{x \cdot x}\right)\\ \mathbf{elif}\;x \leq 3 \cdot 10^{+59}:\\ \;\;\;\;\frac{x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z}{\frac{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}{x + -2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + -2}{0.24013125253755718}\\ \end{array} \]
Alternative 2
Error2.9
Cost2768
\[\begin{array}{l} t_0 := \frac{x + -2}{0.24013125253755718}\\ t_1 := x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606\\ t_2 := \frac{y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)}{t_1} \cdot \left(x \cdot \left(x + -2\right)\right)\\ \mathbf{if}\;x \leq -6.8 \cdot 10^{+86}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -3.9 \cdot 10^{+18}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 0.0025:\\ \;\;\;\;\frac{\left(x + -2\right) \cdot \left(z + x \cdot \left(y + x \cdot 137.519416416\right)\right)}{t_1}\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{+59}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error1.2
Cost2633
\[\begin{array}{l} \mathbf{if}\;x \leq -7 \cdot 10^{+70} \lor \neg \left(x \leq 3.8 \cdot 10^{+59}\right):\\ \;\;\;\;\frac{x + -2}{0.24013125253755718}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z\right) \cdot \frac{x + -2}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}\\ \end{array} \]
Alternative 4
Error1.1
Cost2633
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+77} \lor \neg \left(x \leq 3.8 \cdot 10^{+59}\right):\\ \;\;\;\;\frac{x + -2}{0.24013125253755718}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z}{\frac{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}{x + -2}}\\ \end{array} \]
Alternative 5
Error2.0
Cost2505
\[\begin{array}{l} \mathbf{if}\;x \leq -7 \cdot 10^{+70} \lor \neg \left(x \leq 3.8 \cdot 10^{+59}\right):\\ \;\;\;\;\frac{x + -2}{0.24013125253755718}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z\right) \cdot \frac{x + -2}{47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(x \cdot \left(x + 43.3400022514\right)\right)\right)}\\ \end{array} \]
Alternative 6
Error1.9
Cost2505
\[\begin{array}{l} \mathbf{if}\;x \leq -1.26 \cdot 10^{+76} \lor \neg \left(x \leq 3.8 \cdot 10^{+59}\right):\\ \;\;\;\;\frac{x + -2}{0.24013125253755718}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z}{\frac{47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(x \cdot \left(x + 43.3400022514\right)\right)\right)}{x + -2}}\\ \end{array} \]
Alternative 7
Error1.7
Cost2252
\[\begin{array}{l} t_0 := \frac{x + -2}{0.24013125253755718}\\ t_1 := \frac{x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z}{\left(x \cdot x\right) \cdot \left(x + 45.3400022514\right)}\\ \mathbf{if}\;x \leq -9.5 \cdot 10^{+72}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{+17}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 510:\\ \;\;\;\;\frac{\left(x + -2\right) \cdot \left(z + x \cdot \left(y + x \cdot 137.519416416\right)\right)}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{+59}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error1.9
Cost2128
\[\begin{array}{l} t_0 := \frac{x + -2}{0.24013125253755718}\\ t_1 := x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z\\ t_2 := \frac{t_1}{\left(x \cdot x\right) \cdot \left(x + 45.3400022514\right)}\\ \mathbf{if}\;x \leq -7.8 \cdot 10^{+76}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -46:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2:\\ \;\;\;\;\frac{t_1}{x \cdot -168.4663270985 + -23.533438303}\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{+59}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error4.7
Cost1737
\[\begin{array}{l} \mathbf{if}\;x \leq -1.35 \lor \neg \left(x \leq 2\right):\\ \;\;\;\;\frac{2 - x}{-0.24013125253755718 - \frac{5.86923874282773 + \frac{-55.572073733743466}{x}}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z}{x \cdot -168.4663270985 + -23.533438303}\\ \end{array} \]
Alternative 10
Error5.0
Cost1736
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+17}:\\ \;\;\;\;\frac{x + -2}{0.24013125253755718}\\ \mathbf{elif}\;x \leq 0.14:\\ \;\;\;\;\left(x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z\right) \cdot \left(x \cdot 0.3041881842569256 + -0.0424927283095952\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2 - x}{-0.24013125253755718 - \frac{5.86923874282773 + \frac{-55.572073733743466}{x}}{x}}\\ \end{array} \]
Alternative 11
Error5.3
Cost1480
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+17}:\\ \;\;\;\;\frac{x + -2}{0.24013125253755718}\\ \mathbf{elif}\;x \leq 2:\\ \;\;\;\;\left(x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z\right) \cdot -0.0424927283095952\\ \mathbf{else}:\\ \;\;\;\;\frac{2 - x}{-0.24013125253755718 - \frac{5.86923874282773 + \frac{-55.572073733743466}{x}}{x}}\\ \end{array} \]
Alternative 12
Error5.3
Cost1480
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+17}:\\ \;\;\;\;\frac{x + -2}{0.24013125253755718}\\ \mathbf{elif}\;x \leq 2:\\ \;\;\;\;\frac{x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z}{-23.533438303}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 - x}{-0.24013125253755718 - \frac{5.86923874282773 + \frac{-55.572073733743466}{x}}{x}}\\ \end{array} \]
Alternative 13
Error6.7
Cost1352
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+17}:\\ \;\;\;\;\frac{x + -2}{0.24013125253755718}\\ \mathbf{elif}\;x \leq 0.0037:\\ \;\;\;\;x \cdot \left(0.0212463641547976 \cdot \left(z + y \cdot -2\right) + z \cdot 0.28294182010212804\right) + z \cdot -0.0424927283095952\\ \mathbf{else}:\\ \;\;\;\;\frac{x + -2}{0.24013125253755718 + \frac{5.86923874282773}{x}}\\ \end{array} \]
Alternative 14
Error14.6
Cost964
\[\begin{array}{l} \mathbf{if}\;x \leq -95:\\ \;\;\;\;\frac{2 - x}{-0.24013125253755718 - \frac{5.86923874282773 + \frac{-55.572073733743466}{x}}{x}}\\ \mathbf{elif}\;x \leq 0.0037:\\ \;\;\;\;\frac{x + -2}{\frac{47.066876606}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + -2}{0.24013125253755718 + \frac{5.86923874282773}{x}}\\ \end{array} \]
Alternative 15
Error14.6
Cost841
\[\begin{array}{l} \mathbf{if}\;x \leq -205 \lor \neg \left(x \leq 0.0037\right):\\ \;\;\;\;\frac{x + -2}{0.24013125253755718 + \frac{5.86923874282773}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + -2}{\frac{47.066876606}{z}}\\ \end{array} \]
Alternative 16
Error14.7
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq -340 \lor \neg \left(x \leq 0.0037\right):\\ \;\;\;\;\frac{x + -2}{0.24013125253755718}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + -2}{\frac{47.066876606}{z}}\\ \end{array} \]
Alternative 17
Error14.9
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+17} \lor \neg \left(x \leq 0.0037\right):\\ \;\;\;\;\frac{x + -2}{0.24013125253755718}\\ \mathbf{else}:\\ \;\;\;\;z \cdot -0.0424927283095952\\ \end{array} \]
Alternative 18
Error15.0
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+17}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 0.0037:\\ \;\;\;\;z \cdot -0.0424927283095952\\ \mathbf{else}:\\ \;\;\;\;-110.1139242984811 + x \cdot 4.16438922228\\ \end{array} \]
Alternative 19
Error15.0
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -4.5 \cdot 10^{+17}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 2:\\ \;\;\;\;z \cdot -0.0424927283095952\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 20
Error35.2
Cost192
\[x \cdot 4.16438922228 \]

Error

Reproduce?

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