Average Error: 29.5 → 1.1
Time: 7.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 -1.7951056084945683 \cdot 10^{46}:\\ \;\;\;\;\mathsf{fma}\left(y, 3.13060547622999996 + \frac{t}{{z}^{2}}, x\right)\\ \mathbf{elif}\;z \le 2.34503027419662274 \cdot 10^{55}:\\ \;\;\;\;\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(y, 3.13060547622999996 + \frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\left|z\right|} \cdot \frac{\frac{\sqrt[3]{t}}{1}}{\left|z\right|}, x\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 -1.7951056084945683 \cdot 10^{46}:\\
\;\;\;\;\mathsf{fma}\left(y, 3.13060547622999996 + \frac{t}{{z}^{2}}, x\right)\\

\mathbf{elif}\;z \le 2.34503027419662274 \cdot 10^{55}:\\
\;\;\;\;\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(y, 3.13060547622999996 + \frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\left|z\right|} \cdot \frac{\frac{\sqrt[3]{t}}{1}}{\left|z\right|}, x\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 <= -1.7951056084945683e+46)) {
		temp = fma(y, (3.13060547623 + (t / pow(z, 2.0))), x);
	} else {
		double temp_1;
		if ((z <= 2.3450302741966227e+55)) {
			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(y, (3.13060547623 + (((cbrt(t) * cbrt(t)) / fabs(z)) * ((cbrt(t) / 1.0) / fabs(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.0
Herbie1.1
\[\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 < -1.7951056084945683e+46

    1. Initial program 60.9

      \[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.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)}\]
    3. Taylor expanded around inf 9.0

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

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

    if -1.7951056084945683e+46 < z < 2.3450302741966227e+55

    1. Initial program 2.6

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

      \[\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 2.3450302741966227e+55 < z

    1. Initial program 62.2

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y, 3.13060547622999996 + \color{blue}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\sqrt{{z}^{2}}} \cdot \frac{\sqrt[3]{t}}{\sqrt{{z}^{2}}}}, x\right)\]
    9. Simplified0.6

      \[\leadsto \mathsf{fma}\left(y, 3.13060547622999996 + \color{blue}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\left|z\right|}} \cdot \frac{\sqrt[3]{t}}{\sqrt{{z}^{2}}}, x\right)\]
    10. Simplified0.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.7951056084945683 \cdot 10^{46}:\\ \;\;\;\;\mathsf{fma}\left(y, 3.13060547622999996 + \frac{t}{{z}^{2}}, x\right)\\ \mathbf{elif}\;z \le 2.34503027419662274 \cdot 10^{55}:\\ \;\;\;\;\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(y, 3.13060547622999996 + \frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\left|z\right|} \cdot \frac{\frac{\sqrt[3]{t}}{1}}{\left|z\right|}, x\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020058 +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))))