Average Error: 27.0 → 0.9
Time: 24.5s
Precision: binary64
Cost: 48708
\[\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}\;\frac{\left(x + -2\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y\right) + z\right)}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606} \leq 2 \cdot 10^{+305}:\\ \;\;\;\;\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)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right) + \left(\frac{4752.4581585918595}{x} + \frac{y + -207551.7024428275}{x \cdot x}\right)\\ \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.0)
        (+
         (*
          x
          (+
           (* x (+ (* x (+ (* x 4.16438922228) 78.6994924154)) 137.519416416))
           y))
         z))
       (+
        (*
         x
         (+ (* x (+ (* x (+ x 43.3400022514)) 263.505074721)) 313.399215894))
        47.066876606))
      2e+305)
   (*
    (+ x -2.0)
    (/
     (fma
      x
      (fma x (fma x (fma x 4.16438922228 78.6994924154) 137.519416416) y)
      z)
     (fma
      x
      (fma x (fma x (+ x 43.3400022514) 263.505074721) 313.399215894)
      47.066876606)))
   (+
    (fma x 4.16438922228 -110.1139242984811)
    (+ (/ 4752.4581585918595 x) (/ (+ y -207551.7024428275) (* x x))))))
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.0) * ((x * ((x * ((x * ((x * 4.16438922228) + 78.6994924154)) + 137.519416416)) + y)) + z)) / ((x * ((x * ((x * (x + 43.3400022514)) + 263.505074721)) + 313.399215894)) + 47.066876606)) <= 2e+305) {
		tmp = (x + -2.0) * (fma(x, fma(x, fma(x, fma(x, 4.16438922228, 78.6994924154), 137.519416416), y), z) / fma(x, fma(x, fma(x, (x + 43.3400022514), 263.505074721), 313.399215894), 47.066876606));
	} else {
		tmp = fma(x, 4.16438922228, -110.1139242984811) + ((4752.4581585918595 / x) + ((y + -207551.7024428275) / (x * x)));
	}
	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 (Float64(Float64(Float64(x + -2.0) * Float64(Float64(x * Float64(Float64(x * Float64(Float64(x * Float64(Float64(x * 4.16438922228) + 78.6994924154)) + 137.519416416)) + y)) + z)) / Float64(Float64(x * Float64(Float64(x * Float64(Float64(x * Float64(x + 43.3400022514)) + 263.505074721)) + 313.399215894)) + 47.066876606)) <= 2e+305)
		tmp = Float64(Float64(x + -2.0) * Float64(fma(x, fma(x, fma(x, fma(x, 4.16438922228, 78.6994924154), 137.519416416), y), z) / fma(x, fma(x, fma(x, Float64(x + 43.3400022514), 263.505074721), 313.399215894), 47.066876606)));
	else
		tmp = Float64(fma(x, 4.16438922228, -110.1139242984811) + Float64(Float64(4752.4581585918595 / x) + Float64(Float64(y + -207551.7024428275) / Float64(x * x))));
	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[N[(N[(N[(x + -2.0), $MachinePrecision] * N[(N[(x * N[(N[(x * N[(N[(x * N[(N[(x * 4.16438922228), $MachinePrecision] + 78.6994924154), $MachinePrecision]), $MachinePrecision] + 137.519416416), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] / 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]), $MachinePrecision], 2e+305], N[(N[(x + -2.0), $MachinePrecision] * N[(N[(x * N[(x * N[(x * N[(x * 4.16438922228 + 78.6994924154), $MachinePrecision] + 137.519416416), $MachinePrecision] + y), $MachinePrecision] + z), $MachinePrecision] / N[(x * N[(x * N[(x * N[(x + 43.3400022514), $MachinePrecision] + 263.505074721), $MachinePrecision] + 313.399215894), $MachinePrecision] + 47.066876606), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 4.16438922228 + -110.1139242984811), $MachinePrecision] + N[(N[(4752.4581585918595 / x), $MachinePrecision] + N[(N[(y + -207551.7024428275), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}\;\frac{\left(x + -2\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y\right) + z\right)}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606} \leq 2 \cdot 10^{+305}:\\
\;\;\;\;\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)}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right) + \left(\frac{4752.4581585918595}{x} + \frac{y + -207551.7024428275}{x \cdot x}\right)\\


\end{array}

Error

Target

Original27.0
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 (/.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)) < 1.9999999999999999e305

    1. Initial program 2.3

      \[\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))): 1 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))): 2 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, 1 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))): 11 points increase in error, 3 points decrease in error

    if 1.9999999999999999e305 < (/.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))

    1. Initial program 63.9

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

      \[\leadsto \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(\color{blue}{\left(43.3400022514 \cdot {x}^{2} + {x}^{3}\right)} + 313.399215894\right) \cdot x + 47.066876606} \]
    3. Taylor expanded in x around -inf 1.3

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right) + \left(\frac{4752.4581585918595}{x} - \frac{207551.7024428275 - y}{x \cdot x}\right)} \]
      Proof
      (+.f64 (fma.f64 x 104109730557/25000000000 -13764240537310136880149/125000000000000000000) (-.f64 (/.f64 2970286349119912390428499159837293/625000000000000000000000000000 x) (/.f64 (-.f64 648599070133835873532829296990356435388407301/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 2970286349119912390428499159837293/625000000000000000000000000000 x) (/.f64 (-.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 y) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x 104109730557/25000000000) (neg.f64 13764240537310136880149/125000000000000000000))) (-.f64 (/.f64 2970286349119912390428499159837293/625000000000000000000000000000 x) (/.f64 (-.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 y) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 104109730557/25000000000 x)) (neg.f64 13764240537310136880149/125000000000000000000)) (-.f64 (/.f64 2970286349119912390428499159837293/625000000000000000000000000000 x) (/.f64 (-.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 y) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite=> +-commutative_binary64 (+.f64 (neg.f64 13764240537310136880149/125000000000000000000) (*.f64 104109730557/25000000000 x))) (-.f64 (/.f64 2970286349119912390428499159837293/625000000000000000000000000000 x) (/.f64 (-.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 y) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (neg.f64 13764240537310136880149/125000000000000000000) (*.f64 104109730557/25000000000 x)) (-.f64 (/.f64 (Rewrite<= metadata-eval (*.f64 2970286349119912390428499159837293/625000000000000000000000000000 1)) x) (/.f64 (-.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 y) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (neg.f64 13764240537310136880149/125000000000000000000) (*.f64 104109730557/25000000000 x)) (-.f64 (Rewrite<= associate-*r/_binary64 (*.f64 2970286349119912390428499159837293/625000000000000000000000000000 (/.f64 1 x))) (/.f64 (-.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 y) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (neg.f64 13764240537310136880149/125000000000000000000) (*.f64 104109730557/25000000000 x)) (-.f64 (*.f64 2970286349119912390428499159837293/625000000000000000000000000000 (/.f64 1 x)) (/.f64 (Rewrite<= unsub-neg_binary64 (+.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 (neg.f64 y))) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (neg.f64 13764240537310136880149/125000000000000000000) (*.f64 104109730557/25000000000 x)) (-.f64 (*.f64 2970286349119912390428499159837293/625000000000000000000000000000 (/.f64 1 x)) (/.f64 (+.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 (Rewrite<= mul-1-neg_binary64 (*.f64 -1 y))) (*.f64 x x)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (neg.f64 13764240537310136880149/125000000000000000000) (*.f64 104109730557/25000000000 x)) (-.f64 (*.f64 2970286349119912390428499159837293/625000000000000000000000000000 (/.f64 1 x)) (/.f64 (+.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 (*.f64 -1 y)) (Rewrite<= unpow2_binary64 (pow.f64 x 2))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (neg.f64 13764240537310136880149/125000000000000000000) (*.f64 104109730557/25000000000 x)) (Rewrite<= unsub-neg_binary64 (+.f64 (*.f64 2970286349119912390428499159837293/625000000000000000000000000000 (/.f64 1 x)) (neg.f64 (/.f64 (+.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 (*.f64 -1 y)) (pow.f64 x 2)))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (+.f64 (neg.f64 13764240537310136880149/125000000000000000000) (*.f64 104109730557/25000000000 x)) (+.f64 (*.f64 2970286349119912390428499159837293/625000000000000000000000000000 (/.f64 1 x)) (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (/.f64 (+.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 (*.f64 -1 y)) (pow.f64 x 2)))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-+r+_binary64 (+.f64 (neg.f64 13764240537310136880149/125000000000000000000) (+.f64 (*.f64 104109730557/25000000000 x) (+.f64 (*.f64 2970286349119912390428499159837293/625000000000000000000000000000 (/.f64 1 x)) (*.f64 -1 (/.f64 (+.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 (*.f64 -1 y)) (pow.f64 x 2))))))): 0 points increase in error, 1 points decrease in error
      (+.f64 (neg.f64 13764240537310136880149/125000000000000000000) (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 2970286349119912390428499159837293/625000000000000000000000000000 (/.f64 1 x))) (*.f64 -1 (/.f64 (+.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 (*.f64 -1 y)) (pow.f64 x 2)))))): 2 points increase in error, 0 points decrease in error
      (+.f64 (neg.f64 13764240537310136880149/125000000000000000000) (+.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 2970286349119912390428499159837293/625000000000000000000000000000 (/.f64 1 x)) (*.f64 104109730557/25000000000 x))) (*.f64 -1 (/.f64 (+.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 (*.f64 -1 y)) (pow.f64 x 2))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (neg.f64 13764240537310136880149/125000000000000000000) (Rewrite<= associate-+r+_binary64 (+.f64 (*.f64 2970286349119912390428499159837293/625000000000000000000000000000 (/.f64 1 x)) (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 -1 (/.f64 (+.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 (*.f64 -1 y)) (pow.f64 x 2))))))): 0 points increase in error, 1 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (+.f64 (*.f64 2970286349119912390428499159837293/625000000000000000000000000000 (/.f64 1 x)) (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 -1 (/.f64 (+.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 (*.f64 -1 y)) (pow.f64 x 2))))) (neg.f64 13764240537310136880149/125000000000000000000))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= sub-neg_binary64 (-.f64 (+.f64 (*.f64 2970286349119912390428499159837293/625000000000000000000000000000 (/.f64 1 x)) (+.f64 (*.f64 104109730557/25000000000 x) (*.f64 -1 (/.f64 (+.f64 648599070133835873532829296990356435388407301/3125000000000000000000000000000000000000 (*.f64 -1 y)) (pow.f64 x 2))))) 13764240537310136880149/125000000000000000000)): 0 points increase in error, 0 points decrease in error
  3. Recombined 2 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(x + -2\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y\right) + z\right)}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606} \leq 2 \cdot 10^{+305}:\\ \;\;\;\;\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)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right) + \left(\frac{4752.4581585918595}{x} + \frac{y + -207551.7024428275}{x \cdot x}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error0.9
Cost9796
\[\begin{array}{l} t_0 := x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606\\ t_1 := x \cdot \left(x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y\right)\\ \mathbf{if}\;\frac{\left(x + -2\right) \cdot \left(t_1 + z\right)}{t_0} \leq 2 \cdot 10^{+305}:\\ \;\;\;\;\left(x + -2\right) \cdot \left(\frac{t_1}{t_0} + \frac{z}{t_0}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, 4.16438922228, -110.1139242984811\right) + \left(\frac{4752.4581585918595}{x} + \frac{y + -207551.7024428275}{x \cdot x}\right)\\ \end{array} \]
Alternative 2
Error1.8
Cost3656
\[\begin{array}{l} t_0 := x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606\\ \mathbf{if}\;x \leq -2.141509995504274 \cdot 10^{+59}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 1.5499563196525152 \cdot 10^{+32}:\\ \;\;\;\;\left(x + -2\right) \cdot \left(\frac{x \cdot \left(x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y\right)}{t_0} + \frac{z}{t_0}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 3
Error2.3
Cost2632
\[\begin{array}{l} \mathbf{if}\;x \leq -7.111599167251958 \cdot 10^{+53}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 1.5499563196525152 \cdot 10^{+32}:\\ \;\;\;\;\frac{\left(x + -2\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right) + y\right) + z\right)}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 4
Error3.9
Cost2120
\[\begin{array}{l} \mathbf{if}\;x \leq -1.4956005700453875 \cdot 10^{+40}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 1.5499563196525152 \cdot 10^{+32}:\\ \;\;\;\;\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{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 5
Error6.8
Cost1992
\[\begin{array}{l} \mathbf{if}\;x \leq -1.4956005700453875 \cdot 10^{+40}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 1.5499563196525152 \cdot 10^{+32}:\\ \;\;\;\;\frac{\left(x + -2\right) \cdot z}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606} + -0.0424927283095952 \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 6
Error5.4
Cost1992
\[\begin{array}{l} \mathbf{if}\;x \leq -8.395598664883283 \cdot 10^{+20}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 0.0081722048621715:\\ \;\;\;\;x \cdot \left(0.0212463641547976 \cdot \left(z + y \cdot -2\right) + z \cdot 0.28294182010212804\right) + \left(z \cdot -0.0424927283095952 + \left(x \cdot x\right) \cdot \left(-5.843575199059173 + z \cdot -1.787568985856513\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 7
Error6.6
Cost1864
\[\begin{array}{l} \mathbf{if}\;x \leq -7.111599167251958 \cdot 10^{+53}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq -4.4604553784732294 \cdot 10^{-33}:\\ \;\;\;\;x \cdot 4.16438922228 + \frac{\left(x + -2\right) \cdot z}{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 25738889834.392353:\\ \;\;\;\;z \cdot -0.0424927283095952 - x \cdot \left(z \cdot -0.28294182010212804 + 0.0212463641547976 \cdot \left(2 \cdot y - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 8
Error7.4
Cost1352
\[\begin{array}{l} \mathbf{if}\;x \leq -1.4956005700453875 \cdot 10^{+40}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 25738889834.392353:\\ \;\;\;\;z \cdot -0.0424927283095952 - x \cdot \left(z \cdot -0.28294182010212804 + 0.0212463641547976 \cdot \left(2 \cdot y - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 9
Error7.5
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -1.4956005700453875 \cdot 10^{+40}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 0.0081722048621715:\\ \;\;\;\;z \cdot -0.0424927283095952 + y \cdot \left(x \cdot -0.0424927283095952\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 10
Error14.9
Cost712
\[\begin{array}{l} \mathbf{if}\;x \leq -2.1080808480476917 \cdot 10^{-5}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 25738889834.392353:\\ \;\;\;\;z \cdot \left(-0.0424927283095952 + x \cdot 0.3041881842569256\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 11
Error15.0
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -2.1080808480476917 \cdot 10^{-5}:\\ \;\;\;\;x \cdot 4.16438922228\\ \mathbf{elif}\;x \leq 0.0081722048621715:\\ \;\;\;\;z \cdot -0.0424927283095952\\ \mathbf{else}:\\ \;\;\;\;x \cdot 4.16438922228\\ \end{array} \]
Alternative 12
Error41.7
Cost192
\[z \cdot -0.0424927283095952 \]

Error

Reproduce

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