Average Error: 29.1 → 10.0
Time: 45.2s
Precision: binary64
Cost: 22217
\[\frac{\left(\left(\left(x \cdot y + z\right) \cdot y + 27464.7644705\right) \cdot y + 230661.510616\right) \cdot y + t}{\left(\left(\left(y + a\right) \cdot y + b\right) \cdot y + c\right) \cdot y + i} \]
\[\begin{array}{l} \mathbf{if}\;y \leq -6.4 \cdot 10^{+35} \lor \neg \left(y \leq 4.4 \cdot 10^{+48}\right):\\ \;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{i + y \cdot \left(c + y \cdot \left(y \cdot \left(y + a\right) + b\right)\right)} + y \cdot \frac{230661.510616 + y \cdot \left(27464.7644705 + y \cdot \mathsf{fma}\left(y, x, z\right)\right)}{\mathsf{fma}\left(y, c + y \cdot \mathsf{fma}\left(y + a, y, b\right), i\right)}\\ \end{array} \]
(FPCore (x y z t a b c i)
 :precision binary64
 (/
  (+ (* (+ (* (+ (* (+ (* x y) z) y) 27464.7644705) y) 230661.510616) y) t)
  (+ (* (+ (* (+ (* (+ y a) y) b) y) c) y) i)))
