Average Error: 24.7 → 6.2
Time: 16.2s
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.4291886083756086 \cdot 10^{+152}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 1.0460513044759073 \cdot 10^{+153}:\\ \;\;\;\;\left(\frac{z}{\sqrt{z \cdot z - t \cdot a}} \cdot x\right) \cdot y\\ \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.4291886083756086 \cdot 10^{+152}:\\
\;\;\;\;x \cdot \left(-y\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r13532766 = x;
        double r13532767 = y;
        double r13532768 = r13532766 * r13532767;
        double r13532769 = z;
        double r13532770 = r13532768 * r13532769;
        double r13532771 = r13532769 * r13532769;
        double r13532772 = t;
        double r13532773 = a;
        double r13532774 = r13532772 * r13532773;
        double r13532775 = r13532771 - r13532774;
        double r13532776 = sqrt(r13532775);
        double r13532777 = r13532770 / r13532776;
        return r13532777;
}

double f(double x, double y, double z, double t, double a) {
        double r13532778 = z;
        double r13532779 = -1.4291886083756086e+152;
        bool r13532780 = r13532778 <= r13532779;
        double r13532781 = x;
        double r13532782 = y;
        double r13532783 = -r13532782;
        double r13532784 = r13532781 * r13532783;
        double r13532785 = 1.0460513044759073e+153;
        bool r13532786 = r13532778 <= r13532785;
        double r13532787 = r13532778 * r13532778;
        double r13532788 = t;
        double r13532789 = a;
        double r13532790 = r13532788 * r13532789;
        double r13532791 = r13532787 - r13532790;
        double r13532792 = sqrt(r13532791);
        double r13532793 = r13532778 / r13532792;
        double r13532794 = r13532793 * r13532781;
        double r13532795 = r13532794 * r13532782;
        double r13532796 = r13532781 * r13532782;
        double r13532797 = r13532786 ? r13532795 : r13532796;
        double r13532798 = r13532780 ? r13532784 : r13532797;
        return r13532798;
}

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.7
Target7.8
Herbie6.2
\[\begin{array}{l} \mathbf{if}\;z \lt -3.1921305903852764 \cdot 10^{+46}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \lt 5.976268120920894 \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.4291886083756086e+152

    1. Initial program 53.9

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

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

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

    if -1.4291886083756086e+152 < z < 1.0460513044759073e+153

    1. Initial program 11.3

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

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

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

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

    if 1.0460513044759073e+153 < z

    1. Initial program 54.3

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.4291886083756086 \cdot 10^{+152}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 1.0460513044759073 \cdot 10^{+153}:\\ \;\;\;\;\left(\frac{z}{\sqrt{z \cdot z - t \cdot a}} \cdot x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

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