Average Error: 24.2 → 6.5
Time: 10.1s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -5.120105105042646 \cdot 10^{65}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 1.1249031597052721 \cdot 10^{148}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt{\sqrt{z \cdot z - t \cdot a}}}\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 -5.120105105042646 \cdot 10^{65}:\\
\;\;\;\;-x \cdot y\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r307939 = x;
        double r307940 = y;
        double r307941 = r307939 * r307940;
        double r307942 = z;
        double r307943 = r307941 * r307942;
        double r307944 = r307942 * r307942;
        double r307945 = t;
        double r307946 = a;
        double r307947 = r307945 * r307946;
        double r307948 = r307944 - r307947;
        double r307949 = sqrt(r307948);
        double r307950 = r307943 / r307949;
        return r307950;
}

double f(double x, double y, double z, double t, double a) {
        double r307951 = z;
        double r307952 = -5.1201051050426465e+65;
        bool r307953 = r307951 <= r307952;
        double r307954 = x;
        double r307955 = y;
        double r307956 = r307954 * r307955;
        double r307957 = -r307956;
        double r307958 = 1.124903159705272e+148;
        bool r307959 = r307951 <= r307958;
        double r307960 = r307951 * r307951;
        double r307961 = t;
        double r307962 = a;
        double r307963 = r307961 * r307962;
        double r307964 = r307960 - r307963;
        double r307965 = sqrt(r307964);
        double r307966 = sqrt(r307965);
        double r307967 = r307966 * r307966;
        double r307968 = r307951 / r307967;
        double r307969 = r307955 * r307968;
        double r307970 = r307954 * r307969;
        double r307971 = r307959 ? r307970 : r307956;
        double r307972 = r307953 ? r307957 : r307971;
        return r307972;
}

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.2
Target7.7
Herbie6.5
\[\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 3 regimes
  2. if z < -5.1201051050426465e+65

    1. Initial program 39.4

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity39.4

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

      \[\leadsto \frac{\left(x \cdot y\right) \cdot z}{\color{blue}{\sqrt{1} \cdot \sqrt{z \cdot z - t \cdot a}}}\]
    5. Applied times-frac36.6

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

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

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

    if -5.1201051050426465e+65 < z < 1.124903159705272e+148

    1. Initial program 11.2

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity11.2

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{\sqrt{1}} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}}\]
    6. Simplified9.5

      \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\]
    7. Using strategy rm
    8. Applied associate-*l*9.1

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)}\]
    9. Using strategy rm
    10. Applied add-cube-cbrt9.5

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

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

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

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

    if 1.124903159705272e+148 < z

    1. Initial program 51.6

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity51.6

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

      \[\leadsto \frac{\left(x \cdot y\right) \cdot z}{\color{blue}{\sqrt{1} \cdot \sqrt{z \cdot z - t \cdot a}}}\]
    5. Applied times-frac51.0

      \[\leadsto \color{blue}{\frac{x \cdot y}{\sqrt{1}} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}}\]
    6. Simplified51.0

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

      \[\leadsto \left(x \cdot y\right) \cdot \color{blue}{1}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -5.120105105042646 \cdot 10^{65}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 1.1249031597052721 \cdot 10^{148}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt{\sqrt{z \cdot z - t \cdot a}}}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

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