Average Error: 29.3 → 11.8
Time: 1.3min
Precision: binary64
\[\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 -3.830897912971591 \cdot 10^{+68} \lor \neg \left(y \leq 2.1239716152342804 \cdot 10^{+82}\right):\\ \;\;\;\;\left(\frac{z}{y} + x\right) - \frac{x \cdot a}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, y \cdot \left(x \cdot \left(y \cdot y\right)\right) + \left(230661.510616 + \left(y \cdot 27464.7644705 + z \cdot {y}^{2}\right)\right), t\right)}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, y + a, b\right), c\right), i\right)}\\ \end{array} \]
\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 -3.830897912971591 \cdot 10^{+68} \lor \neg \left(y \leq 2.1239716152342804 \cdot 10^{+82}\right):\\
\;\;\;\;\left(\frac{z}{y} + x\right) - \frac{x \cdot a}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, y \cdot \left(x \cdot \left(y \cdot y\right)\right) + \left(230661.510616 + \left(y \cdot 27464.7644705 + z \cdot {y}^{2}\right)\right), t\right)}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, y + a, b\right), c\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 -3.830897912971591e+68) (not (<= y 2.1239716152342804e+82)))
   (- (+ (/ z y) x) (/ (* x a) y))
   (/
    (fma
     y
     (+
      (* y (* x (* y y)))
      (+ 230661.510616 (+ (* y 27464.7644705) (* z (pow y 2.0)))))
     t)
    (fma y (fma y (fma y (+ y a) b) c) 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 <= -3.830897912971591e+68) || !(y <= 2.1239716152342804e+82)) {
		tmp = ((z / y) + x) - ((x * a) / y);
	} else {
		tmp = fma(y, ((y * (x * (y * y))) + (230661.510616 + ((y * 27464.7644705) + (z * pow(y, 2.0))))), t) / fma(y, fma(y, fma(y, (y + a), b), c), i);
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus i

Derivation

  1. Split input into 2 regimes
  2. if y < -3.83089791297159121e68 or 2.1239716152342804e82 < y

    1. Initial program 63.6

      \[\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. Simplified63.6

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(x, y, z\right), 27464.7644705\right), 230661.510616\right), t\right)}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, y + a, b\right), c\right), i\right)}} \]
    3. Taylor expanded in y around inf 19.2

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

    if -3.83089791297159121e68 < y < 2.1239716152342804e82

    1. Initial program 7.0

      \[\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. Simplified7.0

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(x, y, z\right), 27464.7644705\right), 230661.510616\right), t\right)}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, y + a, b\right), c\right), i\right)}} \]
    3. Taylor expanded in y around 0 7.0

      \[\leadsto \frac{\mathsf{fma}\left(y, \color{blue}{{y}^{3} \cdot x + \left(230661.510616 + \left(27464.7644705 \cdot y + {y}^{2} \cdot z\right)\right)}, t\right)}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, y + a, b\right), c\right), i\right)} \]
    4. Applied cube-mult_binary647.0

      \[\leadsto \frac{\mathsf{fma}\left(y, \color{blue}{\left(y \cdot \left(y \cdot y\right)\right)} \cdot x + \left(230661.510616 + \left(27464.7644705 \cdot y + {y}^{2} \cdot z\right)\right), t\right)}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, y + a, b\right), c\right), i\right)} \]
    5. Applied associate-*l*_binary647.0

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

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

Reproduce

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