(FPCore (x y z t a b c i)
 :precision binary64
 (if (or (<= y -6.4e+35) (not (<= y 4.4e+48)))
   (+ x (- (/ z y) (* x (/ a y))))
   (+
    (/ t (+ i (* y (+ c (* y (+ (* y (+ y a)) b))))))
    (*
     y
     (/
      (+ 230661.510616 (* y (+ 27464.7644705 (* y (fma y x z)))))
      (fma y (+ c (* y (fma (+ y a) y b))) i))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return ((((((((x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / (((((((y + a) * y) + b) * y) + c) * y) + i);
}
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	double tmp;
	if ((y <= -6.4e+35) || !(y <= 4.4e+48)) {
		tmp = x + ((z / y) - (x * (a / y)));
	} else {
		tmp = (t / (i + (y * (c + (y * ((y * (y + a)) + b)))))) + (y * ((230661.510616 + (y * (27464.7644705 + (y * fma(y, x, z))))) / fma(y, (c + (y * fma((y + a), y, b))), i)));
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(x * y) + z) * y) + 27464.7644705) * y) + 230661.510616) * y) + t) / Float64(Float64(Float64(Float64(Float64(Float64(Float64(y + a) * y) + b) * y) + c) * y) + i))
end
function code(x, y, z, t, a, b, c, i)
	tmp = 0.0
	if ((y <= -6.4e+35) || !(y <= 4.4e+48))
		tmp = Float64(x + Float64(Float64(z / y) - Float64(x * Float64(a / y))));
	else
		tmp = Float64(Float64(t / Float64(i + Float64(y * Float64(c + Float64(y * Float64(Float64(y * Float64(y + a)) + b)))))) + Float64(y * Float64(Float64(230661.510616 + Float64(y * Float64(27464.7644705 + Float64(y * fma(y, x, z))))) / fma(y, Float64(c + Float64(y * fma(Float64(y + a), y, b))), i))));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[(N[(N[(N[(N[(x * y), $MachinePrecision] + z), $MachinePrecision] * y), $MachinePrecision] + 27464.7644705), $MachinePrecision] * y), $MachinePrecision] + 230661.510616), $MachinePrecision] * y), $MachinePrecision] + t), $MachinePrecision] / N[(N[(N[(N[(N[(N[(N[(y + a), $MachinePrecision] * y), $MachinePrecision] + b), $MachinePrecision] * y), $MachinePrecision] + c), $MachinePrecision] * y), $MachinePrecision] + i), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[y, -6.4e+35], N[Not[LessEqual[y, 4.4e+48]], $MachinePrecision]], N[(x + N[(N[(z / y), $MachinePrecision] - N[(x * N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t / N[(i + N[(y * N[(c + N[(y * N[(N[(y * N[(y + a), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(N[(230661.510616 + N[(y * N[(27464.7644705 + N[(y * N[(y * x + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y * N[(c + N[(y * N[(N[(y + a), $MachinePrecision] * y + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\frac{\left(\left(\left(x \cdot y + z\right) \cdot y + 27464.7644705\right) \cdot y + 230661.510616\right) \cdot y + t}{\left(\left(\left(y + a\right) \cdot y + b\right) \cdot y + c\right) \cdot y + i}
\begin{array}{l}
\mathbf{if}\;y \leq -6.4 \cdot 10^{+35} \lor \neg \left(y \leq 4.4 \cdot 10^{+48}\right):\\
\;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{t}{i + y \cdot \left(c + y \cdot \left(y \cdot \left(y + a\right) + b\right)\right)} + y \cdot \frac{230661.510616 + y \cdot \left(27464.7644705 + y \cdot \mathsf{fma}\left(y, x, z\right)\right)}{\mathsf{fma}\left(y, c + y \cdot \mathsf{fma}\left(y + a, y, b\right), i\right)}\\


\end{array}

Error

Derivation

  1. Split input into 2 regimes
  2. if y < -6.39999999999999965e35 or 4.3999999999999999e48 < y

    1. Initial program 61.4

      \[\frac{\left(\left(\left(x \cdot y + z\right) \cdot y + 27464.7644705\right) \cdot y + 230661.510616\right) \cdot y + t}{\left(\left(\left(y + a\right) \cdot y + b\right) \cdot y + c\right) \cdot y + i} \]
    2. Taylor expanded in x around 0 61.8

      \[\leadsto \frac{\color{blue}{\left(y \cdot \left(230661.510616 + y \cdot \left(y \cdot z + 27464.7644705\right)\right) + {y}^{4} \cdot x\right)} + t}{\left(\left(\left(y + a\right) \cdot y + b\right) \cdot y + c\right) \cdot y + i} \]
    3. Taylor expanded in y around inf 21.6

      \[\leadsto \color{blue}{\left(\frac{z}{y} + x\right) - \frac{a \cdot x}{y}} \]
    4. Simplified19.0

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

      [Start]21.6

      \[ \left(\frac{z}{y} + x\right) - \frac{a \cdot x}{y} \]

      +-commutative [=>]21.6

      \[ \color{blue}{\left(x + \frac{z}{y}\right)} - \frac{a \cdot x}{y} \]

      associate--l+ [=>]21.6

      \[ \color{blue}{x + \left(\frac{z}{y} - \frac{a \cdot x}{y}\right)} \]

      associate-/l* [=>]19.0

      \[ x + \left(\frac{z}{y} - \color{blue}{\frac{a}{\frac{y}{x}}}\right) \]

      associate-/r/ [=>]19.0

      \[ x + \left(\frac{z}{y} - \color{blue}{\frac{a}{y} \cdot x}\right) \]

    if -6.39999999999999965e35 < y < 4.3999999999999999e48

    1. Initial program 2.9

      \[\frac{\left(\left(\left(x \cdot y + z\right) \cdot y + 27464.7644705\right) \cdot y + 230661.510616\right) \cdot y + t}{\left(\left(\left(y + a\right) \cdot y + b\right) \cdot y + c\right) \cdot y + i} \]
    2. Taylor expanded in t around inf 2.9

      \[\leadsto \color{blue}{\frac{t}{y \cdot \left(c + y \cdot \left(\left(y + a\right) \cdot y + b\right)\right) + i} + \frac{\left(230661.510616 + y \cdot \left(27464.7644705 + \left(y \cdot x + z\right) \cdot y\right)\right) \cdot y}{y \cdot \left(c + y \cdot \left(\left(y + a\right) \cdot y + b\right)\right) + i}} \]
    3. Applied egg-rr2.8

      \[\leadsto \frac{t}{y \cdot \left(c + y \cdot \left(\left(y + a\right) \cdot y + b\right)\right) + i} + \color{blue}{\frac{230661.510616 + y \cdot \left(27464.7644705 + y \cdot \mathsf{fma}\left(y, x, z\right)\right)}{\mathsf{fma}\left(y, c + y \cdot \mathsf{fma}\left(y + a, y, b\right), i\right)} \cdot y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification10.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.4 \cdot 10^{+35} \lor \neg \left(y \leq 4.4 \cdot 10^{+48}\right):\\ \;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{i + y \cdot \left(c + y \cdot \left(y \cdot \left(y + a\right) + b\right)\right)} + y \cdot \frac{230661.510616 + y \cdot \left(27464.7644705 + y \cdot \mathsf{fma}\left(y, x, z\right)\right)}{\mathsf{fma}\left(y, c + y \cdot \mathsf{fma}\left(y + a, y, b\right), i\right)}\\ \end{array} \]

Alternatives

Alternative 1
Error10.2
Cost8841
\[\begin{array}{l} \mathbf{if}\;y \leq -6.4 \cdot 10^{+35} \lor \neg \left(y \leq 6.1 \cdot 10^{+41}\right):\\ \;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t + \left(y \cdot \left(230661.510616 + y \cdot \left(27464.7644705 + y \cdot z\right)\right) + x \cdot {y}^{4}\right)}{i + y \cdot \left(c + y \cdot \left(y \cdot \left(y + a\right) + b\right)\right)}\\ \end{array} \]
Alternative 2
Error10.1
Cost2377
\[\begin{array}{l} \mathbf{if}\;y \leq -6.4 \cdot 10^{+35} \lor \neg \left(y \leq 9 \cdot 10^{+41}\right):\\ \;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t + y \cdot \left(230661.510616 + y \cdot \left(27464.7644705 + y \cdot \left(z + y \cdot x\right)\right)\right)}{i + y \cdot \left(c + y \cdot \left(y \cdot \left(y + a\right) + b\right)\right)}\\ \end{array} \]
Alternative 3
Error12.3
Cost2252
\[\begin{array}{l} t_1 := i + y \cdot \left(c + y \cdot \left(y \cdot \left(y + a\right) + b\right)\right)\\ t_2 := x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{if}\;y \leq -6 \cdot 10^{+35}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -7.2 \cdot 10^{-36}:\\ \;\;\;\;\frac{t + y \cdot \left(230661.510616 + y \cdot \left(27464.7644705 + x \cdot \left(y \cdot y\right)\right)\right)}{t_1}\\ \mathbf{elif}\;y \leq 2.15 \cdot 10^{+42}:\\ \;\;\;\;\frac{t + y \cdot \left(230661.510616 + y \cdot \left(27464.7644705 + y \cdot z\right)\right)}{t_1}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error12.5
Cost2121
\[\begin{array}{l} \mathbf{if}\;y \leq -6.4 \cdot 10^{+35} \lor \neg \left(y \leq 5.2 \cdot 10^{+42}\right):\\ \;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t + y \cdot \left(230661.510616 + y \cdot \left(27464.7644705 + y \cdot z\right)\right)}{i + y \cdot \left(c + y \cdot \left(y \cdot \left(y + a\right) + b\right)\right)}\\ \end{array} \]
Alternative 5
Error13.0
Cost1993
\[\begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{+19} \lor \neg \left(y \leq 4.9 \cdot 10^{+42}\right):\\ \;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t + y \cdot \left(230661.510616 + z \cdot \left(y \cdot y\right)\right)}{i + y \cdot \left(c + y \cdot \left(y \cdot \left(y + a\right) + b\right)\right)}\\ \end{array} \]
Alternative 6
Error15.2
Cost1865
\[\begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{+60} \lor \neg \left(y \leq 2.2 \cdot 10^{+42}\right):\\ \;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t + y \cdot \left(230661.510616 + y \cdot 27464.7644705\right)}{i + y \cdot \left(c + y \cdot \left(y \cdot \left(y + a\right) + b\right)\right)}\\ \end{array} \]
Alternative 7
Error16.2
Cost1737
\[\begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{+35} \lor \neg \left(y \leq 7.2 \cdot 10^{+32}\right):\\ \;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t + y \cdot \left(230661.510616 + y \cdot \left(27464.7644705 + y \cdot \left(z + y \cdot x\right)\right)\right)}{i + y \cdot c}\\ \end{array} \]
Alternative 8
Error15.7
Cost1609
\[\begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{+24} \lor \neg \left(y \leq 9.2 \cdot 10^{+41}\right):\\ \;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t + y \cdot 230661.510616}{i + y \cdot \left(c + y \cdot \left(y \cdot \left(y + a\right) + b\right)\right)}\\ \end{array} \]
Alternative 9
Error23.9
Cost1356
\[\begin{array}{l} t_1 := x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{if}\;y \leq -7.2 \cdot 10^{+25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3.8 \cdot 10^{-64}:\\ \;\;\;\;\frac{t + y \cdot 230661.510616}{i + b \cdot \left(y \cdot y\right)}\\ \mathbf{elif}\;y \leq 9.2 \cdot 10^{+41}:\\ \;\;\;\;\frac{t}{i + y \cdot c} + z \cdot \frac{y \cdot y}{c}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error20.3
Cost1353
\[\begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{+35} \lor \neg \left(y \leq 1.8 \cdot 10^{+42}\right):\\ \;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{i + y \cdot \left(c + y \cdot \left(y \cdot \left(y + a\right) + b\right)\right)}\\ \end{array} \]
Alternative 11
Error23.6
Cost1097
\[\begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{+21} \lor \neg \left(y \leq 8 \cdot 10^{+22}\right):\\ \;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t + y \cdot 230661.510616}{i + b \cdot \left(y \cdot y\right)}\\ \end{array} \]
Alternative 12
Error25.3
Cost969
\[\begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{+22} \lor \neg \left(y \leq 5.2 \cdot 10^{+22}\right):\\ \;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;230661.510616 \cdot \frac{y}{i} + \frac{t}{i}\\ \end{array} \]
Alternative 13
Error25.2
Cost969
\[\begin{array}{l} \mathbf{if}\;y \leq -1.7 \cdot 10^{+32} \lor \neg \left(y \leq 6500000000000\right):\\ \;\;\;\;x + \left(\frac{z}{y} - x \cdot \frac{a}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t + y \cdot \left(230661.510616 + y \cdot 27464.7644705\right)}{i}\\ \end{array} \]
Alternative 14
Error29.8
Cost840
\[\begin{array}{l} \mathbf{if}\;y \leq -0.00037:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.35 \cdot 10^{+27}:\\ \;\;\;\;230661.510616 \cdot \frac{y}{i} + \frac{t}{i}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 15
Error29.8
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -0.015:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+27}:\\ \;\;\;\;\frac{t + y \cdot 230661.510616}{i}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 16
Error32.2
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -320000:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-40}:\\ \;\;\;\;\frac{t}{i}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 17
Error46.8
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022364 
(FPCore (x y z t a b c i)
  :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2"
  :precision binary64
  (/ (+ (* (+ (* (+ (* (+ (* x y) z) y) 27464.7644705) y) 230661.510616) y) t) (+ (* (+ (* (+ (* (+ y a) y) b) y) c) y) i)))