Average Error: 24.1 → 7.1
Time: 5.2s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.1613085318430635 \cdot 10^{146}:\\ \;\;\;\;\left(x \cdot y\right) \cdot -1\\ \mathbf{elif}\;z \le -1.15287383592906728 \cdot 10^{-189}:\\ \;\;\;\;\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \mathbf{elif}\;z \le 1.26365548077316353 \cdot 10^{101}:\\ \;\;\;\;\frac{x}{\sqrt{z \cdot z - t \cdot a}} \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\begin{array}{l}
\mathbf{if}\;z \le -1.1613085318430635 \cdot 10^{146}:\\
\;\;\;\;\left(x \cdot y\right) \cdot -1\\

\mathbf{elif}\;z \le -1.15287383592906728 \cdot 10^{-189}:\\
\;\;\;\;\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\

\mathbf{elif}\;z \le 1.26365548077316353 \cdot 10^{101}:\\
\;\;\;\;\frac{x}{\sqrt{z \cdot z - t \cdot a}} \cdot \left(z \cdot y\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot y\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r343768 = x;
        double r343769 = y;
        double r343770 = r343768 * r343769;
        double r343771 = z;
        double r343772 = r343770 * r343771;
        double r343773 = r343771 * r343771;
        double r343774 = t;
        double r343775 = a;
        double r343776 = r343774 * r343775;
        double r343777 = r343773 - r343776;
        double r343778 = sqrt(r343777);
        double r343779 = r343772 / r343778;
        return r343779;
}

double f(double x, double y, double z, double t, double a) {
        double r343780 = z;
        double r343781 = -1.1613085318430635e+146;
        bool r343782 = r343780 <= r343781;
        double r343783 = x;
        double r343784 = y;
        double r343785 = r343783 * r343784;
        double r343786 = -1.0;
        double r343787 = r343785 * r343786;
        double r343788 = -1.1528738359290673e-189;
        bool r343789 = r343780 <= r343788;
        double r343790 = r343780 * r343780;
        double r343791 = t;
        double r343792 = a;
        double r343793 = r343791 * r343792;
        double r343794 = r343790 - r343793;
        double r343795 = sqrt(r343794);
        double r343796 = r343795 / r343780;
        double r343797 = r343785 / r343796;
        double r343798 = 1.2636554807731635e+101;
        bool r343799 = r343780 <= r343798;
        double r343800 = r343783 / r343795;
        double r343801 = r343780 * r343784;
        double r343802 = r343800 * r343801;
        double r343803 = r343799 ? r343802 : r343785;
        double r343804 = r343789 ? r343797 : r343803;
        double r343805 = r343782 ? r343787 : r343804;
        return r343805;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original24.1
Target8.1
Herbie7.1
\[\begin{array}{l} \mathbf{if}\;z \lt -3.1921305903852764 \cdot 10^{46}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \lt 5.9762681209208942 \cdot 10^{90}:\\ \;\;\;\;\frac{x \cdot z}{\frac{\sqrt{z \cdot z - a \cdot t}}{y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array}\]

Derivation

  1. Split input into 4 regimes
  2. if z < -1.1613085318430635e+146

    1. Initial program 51.0

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied associate-/l*50.1

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied div-inv50.1

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    6. Taylor expanded around -inf 1.6

      \[\leadsto \left(x \cdot y\right) \cdot \color{blue}{-1}\]

    if -1.1613085318430635e+146 < z < -1.1528738359290673e-189

    1. Initial program 8.7

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied associate-/l*5.4

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]

    if -1.1528738359290673e-189 < z < 1.2636554807731635e+101

    1. Initial program 13.0

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied associate-/l*12.4

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied div-inv12.5

      \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{z \cdot z - t \cdot a} \cdot \frac{1}{z}}}\]
    6. Applied times-frac13.4

      \[\leadsto \color{blue}{\frac{x}{\sqrt{z \cdot z - t \cdot a}} \cdot \frac{y}{\frac{1}{z}}}\]
    7. Simplified13.3

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

    if 1.2636554807731635e+101 < z

    1. Initial program 43.2

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied associate-/l*41.1

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied div-inv41.1

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    6. Using strategy rm
    7. Applied add-sqr-sqrt41.1

      \[\leadsto \left(x \cdot y\right) \cdot \frac{1}{\frac{\sqrt{\color{blue}{\sqrt{z \cdot z - t \cdot a} \cdot \sqrt{z \cdot z - t \cdot a}}}}{z}}\]
    8. Applied sqrt-prod41.2

      \[\leadsto \left(x \cdot y\right) \cdot \frac{1}{\frac{\color{blue}{\sqrt{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt{\sqrt{z \cdot z - t \cdot a}}}}{z}}\]
    9. Taylor expanded around inf 2.7

      \[\leadsto \color{blue}{x \cdot y}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification7.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.1613085318430635 \cdot 10^{146}:\\ \;\;\;\;\left(x \cdot y\right) \cdot -1\\ \mathbf{elif}\;z \le -1.15287383592906728 \cdot 10^{-189}:\\ \;\;\;\;\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \mathbf{elif}\;z \le 1.26365548077316353 \cdot 10^{101}:\\ \;\;\;\;\frac{x}{\sqrt{z \cdot z - t \cdot a}} \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 2020083 
(FPCore (x y z t a)
  :name "Statistics.Math.RootFinding:ridders from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (if (< z -3.1921305903852764e+46) (- (* y x)) (if (< z 5.976268120920894e+90) (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y)) (* y x)))

  (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))