Average Error: 25.2 → 6.3
Time: 4.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 -4.12938748087418624 \cdot 10^{99}:\\ \;\;\;\;x \cdot \left(-1 \cdot y\right)\\ \mathbf{elif}\;z \le 1.5571214549086307 \cdot 10^{71}:\\ \;\;\;\;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 -4.12938748087418624 \cdot 10^{99}:\\
\;\;\;\;x \cdot \left(-1 \cdot y\right)\\

\mathbf{elif}\;z \le 1.5571214549086307 \cdot 10^{71}:\\
\;\;\;\;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 r351818 = x;
        double r351819 = y;
        double r351820 = r351818 * r351819;
        double r351821 = z;
        double r351822 = r351820 * r351821;
        double r351823 = r351821 * r351821;
        double r351824 = t;
        double r351825 = a;
        double r351826 = r351824 * r351825;
        double r351827 = r351823 - r351826;
        double r351828 = sqrt(r351827);
        double r351829 = r351822 / r351828;
        return r351829;
}

double f(double x, double y, double z, double t, double a) {
        double r351830 = z;
        double r351831 = -4.129387480874186e+99;
        bool r351832 = r351830 <= r351831;
        double r351833 = x;
        double r351834 = -1.0;
        double r351835 = y;
        double r351836 = r351834 * r351835;
        double r351837 = r351833 * r351836;
        double r351838 = 1.5571214549086307e+71;
        bool r351839 = r351830 <= r351838;
        double r351840 = r351830 * r351830;
        double r351841 = t;
        double r351842 = a;
        double r351843 = r351841 * r351842;
        double r351844 = r351840 - r351843;
        double r351845 = sqrt(r351844);
        double r351846 = r351830 / r351845;
        double r351847 = r351835 * r351846;
        double r351848 = r351833 * r351847;
        double r351849 = r351833 * r351835;
        double r351850 = r351839 ? r351848 : r351849;
        double r351851 = r351832 ? r351837 : r351850;
        return r351851;
}

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.2
Target7.6
Herbie6.3
\[\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 < -4.129387480874186e+99

    1. Initial program 43.5

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

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

      \[\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*41.6

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

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

    if -4.129387480874186e+99 < z < 1.5571214549086307e+71

    1. Initial program 11.4

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

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

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

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

      \[\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*9.3

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

    if 1.5571214549086307e+71 < z

    1. Initial program 40.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -4.12938748087418624 \cdot 10^{99}:\\ \;\;\;\;x \cdot \left(-1 \cdot y\right)\\ \mathbf{elif}\;z \le 1.5571214549086307 \cdot 10^{71}:\\ \;\;\;\;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 2020003 
(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)))))