Average Error: 29.2 → 11.7
Time: 1.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} t_1 := \left(\frac{z}{y} + x\right) - \frac{x \cdot a}{y}\\ \mathbf{if}\;y \leq -3.5063866772198877 \cdot 10^{+93}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.2702176602074296 \cdot 10^{+48}:\\ \;\;\;\;\begin{array}{l} t_2 := {y}^{2} \cdot {x}^{2}\\ \frac{1}{\left(\frac{{z}^{2}}{{y}^{2} \cdot {x}^{3}} + \left(\frac{b}{x \cdot {y}^{2}} + \left(\frac{1}{x} + \frac{a}{y \cdot x}\right)\right)\right) - \left(\frac{z}{y \cdot {x}^{2}} + \left(\frac{z \cdot a}{t_2} + 27464.7644705 \cdot \frac{1}{t_2}\right)\right)} \end{array}\\ \mathbf{elif}\;y \leq 3.231730882941454 \cdot 10^{+32}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, \mathsf{fma}\left(y \cdot y, y \cdot x, 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)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \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}
t_1 := \left(\frac{z}{y} + x\right) - \frac{x \cdot a}{y}\\
\mathbf{if}\;y \leq -3.5063866772198877 \cdot 10^{+93}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.2702176602074296 \cdot 10^{+48}:\\
\;\;\;\;\begin{array}{l}
t_2 := {y}^{2} \cdot {x}^{2}\\
\frac{1}{\left(\frac{{z}^{2}}{{y}^{2} \cdot {x}^{3}} + \left(\frac{b}{x \cdot {y}^{2}} + \left(\frac{1}{x} + \frac{a}{y \cdot x}\right)\right)\right) - \left(\frac{z}{y \cdot {x}^{2}} + \left(\frac{z \cdot a}{t_2} + 27464.7644705 \cdot \frac{1}{t_2}\right)\right)}
\end{array}\\

\mathbf{elif}\;y \leq 3.231730882941454 \cdot 10^{+32}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, \mathsf{fma}\left(y \cdot y, y \cdot x, 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)}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\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
 (let* ((t_1 (- (+ (/ z y) x) (/ (* x a) y))))
   (if (<= y -3.5063866772198877e+93)
     t_1
     (if (<= y -1.2702176602074296e+48)
       (let* ((t_2 (* (pow y 2.0) (pow x 2.0))))
         (/
          1.0
          (-
           (+
            (/ (pow z 2.0) (* (pow y 2.0) (pow x 3.0)))
            (+ (/ b (* x (pow y 2.0))) (+ (/ 1.0 x) (/ a (* y x)))))
           (+
            (/ z (* y (pow x 2.0)))
            (+ (/ (* z a) t_2) (* 27464.7644705 (/ 1.0 t_2)))))))
       (if (<= y 3.231730882941454e+32)
         (/
          (fma
           y
           (fma
            (* y y)
            (* y x)
            (+ 230661.510616 (+ (* y 27464.7644705) (* z (pow y 2.0)))))
           t)
          (fma y (fma y (fma y (+ y a) b) c) i))
         t_1)))))
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 t_1 = ((z / y) + x) - ((x * a) / y);
	double tmp;
	if (y <= -3.5063866772198877e+93) {
		tmp = t_1;
	} else if (y <= -1.2702176602074296e+48) {
		double t_2 = pow(y, 2.0) * pow(x, 2.0);
		tmp = 1.0 / (((pow(z, 2.0) / (pow(y, 2.0) * pow(x, 3.0))) + ((b / (x * pow(y, 2.0))) + ((1.0 / x) + (a / (y * x))))) - ((z / (y * pow(x, 2.0))) + (((z * a) / t_2) + (27464.7644705 * (1.0 / t_2)))));
	} else if (y <= 3.231730882941454e+32) {
		tmp = fma(y, fma((y * y), (y * x), (230661.510616 + ((y * 27464.7644705) + (z * pow(y, 2.0))))), t) / fma(y, fma(y, fma(y, (y + a), b), c), i);
	} else {
		tmp = t_1;
	}
	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 3 regimes
  2. if y < -3.5063866772198877e93 or 3.231730882941454e32 < y

    1. Initial program 62.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. Simplified62.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 y around inf 20.5

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

    if -3.5063866772198877e93 < y < -1.27021766020742957e48

    1. Initial program 55.1

      \[\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. Simplified55.1

      \[\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 55.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 clear-num_binary6455.0

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

      \[\leadsto \frac{1}{\color{blue}{\left(\frac{{z}^{2}}{{y}^{2} \cdot {x}^{3}} + \left(\frac{b}{{y}^{2} \cdot x} + \left(\frac{1}{x} + \frac{a}{y \cdot x}\right)\right)\right) - \left(\frac{z}{y \cdot {x}^{2}} + \left(\frac{a \cdot z}{{y}^{2} \cdot {x}^{2}} + 27464.7644705 \cdot \frac{1}{{y}^{2} \cdot {x}^{2}}\right)\right)}} \]

    if -1.27021766020742957e48 < y < 3.231730882941454e32

    1. Initial program 3.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. Simplified3.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 y around 0 3.2

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

      \[\leadsto \frac{\mathsf{fma}\left(y, \color{blue}{\left(\left(y \cdot y\right) \cdot y\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*_binary643.2

      \[\leadsto \frac{\mathsf{fma}\left(y, \color{blue}{\left(y \cdot y\right) \cdot \left(y \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)} \]
    6. Applied fma-def_binary643.2

      \[\leadsto \frac{\mathsf{fma}\left(y, \color{blue}{\mathsf{fma}\left(y \cdot y, y \cdot x, 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 3 regimes into one program.
  4. Final simplification11.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.5063866772198877 \cdot 10^{+93}:\\ \;\;\;\;\left(\frac{z}{y} + x\right) - \frac{x \cdot a}{y}\\ \mathbf{elif}\;y \leq -1.2702176602074296 \cdot 10^{+48}:\\ \;\;\;\;\frac{1}{\left(\frac{{z}^{2}}{{y}^{2} \cdot {x}^{3}} + \left(\frac{b}{x \cdot {y}^{2}} + \left(\frac{1}{x} + \frac{a}{y \cdot x}\right)\right)\right) - \left(\frac{z}{y \cdot {x}^{2}} + \left(\frac{z \cdot a}{{y}^{2} \cdot {x}^{2}} + 27464.7644705 \cdot \frac{1}{{y}^{2} \cdot {x}^{2}}\right)\right)}\\ \mathbf{elif}\;y \leq 3.231730882941454 \cdot 10^{+32}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, \mathsf{fma}\left(y \cdot y, y \cdot x, 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)}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{z}{y} + x\right) - \frac{x \cdot a}{y}\\ \end{array} \]

Reproduce

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