Average Error: 25.7 → 7.0
Time: 22.8s
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}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 5.492884630545356229744608925100127963585 \cdot 10^{148}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\\ \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 -1.631171194470569263954315566738703264937 \cdot 10^{164}:\\
\;\;\;\;-x \cdot y\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r23408786 = x;
        double r23408787 = y;
        double r23408788 = r23408786 * r23408787;
        double r23408789 = z;
        double r23408790 = r23408788 * r23408789;
        double r23408791 = r23408789 * r23408789;
        double r23408792 = t;
        double r23408793 = a;
        double r23408794 = r23408792 * r23408793;
        double r23408795 = r23408791 - r23408794;
        double r23408796 = sqrt(r23408795);
        double r23408797 = r23408790 / r23408796;
        return r23408797;
}

double f(double x, double y, double z, double t, double a) {
        double r23408798 = z;
        double r23408799 = -1.6311711944705693e+164;
        bool r23408800 = r23408798 <= r23408799;
        double r23408801 = x;
        double r23408802 = y;
        double r23408803 = r23408801 * r23408802;
        double r23408804 = -r23408803;
        double r23408805 = 5.492884630545356e+148;
        bool r23408806 = r23408798 <= r23408805;
        double r23408807 = r23408798 * r23408798;
        double r23408808 = t;
        double r23408809 = a;
        double r23408810 = r23408808 * r23408809;
        double r23408811 = r23408807 - r23408810;
        double r23408812 = sqrt(r23408811);
        double r23408813 = r23408798 / r23408812;
        double r23408814 = r23408803 * r23408813;
        double r23408815 = r23408806 ? r23408814 : r23408803;
        double r23408816 = r23408800 ? r23408804 : r23408815;
        return r23408816;
}

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
Herbie7.0
\[\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. Taylor expanded around -inf 1.1

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

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

    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(x \cdot y\right)} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\]

    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 simplification7.0

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

Reproduce

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