Average Error: 27.9 → 11.1
Time: 2.0min
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 -1.1673355322272374 \cdot 10^{+50} \lor \neg \left(y \leq 4.0890179169218075 \cdot 10^{+59}\right):\\ \;\;\;\;\left(\frac{z}{y} + x\right) - \frac{x \cdot a}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot 230661.510616 + \left(27464.7644705 \cdot {y}^{2} + \left(t + \left(x \cdot {y}^{4} + z \cdot {y}^{3}\right)\right)\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 -1.1673355322272374 \cdot 10^{+50} \lor \neg \left(y \leq 4.0890179169218075 \cdot 10^{+59}\right):\\
\;\;\;\;\left(\frac{z}{y} + x\right) - \frac{x \cdot a}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{y \cdot 230661.510616 + \left(27464.7644705 \cdot {y}^{2} + \left(t + \left(x \cdot {y}^{4} + z \cdot {y}^{3}\right)\right)\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 -1.1673355322272374e+50) (not (<= y 4.0890179169218075e+59)))
   (- (+ (/ z y) x) (/ (* x a) y))
   (/
    (+
     (* y 230661.510616)
     (+
      (* 27464.7644705 (pow y 2.0))
      (+ t (+ (* x (pow y 4.0)) (* z (pow y 3.0))))))
    (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 <= -1.1673355322272374e+50) || !(y <= 4.0890179169218075e+59)) {
		tmp = ((z / y) + x) - ((x * a) / y);
	} else {
		tmp = ((y * 230661.510616) + ((27464.7644705 * pow(y, 2.0)) + (t + ((x * pow(y, 4.0)) + (z * pow(y, 3.0)))))) / 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 < -1.16733553222723735e50 or 4.08901791692180748e59 < y

    1. Initial program 62.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. Simplified62.4

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

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

    if -1.16733553222723735e50 < y < 4.08901791692180748e59

    1. Initial program 4.2

      \[\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. Simplified4.2

      \[\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 x around 0 4.4

      \[\leadsto \frac{\color{blue}{230661.510616 \cdot y + \left(27464.7644705 \cdot {y}^{2} + \left(t + \left({y}^{4} \cdot x + {y}^{3} \cdot z\right)\right)\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.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.1673355322272374 \cdot 10^{+50} \lor \neg \left(y \leq 4.0890179169218075 \cdot 10^{+59}\right):\\ \;\;\;\;\left(\frac{z}{y} + x\right) - \frac{x \cdot a}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot 230661.510616 + \left(27464.7644705 \cdot {y}^{2} + \left(t + \left(x \cdot {y}^{4} + z \cdot {y}^{3}\right)\right)\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 2022068 
(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)))