Average Error: 24.8 → 6.5
Time: 4.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 -2.6550496665863674 \cdot 10^{104}:\\ \;\;\;\;-1 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;z \le 1.8937249127317549 \cdot 10^{137}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \left(\frac{1}{\sqrt{z \cdot z - t \cdot a}} \cdot z\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 -2.6550496665863674 \cdot 10^{104}:\\
\;\;\;\;-1 \cdot \left(x \cdot y\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r278409 = x;
        double r278410 = y;
        double r278411 = r278409 * r278410;
        double r278412 = z;
        double r278413 = r278411 * r278412;
        double r278414 = r278412 * r278412;
        double r278415 = t;
        double r278416 = a;
        double r278417 = r278415 * r278416;
        double r278418 = r278414 - r278417;
        double r278419 = sqrt(r278418);
        double r278420 = r278413 / r278419;
        return r278420;
}

double f(double x, double y, double z, double t, double a) {
        double r278421 = z;
        double r278422 = -2.6550496665863674e+104;
        bool r278423 = r278421 <= r278422;
        double r278424 = -1.0;
        double r278425 = x;
        double r278426 = y;
        double r278427 = r278425 * r278426;
        double r278428 = r278424 * r278427;
        double r278429 = 1.893724912731755e+137;
        bool r278430 = r278421 <= r278429;
        double r278431 = 1.0;
        double r278432 = r278421 * r278421;
        double r278433 = t;
        double r278434 = a;
        double r278435 = r278433 * r278434;
        double r278436 = r278432 - r278435;
        double r278437 = sqrt(r278436);
        double r278438 = r278431 / r278437;
        double r278439 = r278438 * r278421;
        double r278440 = r278427 * r278439;
        double r278441 = r278430 ? r278440 : r278427;
        double r278442 = r278423 ? r278428 : r278441;
        return r278442;
}

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.6
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 < -2.6550496665863674e+104

    1. Initial program 44.5

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Taylor expanded around -inf 1.9

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

    if -2.6550496665863674e+104 < z < 1.893724912731755e+137

    1. Initial program 11.1

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

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

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

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

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

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

    if 1.893724912731755e+137 < z

    1. Initial program 50.0

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Taylor expanded around inf 1.4

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

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

Reproduce

herbie shell --seed 2020024 
(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)))))