Average Error: 25.1 → 6.0
Time: 5.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 -5.199714169449318426725790466332778930458 \cdot 10^{116}:\\ \;\;\;\;x \cdot \left(-1 \cdot y\right)\\ \mathbf{elif}\;z \le 2.818827562843424905673562246640834606804 \cdot 10^{156}:\\ \;\;\;\;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 -5.199714169449318426725790466332778930458 \cdot 10^{116}:\\
\;\;\;\;x \cdot \left(-1 \cdot y\right)\\

\mathbf{elif}\;z \le 2.818827562843424905673562246640834606804 \cdot 10^{156}:\\
\;\;\;\;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 r288044 = x;
        double r288045 = y;
        double r288046 = r288044 * r288045;
        double r288047 = z;
        double r288048 = r288046 * r288047;
        double r288049 = r288047 * r288047;
        double r288050 = t;
        double r288051 = a;
        double r288052 = r288050 * r288051;
        double r288053 = r288049 - r288052;
        double r288054 = sqrt(r288053);
        double r288055 = r288048 / r288054;
        return r288055;
}

double f(double x, double y, double z, double t, double a) {
        double r288056 = z;
        double r288057 = -5.1997141694493184e+116;
        bool r288058 = r288056 <= r288057;
        double r288059 = x;
        double r288060 = -1.0;
        double r288061 = y;
        double r288062 = r288060 * r288061;
        double r288063 = r288059 * r288062;
        double r288064 = 2.818827562843425e+156;
        bool r288065 = r288056 <= r288064;
        double r288066 = r288056 * r288056;
        double r288067 = t;
        double r288068 = a;
        double r288069 = r288067 * r288068;
        double r288070 = r288066 - r288069;
        double r288071 = sqrt(r288070);
        double r288072 = r288056 / r288071;
        double r288073 = r288061 * r288072;
        double r288074 = r288059 * r288073;
        double r288075 = r288059 * r288061;
        double r288076 = r288065 ? r288074 : r288075;
        double r288077 = r288058 ? r288063 : r288076;
        return r288077;
}

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.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 < -5.1997141694493184e+116

    1. Initial program 47.7

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

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

      \[\leadsto \frac{\left(x \cdot y\right) \cdot z}{\color{blue}{\sqrt{1} \cdot \sqrt{z \cdot z - t \cdot a}}}\]
    5. Applied times-frac45.7

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

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

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

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

    if -5.1997141694493184e+116 < z < 2.818827562843425e+156

    1. Initial program 10.9

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

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

      \[\leadsto \frac{\left(x \cdot y\right) \cdot z}{\color{blue}{\sqrt{1} \cdot \sqrt{z \cdot z - t \cdot a}}}\]
    5. Applied times-frac8.7

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

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

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

    if 2.818827562843425e+156 < z

    1. Initial program 54.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -5.199714169449318426725790466332778930458 \cdot 10^{116}:\\ \;\;\;\;x \cdot \left(-1 \cdot y\right)\\ \mathbf{elif}\;z \le 2.818827562843424905673562246640834606804 \cdot 10^{156}:\\ \;\;\;\;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 2019322 
(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.1921305903852764e46) (- (* y x)) (if (< z 5.9762681209208942e90) (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y)) (* y x)))

  (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))