Average Error: 24.6 → 6.0
Time: 13.7s
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.465998159965367372739527425522646175119 \cdot 10^{149}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 4.020794709845025708842624738781094962913 \cdot 10^{94}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \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.465998159965367372739527425522646175119 \cdot 10^{149}:\\
\;\;\;\;-x \cdot y\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r243588 = x;
        double r243589 = y;
        double r243590 = r243588 * r243589;
        double r243591 = z;
        double r243592 = r243590 * r243591;
        double r243593 = r243591 * r243591;
        double r243594 = t;
        double r243595 = a;
        double r243596 = r243594 * r243595;
        double r243597 = r243593 - r243596;
        double r243598 = sqrt(r243597);
        double r243599 = r243592 / r243598;
        return r243599;
}

double f(double x, double y, double z, double t, double a) {
        double r243600 = z;
        double r243601 = -2.4659981599653674e+149;
        bool r243602 = r243600 <= r243601;
        double r243603 = x;
        double r243604 = y;
        double r243605 = r243603 * r243604;
        double r243606 = -r243605;
        double r243607 = 4.020794709845026e+94;
        bool r243608 = r243600 <= r243607;
        double r243609 = r243600 * r243600;
        double r243610 = t;
        double r243611 = a;
        double r243612 = r243610 * r243611;
        double r243613 = r243609 - r243612;
        double r243614 = sqrt(r243613);
        double r243615 = r243600 / r243614;
        double r243616 = r243604 * r243615;
        double r243617 = r243603 * r243616;
        double r243618 = r243604 * r243603;
        double r243619 = r243608 ? r243617 : r243618;
        double r243620 = r243602 ? r243606 : r243619;
        return r243620;
}

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.6
Target7.5
Herbie6.0
\[\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 < -2.4659981599653674e+149

    1. Initial program 52.9

      \[\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}{-1 \cdot \left(x \cdot y\right)}\]
    3. Simplified1.4

      \[\leadsto \color{blue}{-x \cdot y}\]

    if -2.4659981599653674e+149 < z < 4.020794709845026e+94

    1. Initial program 10.7

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

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

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

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

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

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

    if 4.020794709845026e+94 < z

    1. Initial program 42.9

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

      \[\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-prod42.9

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

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

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

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

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

Reproduce

herbie shell --seed 2019208 
(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.1921305903852764e46) (- (* y x)) (if (< z 5.9762681209208942e90) (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y)) (* y x)))

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