Average Error: 24.0 → 6.4
Time: 17.6s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.962990925915687 \cdot 10^{+91}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 3.471068194478418 \cdot 10^{+142}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - a \cdot t}}\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 -3.962990925915687 \cdot 10^{+91}:\\
\;\;\;\;x \cdot \left(-y\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r14920612 = x;
        double r14920613 = y;
        double r14920614 = r14920612 * r14920613;
        double r14920615 = z;
        double r14920616 = r14920614 * r14920615;
        double r14920617 = r14920615 * r14920615;
        double r14920618 = t;
        double r14920619 = a;
        double r14920620 = r14920618 * r14920619;
        double r14920621 = r14920617 - r14920620;
        double r14920622 = sqrt(r14920621);
        double r14920623 = r14920616 / r14920622;
        return r14920623;
}

double f(double x, double y, double z, double t, double a) {
        double r14920624 = z;
        double r14920625 = -3.962990925915687e+91;
        bool r14920626 = r14920624 <= r14920625;
        double r14920627 = x;
        double r14920628 = y;
        double r14920629 = -r14920628;
        double r14920630 = r14920627 * r14920629;
        double r14920631 = 3.471068194478418e+142;
        bool r14920632 = r14920624 <= r14920631;
        double r14920633 = r14920624 * r14920624;
        double r14920634 = a;
        double r14920635 = t;
        double r14920636 = r14920634 * r14920635;
        double r14920637 = r14920633 - r14920636;
        double r14920638 = sqrt(r14920637);
        double r14920639 = r14920624 / r14920638;
        double r14920640 = r14920628 * r14920639;
        double r14920641 = r14920627 * r14920640;
        double r14920642 = r14920627 * r14920628;
        double r14920643 = r14920632 ? r14920641 : r14920642;
        double r14920644 = r14920626 ? r14920630 : r14920643;
        return r14920644;
}

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.0
Target8.1
Herbie6.4
\[\begin{array}{l} \mathbf{if}\;z \lt -3.1921305903852764 \cdot 10^{+46}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \lt 5.976268120920894 \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 < -3.962990925915687e+91

    1. Initial program 42.0

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

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

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

    if -3.962990925915687e+91 < z < 3.471068194478418e+142

    1. Initial program 10.8

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied clear-num9.7

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}{x \cdot y}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity9.7

      \[\leadsto \frac{1}{\frac{\frac{\sqrt{z \cdot z - t \cdot a}}{\color{blue}{1 \cdot z}}}{x \cdot y}}\]
    8. Applied *-un-lft-identity9.7

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

      \[\leadsto \frac{1}{\frac{\frac{\color{blue}{\sqrt{1} \cdot \sqrt{z \cdot z - t \cdot a}}}{1 \cdot z}}{x \cdot y}}\]
    10. Applied times-frac9.7

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{\sqrt{1}}{1}}{x} \cdot \frac{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}{y}}}\]
    12. Applied add-cube-cbrt9.9

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

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

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

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

    if 3.471068194478418e+142 < z

    1. Initial program 50.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.962990925915687 \cdot 10^{+91}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 3.471068194478418 \cdot 10^{+142}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - a \cdot t}}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 2019164 +o rules:numerics
(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)))))