Average Error: 25.1 → 6.1
Time: 17.0s
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}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \le 2.818827562843424905673562246640834606804 \cdot 10^{156}:\\ \;\;\;\;y \cdot \left(x \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)\\ \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 -5.199714169449318426725790466332778930458 \cdot 10^{116}:\\
\;\;\;\;y \cdot \left(-x\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r335169 = x;
        double r335170 = y;
        double r335171 = r335169 * r335170;
        double r335172 = z;
        double r335173 = r335171 * r335172;
        double r335174 = r335172 * r335172;
        double r335175 = t;
        double r335176 = a;
        double r335177 = r335175 * r335176;
        double r335178 = r335174 - r335177;
        double r335179 = sqrt(r335178);
        double r335180 = r335173 / r335179;
        return r335180;
}

double f(double x, double y, double z, double t, double a) {
        double r335181 = z;
        double r335182 = -5.1997141694493184e+116;
        bool r335183 = r335181 <= r335182;
        double r335184 = y;
        double r335185 = x;
        double r335186 = -r335185;
        double r335187 = r335184 * r335186;
        double r335188 = 2.818827562843425e+156;
        bool r335189 = r335181 <= r335188;
        double r335190 = r335181 * r335181;
        double r335191 = t;
        double r335192 = a;
        double r335193 = r335191 * r335192;
        double r335194 = r335190 - r335193;
        double r335195 = sqrt(r335194);
        double r335196 = r335181 / r335195;
        double r335197 = r335185 * r335196;
        double r335198 = r335184 * r335197;
        double r335199 = r335184 * r335185;
        double r335200 = r335189 ? r335198 : r335199;
        double r335201 = r335183 ? r335187 : r335200;
        return r335201;
}

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.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(y \cdot x\right)} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\]
    7. Using strategy rm
    8. Applied associate-*l*45.7

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

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

      \[\leadsto y \cdot \color{blue}{\left(-x\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(y \cdot x\right)} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\]
    7. Using strategy rm
    8. Applied associate-*l*8.6

      \[\leadsto \color{blue}{y \cdot \left(x \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. Using strategy rm
    3. Applied *-un-lft-identity54.8

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019322 +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)))))