Average Error: 24.8 → 5.8
Time: 17.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 -5.979373433067621707384015273322967579969 \cdot 10^{153}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \le 3.280936158314262078662177353861886074421 \cdot 10^{107}:\\ \;\;\;\;\left(\frac{z}{\sqrt{z \cdot z - t \cdot a}} \cdot y\right) \cdot x\\ \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 -5.979373433067621707384015273322967579969 \cdot 10^{153}:\\
\;\;\;\;y \cdot \left(-x\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r16019604 = x;
        double r16019605 = y;
        double r16019606 = r16019604 * r16019605;
        double r16019607 = z;
        double r16019608 = r16019606 * r16019607;
        double r16019609 = r16019607 * r16019607;
        double r16019610 = t;
        double r16019611 = a;
        double r16019612 = r16019610 * r16019611;
        double r16019613 = r16019609 - r16019612;
        double r16019614 = sqrt(r16019613);
        double r16019615 = r16019608 / r16019614;
        return r16019615;
}

double f(double x, double y, double z, double t, double a) {
        double r16019616 = z;
        double r16019617 = -5.979373433067622e+153;
        bool r16019618 = r16019616 <= r16019617;
        double r16019619 = y;
        double r16019620 = x;
        double r16019621 = -r16019620;
        double r16019622 = r16019619 * r16019621;
        double r16019623 = 3.280936158314262e+107;
        bool r16019624 = r16019616 <= r16019623;
        double r16019625 = r16019616 * r16019616;
        double r16019626 = t;
        double r16019627 = a;
        double r16019628 = r16019626 * r16019627;
        double r16019629 = r16019625 - r16019628;
        double r16019630 = sqrt(r16019629);
        double r16019631 = r16019616 / r16019630;
        double r16019632 = r16019631 * r16019619;
        double r16019633 = r16019632 * r16019620;
        double r16019634 = r16019619 * r16019620;
        double r16019635 = r16019624 ? r16019633 : r16019634;
        double r16019636 = r16019618 ? r16019622 : r16019635;
        return r16019636;
}

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.7
Herbie5.8
\[\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 < -5.979373433067622e+153

    1. Initial program 54.0

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Taylor expanded around -inf 1.7

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

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

    if -5.979373433067622e+153 < z < 3.280936158314262e+107

    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 associate-/l*8.5

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity8.5

      \[\leadsto \frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{\color{blue}{1 \cdot z}}}\]
    6. Applied *-un-lft-identity8.5

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

      \[\leadsto \frac{x \cdot y}{\frac{\color{blue}{\sqrt{1} \cdot \sqrt{z \cdot z - t \cdot a}}}{1 \cdot z}}\]
    8. Applied times-frac8.5

      \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    9. Applied times-frac8.0

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

      \[\leadsto \color{blue}{x} \cdot \frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\]
    11. Using strategy rm
    12. Applied div-inv8.0

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

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

    if 3.280936158314262e+107 < z

    1. Initial program 45.3

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

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

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

Reproduce

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