Average Error: 28.1 → 12.1
Time: 1.4min
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 := \frac{a}{y \cdot x}\\ t_2 := \frac{z}{y \cdot {x}^{2}}\\ \mathbf{if}\;y \leq -3.14888652711073 \cdot 10^{+107}:\\ \;\;\;\;\frac{1}{\left(\frac{1}{x} + t_1\right) - t_2}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_3 := \frac{x \cdot a}{y}\\ \mathbf{if}\;y \leq -7.161012571514077 \cdot 10^{+76}:\\ \;\;\;\;\left(\frac{z}{y} + \left(\frac{x \cdot {a}^{2}}{{y}^{2}} + \left(x + 27464.7644705 \cdot \frac{1}{{y}^{2}}\right)\right)\right) - \left(t_3 + \left(\frac{x \cdot b}{{y}^{2}} + \frac{a \cdot z}{{y}^{2}}\right)\right)\\ \mathbf{elif}\;y \leq -4.2220150941237535 \cdot 10^{+34}:\\ \;\;\;\;\begin{array}{l} t_4 := {x}^{2} \cdot {y}^{3}\\ t_5 := {x}^{3} \cdot {y}^{3}\\ t_6 := {x}^{2} \cdot {y}^{2}\\ \frac{1}{\left(\frac{{z}^{2}}{{y}^{2} \cdot {x}^{3}} + \left(\frac{b}{x \cdot {y}^{2}} + \left(\frac{1}{x} + \left(t_1 + \left(\frac{c}{x \cdot {y}^{3}} + \left(54929.528941 \cdot \frac{z}{t_5} + \frac{a \cdot {z}^{2}}{t_5}\right)\right)\right)\right)\right)\right) - \left(\frac{z \cdot b}{t_4} + \left(\frac{{z}^{3}}{{y}^{3} \cdot {x}^{4}} + \left(t_2 + \left(\frac{a \cdot z}{t_6} + \left(27464.7644705 \cdot \frac{a}{t_4} + \left(27464.7644705 \cdot \frac{1}{t_6} + 230661.510616 \cdot \frac{1}{t_4}\right)\right)\right)\right)\right)\right)} \end{array}\\ \mathbf{elif}\;y \leq 1.4777067309723976 \cdot 10^{+58}:\\ \;\;\;\;\frac{y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(x, y, z\right), 27464.7644705\right), 230661.510616\right) + t}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, y + a, b\right), c\right), i\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(x + \frac{z}{y}\right) - t_3\\ \end{array}\\ \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 := \frac{a}{y \cdot x}\\
t_2 := \frac{z}{y \cdot {x}^{2}}\\
\mathbf{if}\;y \leq -3.14888652711073 \cdot 10^{+107}:\\
\;\;\;\;\frac{1}{\left(\frac{1}{x} + t_1\right) - t_2}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \frac{x \cdot a}{y}\\
\mathbf{if}\;y \leq -7.161012571514077 \cdot 10^{+76}:\\
\;\;\;\;\left(\frac{z}{y} + \left(\frac{x \cdot {a}^{2}}{{y}^{2}} + \left(x + 27464.7644705 \cdot \frac{1}{{y}^{2}}\right)\right)\right) - \left(t_3 + \left(\frac{x \cdot b}{{y}^{2}} + \frac{a \cdot z}{{y}^{2}}\right)\right)\\

\mathbf{elif}\;y \leq -4.2220150941237535 \cdot 10^{+34}:\\
\;\;\;\;\begin{array}{l}
t_4 := {x}^{2} \cdot {y}^{3}\\
t_5 := {x}^{3} \cdot {y}^{3}\\
t_6 := {x}^{2} \cdot {y}^{2}\\
\frac{1}{\left(\frac{{z}^{2}}{{y}^{2} \cdot {x}^{3}} + \left(\frac{b}{x \cdot {y}^{2}} + \left(\frac{1}{x} + \left(t_1 + \left(\frac{c}{x \cdot {y}^{3}} + \left(54929.528941 \cdot \frac{z}{t_5} + \frac{a \cdot {z}^{2}}{t_5}\right)\right)\right)\right)\right)\right) - \left(\frac{z \cdot b}{t_4} + \left(\frac{{z}^{3}}{{y}^{3} \cdot {x}^{4}} + \left(t_2 + \left(\frac{a \cdot z}{t_6} + \left(27464.7644705 \cdot \frac{a}{t_4} + \left(27464.7644705 \cdot \frac{1}{t_6} + 230661.510616 \cdot \frac{1}{t_4}\right)\right)\right)\right)\right)\right)}
\end{array}\\

