Average Error: 29.5 → 1.5
Time: 6.0s
Precision: 64
\[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547622999996 + 11.166754126200001\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687406999999\right) \cdot z + 31.469011574900001\right) \cdot z + 11.940090572100001\right) \cdot z + 0.60777138777100004}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.1286680735006301 \cdot 10^{49}:\\ \;\;\;\;\mathsf{fma}\left(y, 3.13060547622999996 + \frac{1}{\frac{{z}^{2}}{t}}, x\right)\\ \mathbf{elif}\;z \le 495619.95934221218:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687406999999, z, 31.469011574900001\right), z, 11.940090572100001\right), z, 0.60777138777100004\right)}, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547622999996, 11.166754126200001\right), z, t\right), z, a\right), z, b\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(3.13060547622999996, y, \mathsf{fma}\left(\frac{y}{z}, \frac{t}{z}, x\right)\right)\\ \end{array}\]
x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547622999996 + 11.166754126200001\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687406999999\right) \cdot z + 31.469011574900001\right) \cdot z + 11.940090572100001\right) \cdot z + 0.60777138777100004}
\begin{array}{l}
\mathbf{if}\;z \le -2.1286680735006301 \cdot 10^{49}:\\
\;\;\;\;\mathsf{fma}\left(y, 3.13060547622999996 + \frac{1}{\frac{{z}^{2}}{t}}, x\right)\\

\mathbf{elif}\;z \le 495619.95934221218:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687406999999, z, 31.469011574900001\right), z, 11.940090572100001\right), z, 0.60777138777100004\right)}, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547622999996, 11.166754126200001\right), z, t\right), z, a\right), z, b\right), x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(3.13060547622999996, y, \mathsf{fma}\left(\frac{y}{z}, \frac{t}{z}, x\right)\right)\\

\end{array}
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 temp;
	if ((z <= -2.12866807350063e+49)) {
		temp = fma(y, (3.13060547623 + (1.0 / (pow(z, 2.0) / t))), x);
	} else {
		double temp_1;
		if ((z <= 495619.9593422122)) {
			temp_1 = fma((y / fma(fma(fma((z + 15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)), fma(fma(fma(fma(z, 3.13060547623, 11.1667541262), z, t), z, a), z, b), x);
		} else {
			temp_1 = fma(3.13060547623, y, fma((y / z), (t / z), x));
		}
		temp = temp_1;
	}
	return temp;
}

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

Original29.5
Target1.2
Herbie1.5
\[\begin{array}{l} \mathbf{if}\;z \lt -6.4993449962526318 \cdot 10^{53}:\\ \;\;\;\;x + \left(\left(3.13060547622999996 - \frac{36.527041698806414}{z}\right) + \frac{t}{z \cdot z}\right) \cdot \frac{y}{1}\\ \mathbf{elif}\;z \lt 7.0669654369142868 \cdot 10^{59}:\\ \;\;\;\;x + \frac{y}{\frac{\left(\left(\left(z + 15.234687406999999\right) \cdot z + 31.469011574900001\right) \cdot z + 11.940090572100001\right) \cdot z + 0.60777138777100004}{\left(\left(\left(z \cdot 3.13060547622999996 + 11.166754126200001\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b}}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\left(3.13060547622999996 - \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 < -2.12866807350063e+49

    1. Initial program 61.4

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547622999996 + 11.166754126200001\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687406999999\right) \cdot z + 31.469011574900001\right) \cdot z + 11.940090572100001\right) \cdot z + 0.60777138777100004}\]
    2. Simplified59.9

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687406999999, z, 31.469011574900001\right), z, 11.940090572100001\right), z, 0.60777138777100004\right)}, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547622999996, 11.166754126200001\right), z, t\right), z, a\right), z, b\right), x\right)}\]
    3. Taylor expanded around inf 9.1

      \[\leadsto \color{blue}{x + \left(\frac{t \cdot y}{{z}^{2}} + 3.13060547622999996 \cdot y\right)}\]
    4. Simplified1.3

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 3.13060547622999996 + \frac{t}{{z}^{2}}, x\right)}\]
    5. Using strategy rm
    6. Applied clear-num1.3

      \[\leadsto \mathsf{fma}\left(y, 3.13060547622999996 + \color{blue}{\frac{1}{\frac{{z}^{2}}{t}}}, x\right)\]

    if -2.12866807350063e+49 < z < 495619.9593422122

    1. Initial program 1.4

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547622999996 + 11.166754126200001\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687406999999\right) \cdot z + 31.469011574900001\right) \cdot z + 11.940090572100001\right) \cdot z + 0.60777138777100004}\]
    2. Simplified0.7

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687406999999, z, 31.469011574900001\right), z, 11.940090572100001\right), z, 0.60777138777100004\right)}, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547622999996, 11.166754126200001\right), z, t\right), z, a\right), z, b\right), x\right)}\]

    if 495619.9593422122 < z

    1. Initial program 56.3

      \[x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547622999996 + 11.166754126200001\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687406999999\right) \cdot z + 31.469011574900001\right) \cdot z + 11.940090572100001\right) \cdot z + 0.60777138777100004}\]
    2. Simplified53.8

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687406999999, z, 31.469011574900001\right), z, 11.940090572100001\right), z, 0.60777138777100004\right)}, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547622999996, 11.166754126200001\right), z, t\right), z, a\right), z, b\right), x\right)}\]
    3. Taylor expanded around inf 10.9

      \[\leadsto \color{blue}{x + \left(\frac{t \cdot y}{{z}^{2}} + 3.13060547622999996 \cdot y\right)}\]
    4. Simplified3.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 3.13060547622999996 + \frac{t}{{z}^{2}}, x\right)}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt4.1

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\left(\sqrt[3]{3.13060547622999996} \cdot \sqrt[3]{3.13060547622999996}\right) \cdot \sqrt[3]{3.13060547622999996}} + \frac{t}{{z}^{2}}, x\right)\]
    7. Applied fma-def4.1

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{\mathsf{fma}\left(\sqrt[3]{3.13060547622999996} \cdot \sqrt[3]{3.13060547622999996}, \sqrt[3]{3.13060547622999996}, \frac{t}{{z}^{2}}\right)}, x\right)\]
    8. Taylor expanded around 0 10.9

      \[\leadsto \color{blue}{x + \left(\frac{t \cdot y}{{z}^{2}} + 3.13060547622999996 \cdot y\right)}\]
    9. Simplified3.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(3.13060547622999996, y, \mathsf{fma}\left(\frac{y}{z}, \frac{t}{z}, x\right)\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.1286680735006301 \cdot 10^{49}:\\ \;\;\;\;\mathsf{fma}\left(y, 3.13060547622999996 + \frac{1}{\frac{{z}^{2}}{t}}, x\right)\\ \mathbf{elif}\;z \le 495619.95934221218:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687406999999, z, 31.469011574900001\right), z, 11.940090572100001\right), z, 0.60777138777100004\right)}, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547622999996, 11.166754126200001\right), z, t\right), z, a\right), z, b\right), x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(3.13060547622999996, y, \mathsf{fma}\left(\frac{y}{z}, \frac{t}{z}, x\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020056 +o rules:numerics
(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))) (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)))))

  (+ 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))))