Average Error: 25.7 → 6.9
Time: 18.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.631171194470569263954315566738703264937 \cdot 10^{164}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \le 5.492884630545356229744608925100127963585 \cdot 10^{148}:\\ \;\;\;\;y \cdot \left(x \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 -1.631171194470569263954315566738703264937 \cdot 10^{164}:\\
\;\;\;\;y \cdot \left(-x\right)\\

\mathbf{elif}\;z \le 5.492884630545356229744608925100127963585 \cdot 10^{148}:\\
\;\;\;\;y \cdot \left(x \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 r12871625 = x;
        double r12871626 = y;
        double r12871627 = r12871625 * r12871626;
        double r12871628 = z;
        double r12871629 = r12871627 * r12871628;
        double r12871630 = r12871628 * r12871628;
        double r12871631 = t;
        double r12871632 = a;
        double r12871633 = r12871631 * r12871632;
        double r12871634 = r12871630 - r12871633;
        double r12871635 = sqrt(r12871634);
        double r12871636 = r12871629 / r12871635;
        return r12871636;
}

double f(double x, double y, double z, double t, double a) {
        double r12871637 = z;
        double r12871638 = -1.6311711944705693e+164;
        bool r12871639 = r12871637 <= r12871638;
        double r12871640 = y;
        double r12871641 = x;
        double r12871642 = -r12871641;
        double r12871643 = r12871640 * r12871642;
        double r12871644 = 5.492884630545356e+148;
        bool r12871645 = r12871637 <= r12871644;
        double r12871646 = r12871637 * r12871637;
        double r12871647 = t;
        double r12871648 = a;
        double r12871649 = r12871647 * r12871648;
        double r12871650 = r12871646 - r12871649;
        double r12871651 = sqrt(r12871650);
        double r12871652 = r12871637 / r12871651;
        double r12871653 = r12871641 * r12871652;
        double r12871654 = r12871640 * r12871653;
        double r12871655 = r12871640 * r12871641;
        double r12871656 = r12871645 ? r12871654 : r12871655;
        double r12871657 = r12871639 ? r12871643 : r12871656;
        return r12871657;
}

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.7
Target8.1
Herbie6.9
\[\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 < -1.6311711944705693e+164

    1. Initial program 53.5

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

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

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

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

      \[\leadsto \color{blue}{\left(y \cdot x\right)} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\]
    7. Using strategy rm
    8. Applied associate-*l*53.1

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

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

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

    if -1.6311711944705693e+164 < z < 5.492884630545356e+148

    1. Initial program 12.3

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

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

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

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

      \[\leadsto \color{blue}{\left(y \cdot x\right)} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\]
    7. Using strategy rm
    8. Applied associate-*l*9.5

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

    if 5.492884630545356e+148 < z

    1. Initial program 53.5

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

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

Reproduce

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