Average Error: 24.8 → 6.2
Time: 5.4s
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.783459363067827924540279194552192802352 \cdot 10^{138}:\\ \;\;\;\;\left(x \cdot y\right) \cdot -1\\ \mathbf{elif}\;z \le 4.762366900384719143369985213022816341136 \cdot 10^{70}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\\ \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.783459363067827924540279194552192802352 \cdot 10^{138}:\\
\;\;\;\;\left(x \cdot y\right) \cdot -1\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r238976 = x;
        double r238977 = y;
        double r238978 = r238976 * r238977;
        double r238979 = z;
        double r238980 = r238978 * r238979;
        double r238981 = r238979 * r238979;
        double r238982 = t;
        double r238983 = a;
        double r238984 = r238982 * r238983;
        double r238985 = r238981 - r238984;
        double r238986 = sqrt(r238985);
        double r238987 = r238980 / r238986;
        return r238987;
}

double f(double x, double y, double z, double t, double a) {
        double r238988 = z;
        double r238989 = -1.783459363067828e+138;
        bool r238990 = r238988 <= r238989;
        double r238991 = x;
        double r238992 = y;
        double r238993 = r238991 * r238992;
        double r238994 = -1.0;
        double r238995 = r238993 * r238994;
        double r238996 = 4.762366900384719e+70;
        bool r238997 = r238988 <= r238996;
        double r238998 = r238988 * r238988;
        double r238999 = t;
        double r239000 = a;
        double r239001 = r238999 * r239000;
        double r239002 = r238998 - r239001;
        double r239003 = sqrt(r239002);
        double r239004 = r238988 / r239003;
        double r239005 = r238993 * r239004;
        double r239006 = r238997 ? r239005 : r238993;
        double r239007 = r238990 ? r238995 : r239006;
        return r239007;
}

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.8
Target7.5
Herbie6.2
\[\begin{array}{l} \mathbf{if}\;z \lt -3.192130590385276419686361646843883646209 \cdot 10^{46}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \lt 5.976268120920894210257945708950453212935 \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 < -1.783459363067828e+138

    1. Initial program 49.6

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity49.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-prod49.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-frac48.6

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

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

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

    if -1.783459363067828e+138 < z < 4.762366900384719e+70

    1. Initial program 10.6

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity10.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-prod10.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-frac9.0

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

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

    if 4.762366900384719e+70 < z

    1. Initial program 40.6

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity40.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-prod40.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-frac37.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.783459363067827924540279194552192802352 \cdot 10^{138}:\\ \;\;\;\;\left(x \cdot y\right) \cdot -1\\ \mathbf{elif}\;z \le 4.762366900384719143369985213022816341136 \cdot 10^{70}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

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