Average Error: 25.3 → 6.4
Time: 24.4s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.01532130093420398 \cdot 10^{154}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 6.4447789061204586 \cdot 10^{97}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{1}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\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 -1.01532130093420398 \cdot 10^{154}:\\
\;\;\;\;x \cdot \left(-y\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r260638 = x;
        double r260639 = y;
        double r260640 = r260638 * r260639;
        double r260641 = z;
        double r260642 = r260640 * r260641;
        double r260643 = r260641 * r260641;
        double r260644 = t;
        double r260645 = a;
        double r260646 = r260644 * r260645;
        double r260647 = r260643 - r260646;
        double r260648 = sqrt(r260647);
        double r260649 = r260642 / r260648;
        return r260649;
}

double f(double x, double y, double z, double t, double a) {
        double r260650 = z;
        double r260651 = -1.015321300934204e+154;
        bool r260652 = r260650 <= r260651;
        double r260653 = x;
        double r260654 = y;
        double r260655 = -r260654;
        double r260656 = r260653 * r260655;
        double r260657 = 6.4447789061204586e+97;
        bool r260658 = r260650 <= r260657;
        double r260659 = 1.0;
        double r260660 = r260650 * r260650;
        double r260661 = t;
        double r260662 = a;
        double r260663 = r260661 * r260662;
        double r260664 = r260660 - r260663;
        double r260665 = sqrt(r260664);
        double r260666 = r260665 / r260650;
        double r260667 = r260659 / r260666;
        double r260668 = r260654 * r260667;
        double r260669 = r260653 * r260668;
        double r260670 = r260654 * r260653;
        double r260671 = r260658 ? r260669 : r260670;
        double r260672 = r260652 ? r260656 : r260671;
        return r260672;
}

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.3
Target7.9
Herbie6.4
\[\begin{array}{l} \mathbf{if}\;z \lt -3.1921305903852764 \cdot 10^{46}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \lt 5.9762681209208942 \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 < -1.015321300934204e+154

    1. Initial program 54.3

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

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

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

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

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

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

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

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

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

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

    if -1.015321300934204e+154 < z < 6.4447789061204586e+97

    1. Initial program 11.7

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

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

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

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

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

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

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

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

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

    if 6.4447789061204586e+97 < z

    1. Initial program 43.3

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

      \[\leadsto \color{blue}{x \cdot y}\]
    3. Simplified2.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.01532130093420398 \cdot 10^{154}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 6.4447789061204586 \cdot 10^{97}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{1}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array}\]

Reproduce

herbie shell --seed 2019199 +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)))))