Average Error: 24.7 → 6.3
Time: 19.5s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -7.806488284801272281442098142415949936998 \cdot 10^{152}:\\ \;\;\;\;\left(-y\right) \cdot x\\ \mathbf{elif}\;z \le 2.466136078144351188794958598210872238756 \cdot 10^{99}:\\ \;\;\;\;\left(\frac{z}{\sqrt{z \cdot z - t \cdot a}} \cdot y\right) \cdot x\\ \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 -7.806488284801272281442098142415949936998 \cdot 10^{152}:\\
\;\;\;\;\left(-y\right) \cdot x\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r14810679 = x;
        double r14810680 = y;
        double r14810681 = r14810679 * r14810680;
        double r14810682 = z;
        double r14810683 = r14810681 * r14810682;
        double r14810684 = r14810682 * r14810682;
        double r14810685 = t;
        double r14810686 = a;
        double r14810687 = r14810685 * r14810686;
        double r14810688 = r14810684 - r14810687;
        double r14810689 = sqrt(r14810688);
        double r14810690 = r14810683 / r14810689;
        return r14810690;
}

double f(double x, double y, double z, double t, double a) {
        double r14810691 = z;
        double r14810692 = -7.806488284801272e+152;
        bool r14810693 = r14810691 <= r14810692;
        double r14810694 = y;
        double r14810695 = -r14810694;
        double r14810696 = x;
        double r14810697 = r14810695 * r14810696;
        double r14810698 = 2.466136078144351e+99;
        bool r14810699 = r14810691 <= r14810698;
        double r14810700 = r14810691 * r14810691;
        double r14810701 = t;
        double r14810702 = a;
        double r14810703 = r14810701 * r14810702;
        double r14810704 = r14810700 - r14810703;
        double r14810705 = sqrt(r14810704);
        double r14810706 = r14810691 / r14810705;
        double r14810707 = r14810706 * r14810694;
        double r14810708 = r14810707 * r14810696;
        double r14810709 = r14810694 * r14810696;
        double r14810710 = r14810699 ? r14810708 : r14810709;
        double r14810711 = r14810693 ? r14810697 : r14810710;
        return r14810711;
}

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.6
Herbie6.3
\[\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 < -7.806488284801272e+152

    1. Initial program 54.4

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

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

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

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

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

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

    if -7.806488284801272e+152 < z < 2.466136078144351e+99

    1. Initial program 11.1

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

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

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

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

    if 2.466136078144351e+99 < z

    1. Initial program 43.6

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

      \[\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 -7.806488284801272281442098142415949936998 \cdot 10^{152}:\\ \;\;\;\;\left(-y\right) \cdot x\\ \mathbf{elif}\;z \le 2.466136078144351188794958598210872238756 \cdot 10^{99}:\\ \;\;\;\;\left(\frac{z}{\sqrt{z \cdot z - t \cdot a}} \cdot y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array}\]

Reproduce

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