\mathbf{elif}\;y \leq 1.4777067309723976 \cdot 10^{+58}:\\
\;\;\;\;\frac{y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(x, y, z\right), 27464.7644705\right), 230661.510616\right) + t}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, y + a, b\right), c\right), i\right)}\\

\mathbf{else}:\\
\;\;\;\;\left(x + \frac{z}{y}\right) - t_3\\


\end{array}\\


\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 (/ a (* y x))) (t_2 (/ z (* y (pow x 2.0)))))
   (if (<= y -3.14888652711073e+107)
     (/ 1.0 (- (+ (/ 1.0 x) t_1) t_2))
     (let* ((t_3 (/ (* x a) y)))
       (if (<= y -7.161012571514077e+76)
         (-
          (+
           (/ z y)
           (+
            (/ (* x (pow a 2.0)) (pow y 2.0))
            (+ x (* 27464.7644705 (/ 1.0 (pow y 2.0))))))
          (+ t_3 (+ (/ (* x b) (pow y 2.0)) (/ (* a z) (pow y 2.0)))))
         (if (<= y -4.2220150941237535e+34)
           (let* ((t_4 (* (pow x 2.0) (pow y 3.0)))
                  (t_5 (* (pow x 3.0) (pow y 3.0)))
                  (t_6 (* (pow x 2.0) (pow y 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)
                  (+
                   t_1
                   (+
                    (/ c (* x (pow y 3.0)))
                    (+
                     (* 54929.528941 (/ z t_5))
                     (/ (* a (pow z 2.0)) t_5)))))))
               (+
                (/ (* z b) t_4)
                (+
                 (/ (pow z 3.0) (* (pow y 3.0) (pow x 4.0)))
                 (+
                  t_2
                  (+
                   (/ (* a z) t_6)
                   (+
                    (* 27464.7644705 (/ a t_4))
                    (+
                     (* 27464.7644705 (/ 1.0 t_6))
                     (* 230661.510616 (/ 1.0 t_4)))))))))))
           (if (<= y 1.4777067309723976e+58)
             (/
              (+
               (* y (fma y (fma y (fma x y z) 27464.7644705) 230661.510616))
               t)
              (fma y (fma y (fma y (+ y a) b) c) i))
             (- (+ x (/ z y)) t_3))))))))
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 = a / (y * x);
	double t_2 = z / (y * pow(x, 2.0));
	double tmp;
	if (y <= -3.14888652711073e+107) {
		tmp = 1.0 / (((1.0 / x) + t_1) - t_2);
	} else {
		double t_3 = (x * a) / y;
		double tmp_1;
		if (y <= -7.161012571514077e+76) {
			tmp_1 = ((z / y) + (((x * pow(a, 2.0)) / pow(y, 2.0)) + (x + (27464.7644705 * (1.0 / pow(y, 2.0)))))) - (t_3 + (((x * b) / pow(y, 2.0)) + ((a * z) / pow(y, 2.0))));
		} else if (y <= -4.2220150941237535e+34) {
			double t_4 = pow(x, 2.0) * pow(y, 3.0);
			double t_5 = pow(x, 3.0) * pow(y, 3.0);
			double t_6 = pow(x, 2.0) * pow(y, 2.0);
			tmp_1 = 1.0 / (((pow(z, 2.0) / (pow(y, 2.0) * pow(x, 3.0))) + ((b / (x * pow(y, 2.0))) + ((1.0 / x) + (t_1 + ((c / (x * pow(y, 3.0))) + ((54929.528941 * (z / t_5)) + ((a * pow(z, 2.0)) / t_5))))))) - (((z * b) / t_4) + ((pow(z, 3.0) / (pow(y, 3.0) * pow(x, 4.0))) + (t_2 + (((a * z) / t_6) + ((27464.7644705 * (a / t_4)) + ((27464.7644705 * (1.0 / t_6)) + (230661.510616 * (1.0 / t_4)))))))));
		} else if (y <= 1.4777067309723976e+58) {
			tmp_1 = ((y * fma(y, fma(y, fma(x, y, z), 27464.7644705), 230661.510616)) + t) / fma(y, fma(y, fma(y, (y + a), b), c), i);
		} else {
			tmp_1 = (x + (z / y)) - t_3;
		}
		tmp = tmp_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 5 regimes
  2. if y < -3.1488865271107301e107

    1. Initial program 63.7

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

      \[\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. Applied clear-num_binary6463.7

      \[\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, \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(x, y, z\right), 27464.7644705\right), 230661.510616\right), t\right)}}} \]
    4. Taylor expanded in y around inf 23.8

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

    if -3.1488865271107301e107 < y < -7.16101257151407655e76

    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 35.8

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

    if -7.16101257151407655e76 < y < -4.22201509412375347e34

    1. Initial program 46.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. Simplified46.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. Applied clear-num_binary6446.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, \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(x, y, z\right), 27464.7644705\right), 230661.510616\right), t\right)}}} \]
    4. Taylor expanded in y around inf 45.1

      \[\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} + \left(\frac{a}{y \cdot x} + \left(\frac{c}{{y}^{3} \cdot x} + \left(54929.528941 \cdot \frac{z}{{y}^{3} \cdot {x}^{3}} + \frac{a \cdot {z}^{2}}{{y}^{3} \cdot {x}^{3}}\right)\right)\right)\right)\right)\right) - \left(\frac{b \cdot z}{{y}^{3} \cdot {x}^{2}} + \left(\frac{{z}^{3}}{{y}^{3} \cdot {x}^{4}} + \left(\frac{z}{y \cdot {x}^{2}} + \left(\frac{a \cdot z}{{y}^{2} \cdot {x}^{2}} + \left(27464.7644705 \cdot \frac{a}{{y}^{3} \cdot {x}^{2}} + \left(27464.7644705 \cdot \frac{1}{{y}^{2} \cdot {x}^{2}} + 230661.510616 \cdot \frac{1}{{y}^{3} \cdot {x}^{2}}\right)\right)\right)\right)\right)\right)}} \]

    if -4.22201509412375347e34 < y < 1.4777067309723976e58

    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. Applied fma-udef_binary643.2

      \[\leadsto \frac{\color{blue}{y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(x, y, z\right), 27464.7644705\right), 230661.510616\right) + t}}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, y + a, b\right), c\right), i\right)} \]

    if 1.4777067309723976e58 < y

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

      \[\leadsto \color{blue}{\left(\frac{z}{y} + x\right) - \frac{a \cdot x}{y}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification12.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.14888652711073 \cdot 10^{+107}:\\ \;\;\;\;\frac{1}{\left(\frac{1}{x} + \frac{a}{y \cdot x}\right) - \frac{z}{y \cdot {x}^{2}}}\\ \mathbf{elif}\;y \leq -7.161012571514077 \cdot 10^{+76}:\\ \;\;\;\;\left(\frac{z}{y} + \left(\frac{x \cdot {a}^{2}}{{y}^{2}} + \left(x + 27464.7644705 \cdot \frac{1}{{y}^{2}}\right)\right)\right) - \left(\frac{x \cdot a}{y} + \left(\frac{x \cdot b}{{y}^{2}} + \frac{a \cdot z}{{y}^{2}}\right)\right)\\ \mathbf{elif}\;y \leq -4.2220150941237535 \cdot 10^{+34}:\\ \;\;\;\;\frac{1}{\left(\frac{{z}^{2}}{{y}^{2} \cdot {x}^{3}} + \left(\frac{b}{x \cdot {y}^{2}} + \left(\frac{1}{x} + \left(\frac{a}{y \cdot x} + \left(\frac{c}{x \cdot {y}^{3}} + \left(54929.528941 \cdot \frac{z}{{x}^{3} \cdot {y}^{3}} + \frac{a \cdot {z}^{2}}{{x}^{3} \cdot {y}^{3}}\right)\right)\right)\right)\right)\right) - \left(\frac{z \cdot b}{{x}^{2} \cdot {y}^{3}} + \left(\frac{{z}^{3}}{{y}^{3} \cdot {x}^{4}} + \left(\frac{z}{y \cdot {x}^{2}} + \left(\frac{a \cdot z}{{x}^{2} \cdot {y}^{2}} + \left(27464.7644705 \cdot \frac{a}{{x}^{2} \cdot {y}^{3}} + \left(27464.7644705 \cdot \frac{1}{{x}^{2} \cdot {y}^{2}} + 230661.510616 \cdot \frac{1}{{x}^{2} \cdot {y}^{3}}\right)\right)\right)\right)\right)\right)}\\ \mathbf{elif}\;y \leq 1.4777067309723976 \cdot 10^{+58}:\\ \;\;\;\;\frac{y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(x, y, z\right), 27464.7644705\right), 230661.510616\right) + t}{\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, y + a, b\right), c\right), i\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(x + \frac{z}{y}\right) - \frac{x \cdot a}{y}\\ \end{array} \]

Reproduce

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