Average Error: 25.1 → 6.1
Time: 11.6s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -9.34194979807773912 \cdot 10^{151}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 2.2349389384476415 \cdot 10^{125}:\\ \;\;\;\;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 -9.34194979807773912 \cdot 10^{151}:\\
\;\;\;\;-x \cdot y\\

\mathbf{elif}\;z \le 2.2349389384476415 \cdot 10^{125}:\\
\;\;\;\;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 r406794 = x;
        double r406795 = y;
        double r406796 = r406794 * r406795;
        double r406797 = z;
        double r406798 = r406796 * r406797;
        double r406799 = r406797 * r406797;
        double r406800 = t;
        double r406801 = a;
        double r406802 = r406800 * r406801;
        double r406803 = r406799 - r406802;
        double r406804 = sqrt(r406803);
        double r406805 = r406798 / r406804;
        return r406805;
}

double f(double x, double y, double z, double t, double a) {
        double r406806 = z;
        double r406807 = -9.341949798077739e+151;
        bool r406808 = r406806 <= r406807;
        double r406809 = x;
        double r406810 = y;
        double r406811 = r406809 * r406810;
        double r406812 = -r406811;
        double r406813 = 2.2349389384476415e+125;
        bool r406814 = r406806 <= r406813;
        double r406815 = r406806 * r406806;
        double r406816 = t;
        double r406817 = a;
        double r406818 = r406816 * r406817;
        double r406819 = r406815 - r406818;
        double r406820 = sqrt(r406819);
        double r406821 = r406806 / r406820;
        double r406822 = r406810 * r406821;
        double r406823 = r406809 * r406822;
        double r406824 = r406814 ? r406823 : r406811;
        double r406825 = r406808 ? r406812 : r406824;
        return r406825;
}

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.1
Target7.5
Herbie6.1
\[\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 < -9.341949798077739e+151

    1. Initial program 53.6

      \[\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}{-1 \cdot \left(x \cdot y\right)}\]
    3. Simplified1.5

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

    if -9.341949798077739e+151 < z < 2.2349389384476415e+125

    1. Initial program 11.5

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

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

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

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

    if 2.2349389384476415e+125 < z

    1. Initial program 47.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -9.34194979807773912 \cdot 10^{151}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 2.2349389384476415 \cdot 10^{125}:\\ \;\;\;\;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 2020042 +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.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)))))