Average Error: 30.1 → 1.0
Time: 27.6s
Precision: binary64
\[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -1.972645790880855 \cdot 10^{+55}:\\ \;\;\;\;x + y \cdot \left(\left(\frac{1}{z} \cdot \frac{t}{z} + \left(3.13060547623 + \frac{457.96100221584277}{z \cdot z}\right)\right) - \frac{36.527041698806414}{z}\right)\\ \mathbf{elif}\;z \leq 4.28513717524411 \cdot 10^{+52}:\\ \;\;\;\;x + y \cdot \frac{b + z \cdot \left(a + z \cdot \left(t + z \cdot \left(11.1667541262 + z \cdot 3.13060547623\right)\right)\right)}{0.607771387771 + z \cdot \left(11.9400905721 + z \cdot \left(31.4690115749 + z \cdot \left(z + 15.234687407\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(\left(\left(3.13060547623 + \frac{457.96100221584277}{z \cdot z}\right) + \frac{t}{z \cdot z}\right) - \frac{36.527041698806414}{z}\right)\\ \end{array}\]
x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}
\begin{array}{l}
\mathbf{if}\;z \leq -1.972645790880855 \cdot 10^{+55}:\\
\;\;\;\;x + y \cdot \left(\left(\frac{1}{z} \cdot \frac{t}{z} + \left(3.13060547623 + \frac{457.96100221584277}{z \cdot z}\right)\right) - \frac{36.527041698806414}{z}\right)\\

\mathbf{elif}\;z \leq 4.28513717524411 \cdot 10^{+52}:\\
\;\;\;\;x + y \cdot \frac{b + z \cdot \left(a + z \cdot \left(t + z \cdot \left(11.1667541262 + z \cdot 3.13060547623\right)\right)\right)}{0.607771387771 + z \cdot \left(11.9400905721 + z \cdot \left(31.4690115749 + z \cdot \left(z + 15.234687407\right)\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(\left(\left(3.13060547623 + \frac{457.96100221584277}{z \cdot z}\right) + \frac{t}{z \cdot z}\right) - \frac{36.527041698806414}{z}\right)\\

\end{array}
(FPCore (x y z t a b)
 :precision binary64
 (+
  x
  (/
   (*
    y
    (+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b))
   (+
    (* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z)
    0.607771387771))))
(FPCore (x y z t a b)
 :precision binary64
 (if (<= z -1.972645790880855e+55)
   (+
    x
    (*
     y
     (-
      (+
       (* (/ 1.0 z) (/ t z))
       (+ 3.13060547623 (/ 457.96100221584277 (* z z))))
      (/ 36.527041698806414 z))))
   (if (<= z 4.28513717524411e+52)
     (+
      x
      (*
       y
       (/
        (+
         b
         (* z (+ a (* z (+ t (* z (+ 11.1667541262 (* z 3.13060547623))))))))
        (+
         0.607771387771
         (*
          z
          (+
           11.9400905721
           (* z (+ 31.4690115749 (* z (+ z 15.234687407))))))))))
     (+
      x
      (*
       y
       (-
        (+ (+ 3.13060547623 (/ 457.96100221584277 (* z z))) (/ t (* z z)))
        (/ 36.527041698806414 z)))))))
double code(double x, double y, double z, double t, double a, double b) {
	return x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771));
}
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (z <= -1.972645790880855e+55) {
		tmp = x + (y * ((((1.0 / z) * (t / z)) + (3.13060547623 + (457.96100221584277 / (z * z)))) - (36.527041698806414 / z)));
	} else if (z <= 4.28513717524411e+52) {
		tmp = x + (y * ((b + (z * (a + (z * (t + (z * (11.1667541262 + (z * 3.13060547623)))))))) / (0.607771387771 + (z * (11.9400905721 + (z * (31.4690115749 + (z * (z + 15.234687407)))))))));
	} else {
		tmp = x + (y * (((3.13060547623 + (457.96100221584277 / (z * z))) + (t / (z * z))) - (36.527041698806414 / z)));
	}
	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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original30.1
Target1.0
Herbie1.0
\[\begin{array}{l} \mathbf{if}\;z < -6.499344996252632 \cdot 10^{+53}:\\ \;\;\;\;x + \left(\left(3.13060547623 - \frac{36.527041698806414}{z}\right) + \frac{t}{z \cdot z}\right) \cdot \frac{y}{1}\\ \mathbf{elif}\;z < 7.066965436914287 \cdot 10^{+59}:\\ \;\;\;\;x + \frac{y}{\frac{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}{\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b}}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\left(3.13060547623 - \frac{36.527041698806414}{z}\right) + \frac{t}{z \cdot z}\right) \cdot \frac{y}{1}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -1.9726457908808551e55

    1. Initial program 61.6

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary64_1064961.6

      \[\leadsto x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\color{blue}{1 \cdot \left(\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771\right)}}\]
    4. Applied times-frac_binary64_1065559.7

      \[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}}\]
    5. Simplified59.7

      \[\leadsto x + \color{blue}{y} \cdot \frac{\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\]
    6. Simplified59.7

      \[\leadsto x + y \cdot \color{blue}{\frac{b + z \cdot \left(a + z \cdot \left(t + z \cdot \left(11.1667541262 + z \cdot 3.13060547623\right)\right)\right)}{0.607771387771 + z \cdot \left(11.9400905721 + z \cdot \left(31.4690115749 + z \cdot \left(z + 15.234687407\right)\right)\right)}}\]
    7. Taylor expanded around inf 0.8

      \[\leadsto x + y \cdot \color{blue}{\left(\left(\frac{t}{{z}^{2}} + \left(457.96100221584277 \cdot \frac{1}{{z}^{2}} + 3.13060547623\right)\right) - 36.527041698806414 \cdot \frac{1}{z}\right)}\]
    8. Simplified0.8

      \[\leadsto x + y \cdot \color{blue}{\left(\left(\frac{t}{z \cdot z} + \left(3.13060547623 + \frac{457.96100221584277}{z \cdot z}\right)\right) - \frac{36.527041698806414}{z}\right)}\]
    9. Using strategy rm
    10. Applied *-un-lft-identity_binary64_106490.8

      \[\leadsto x + y \cdot \left(\left(\frac{\color{blue}{1 \cdot t}}{z \cdot z} + \left(3.13060547623 + \frac{457.96100221584277}{z \cdot z}\right)\right) - \frac{36.527041698806414}{z}\right)\]
    11. Applied times-frac_binary64_106550.8

      \[\leadsto x + y \cdot \left(\left(\color{blue}{\frac{1}{z} \cdot \frac{t}{z}} + \left(3.13060547623 + \frac{457.96100221584277}{z \cdot z}\right)\right) - \frac{36.527041698806414}{z}\right)\]

    if -1.9726457908808551e55 < z < 4.2851371752441103e52

    1. Initial program 2.9

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary64_106492.9

      \[\leadsto x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\color{blue}{1 \cdot \left(\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771\right)}}\]
    4. Applied times-frac_binary64_106551.2

      \[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}}\]
    5. Simplified1.2

      \[\leadsto x + \color{blue}{y} \cdot \frac{\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\]
    6. Simplified1.2

      \[\leadsto x + y \cdot \color{blue}{\frac{b + z \cdot \left(a + z \cdot \left(t + z \cdot \left(11.1667541262 + z \cdot 3.13060547623\right)\right)\right)}{0.607771387771 + z \cdot \left(11.9400905721 + z \cdot \left(31.4690115749 + z \cdot \left(z + 15.234687407\right)\right)\right)}}\]

    if 4.2851371752441103e52 < z

    1. Initial program 61.4

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary64_1064961.4

      \[\leadsto x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\color{blue}{1 \cdot \left(\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771\right)}}\]
    4. Applied times-frac_binary64_1065559.7

      \[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}}\]
    5. Simplified59.7

      \[\leadsto x + \color{blue}{y} \cdot \frac{\left(\left(\left(z \cdot 3.13060547623 + 11.1667541262\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b}{\left(\left(\left(z + 15.234687407\right) \cdot z + 31.4690115749\right) \cdot z + 11.9400905721\right) \cdot z + 0.607771387771}\]
    6. Simplified59.7

      \[\leadsto x + y \cdot \color{blue}{\frac{b + z \cdot \left(a + z \cdot \left(t + z \cdot \left(11.1667541262 + z \cdot 3.13060547623\right)\right)\right)}{0.607771387771 + z \cdot \left(11.9400905721 + z \cdot \left(31.4690115749 + z \cdot \left(z + 15.234687407\right)\right)\right)}}\]
    7. Taylor expanded around inf 0.8

      \[\leadsto x + y \cdot \color{blue}{\left(\left(\frac{t}{{z}^{2}} + \left(457.96100221584277 \cdot \frac{1}{{z}^{2}} + 3.13060547623\right)\right) - 36.527041698806414 \cdot \frac{1}{z}\right)}\]
    8. Simplified0.8

      \[\leadsto x + y \cdot \color{blue}{\left(\left(\frac{t}{z \cdot z} + \left(3.13060547623 + \frac{457.96100221584277}{z \cdot z}\right)\right) - \frac{36.527041698806414}{z}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.972645790880855 \cdot 10^{+55}:\\ \;\;\;\;x + y \cdot \left(\left(\frac{1}{z} \cdot \frac{t}{z} + \left(3.13060547623 + \frac{457.96100221584277}{z \cdot z}\right)\right) - \frac{36.527041698806414}{z}\right)\\ \mathbf{elif}\;z \leq 4.28513717524411 \cdot 10^{+52}:\\ \;\;\;\;x + y \cdot \frac{b + z \cdot \left(a + z \cdot \left(t + z \cdot \left(11.1667541262 + z \cdot 3.13060547623\right)\right)\right)}{0.607771387771 + z \cdot \left(11.9400905721 + z \cdot \left(31.4690115749 + z \cdot \left(z + 15.234687407\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(\left(\left(3.13060547623 + \frac{457.96100221584277}{z \cdot z}\right) + \frac{t}{z \cdot z}\right) - \frac{36.527041698806414}{z}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2021044 
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, D"
  :precision binary64

  :herbie-target
  (if (< z -6.499344996252632e+53) (+ x (* (+ (- 3.13060547623 (/ 36.527041698806414 z)) (/ t (* z z))) (/ y 1.0))) (if (< z 7.066965436914287e+59) (+ x (/ y (/ (+ (* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z) 0.607771387771) (+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b)))) (+ x (* (+ (- 3.13060547623 (/ 36.527041698806414 z)) (/ t (* z z))) (/ y 1.0)))))

  (+ x (/ (* y (+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b)) (+ (* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z) 0.607771387771))))