Average Error: 25.1 → 6.0
Time: 15.3s
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.199714169449318426725790466332778930458 \cdot 10^{116}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 2.818827562843424905673562246640834606804 \cdot 10^{156}:\\ \;\;\;\;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 -5.199714169449318426725790466332778930458 \cdot 10^{116}:\\
\;\;\;\;-x \cdot y\\

\mathbf{elif}\;z \le 2.818827562843424905673562246640834606804 \cdot 10^{156}:\\
\;\;\;\;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 r187600 = x;
        double r187601 = y;
        double r187602 = r187600 * r187601;
        double r187603 = z;
        double r187604 = r187602 * r187603;
        double r187605 = r187603 * r187603;
        double r187606 = t;
        double r187607 = a;
        double r187608 = r187606 * r187607;
        double r187609 = r187605 - r187608;
        double r187610 = sqrt(r187609);
        double r187611 = r187604 / r187610;
        return r187611;
}

double f(double x, double y, double z, double t, double a) {
        double r187612 = z;
        double r187613 = -5.1997141694493184e+116;
        bool r187614 = r187612 <= r187613;
        double r187615 = x;
        double r187616 = y;
        double r187617 = r187615 * r187616;
        double r187618 = -r187617;
        double r187619 = 2.818827562843425e+156;
        bool r187620 = r187612 <= r187619;
        double r187621 = r187612 * r187612;
        double r187622 = t;
        double r187623 = a;
        double r187624 = r187622 * r187623;
        double r187625 = r187621 - r187624;
        double r187626 = sqrt(r187625);
        double r187627 = r187612 / r187626;
        double r187628 = r187616 * r187627;
        double r187629 = r187615 * r187628;
        double r187630 = r187620 ? r187629 : r187617;
        double r187631 = r187614 ? r187618 : r187630;
        return r187631;
}

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

Original25.1
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 < -5.1997141694493184e+116

    1. Initial program 47.7

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

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

      \[\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 -5.1997141694493184e+116 < z < 2.818827562843425e+156

    1. Initial program 10.9

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

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

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

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

    if 2.818827562843425e+156 < z

    1. Initial program 54.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -5.199714169449318426725790466332778930458 \cdot 10^{116}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 2.818827562843424905673562246640834606804 \cdot 10^{156}:\\ \;\;\;\;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 2019322 
(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)))))