Average Error: 24.7 → 6.3
Time: 18.8s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -7.806488284801272281442098142415949936998 \cdot 10^{152}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 2.466136078144351188794958598210872238756 \cdot 10^{99}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{\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 -7.806488284801272281442098142415949936998 \cdot 10^{152}:\\
\;\;\;\;x \cdot \left(-y\right)\\

\mathbf{elif}\;z \le 2.466136078144351188794958598210872238756 \cdot 10^{99}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{z}{\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 r14807363 = x;
        double r14807364 = y;
        double r14807365 = r14807363 * r14807364;
        double r14807366 = z;
        double r14807367 = r14807365 * r14807366;
        double r14807368 = r14807366 * r14807366;
        double r14807369 = t;
        double r14807370 = a;
        double r14807371 = r14807369 * r14807370;
        double r14807372 = r14807368 - r14807371;
        double r14807373 = sqrt(r14807372);
        double r14807374 = r14807367 / r14807373;
        return r14807374;
}

double f(double x, double y, double z, double t, double a) {
        double r14807375 = z;
        double r14807376 = -7.806488284801272e+152;
        bool r14807377 = r14807375 <= r14807376;
        double r14807378 = x;
        double r14807379 = y;
        double r14807380 = -r14807379;
        double r14807381 = r14807378 * r14807380;
        double r14807382 = 2.466136078144351e+99;
        bool r14807383 = r14807375 <= r14807382;
        double r14807384 = r14807375 * r14807375;
        double r14807385 = t;
        double r14807386 = a;
        double r14807387 = r14807385 * r14807386;
        double r14807388 = r14807384 - r14807387;
        double r14807389 = sqrt(r14807388);
        double r14807390 = r14807375 / r14807389;
        double r14807391 = r14807379 * r14807390;
        double r14807392 = r14807378 * r14807391;
        double r14807393 = r14807378 * r14807379;
        double r14807394 = r14807383 ? r14807392 : r14807393;
        double r14807395 = r14807377 ? r14807381 : r14807394;
        return r14807395;
}

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.7
Target7.6
Herbie6.3
\[\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 < -7.806488284801272e+152

    1. Initial program 54.4

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

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

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

    if -7.806488284801272e+152 < z < 2.466136078144351e+99

    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 *-un-lft-identity11.1

      \[\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.1

      \[\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.3

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

      \[\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*8.8

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

    if 2.466136078144351e+99 < z

    1. Initial program 43.6

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

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

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

Reproduce

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

  :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)))))