Average Error: 24.8 → 6.4
Time: 14.9s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -8.271419220344132473449011043748253490608 \cdot 10^{137}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \le 6.239560565980056845688368913673998851268 \cdot 10^{82}:\\ \;\;\;\;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 -8.271419220344132473449011043748253490608 \cdot 10^{137}:\\
\;\;\;\;-y \cdot x\\

\mathbf{elif}\;z \le 6.239560565980056845688368913673998851268 \cdot 10^{82}:\\
\;\;\;\;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 r216747 = x;
        double r216748 = y;
        double r216749 = r216747 * r216748;
        double r216750 = z;
        double r216751 = r216749 * r216750;
        double r216752 = r216750 * r216750;
        double r216753 = t;
        double r216754 = a;
        double r216755 = r216753 * r216754;
        double r216756 = r216752 - r216755;
        double r216757 = sqrt(r216756);
        double r216758 = r216751 / r216757;
        return r216758;
}

double f(double x, double y, double z, double t, double a) {
        double r216759 = z;
        double r216760 = -8.271419220344132e+137;
        bool r216761 = r216759 <= r216760;
        double r216762 = y;
        double r216763 = x;
        double r216764 = r216762 * r216763;
        double r216765 = -r216764;
        double r216766 = 6.239560565980057e+82;
        bool r216767 = r216759 <= r216766;
        double r216768 = 1.0;
        double r216769 = r216759 * r216759;
        double r216770 = t;
        double r216771 = a;
        double r216772 = r216770 * r216771;
        double r216773 = r216769 - r216772;
        double r216774 = sqrt(r216773);
        double r216775 = r216774 / r216759;
        double r216776 = r216768 / r216775;
        double r216777 = r216762 * r216776;
        double r216778 = r216763 * r216777;
        double r216779 = r216767 ? r216778 : r216764;
        double r216780 = r216761 ? r216765 : r216779;
        return r216780;
}

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
Herbie6.4
\[\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 < -8.271419220344132e+137

    1. Initial program 50.0

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

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

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

    if -8.271419220344132e+137 < z < 6.239560565980057e+82

    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 *-un-lft-identity9.3

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

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

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

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

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

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

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

    if 6.239560565980057e+82 < z

    1. Initial program 42.5

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

      \[\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 -8.271419220344132473449011043748253490608 \cdot 10^{137}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \le 6.239560565980056845688368913673998851268 \cdot 10^{82}:\\ \;\;\;\;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 2019212 +o rules:numerics
(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.1921305903852764e46) (- (* y x)) (if (< z 5.9762681209208942e90) (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y)) (* y x)))

  (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))