Average Error: 24.1 → 7.1
Time: 5.3s
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.1613085318430635 \cdot 10^{146}:\\ \;\;\;\;-1 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;z \le -1.15287383592906728 \cdot 10^{-189}:\\ \;\;\;\;\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \mathbf{elif}\;z \le 1.26365548077316353 \cdot 10^{101}:\\ \;\;\;\;\frac{x}{\sqrt{z \cdot z - t \cdot a}} \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot 1\\ \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.1613085318430635 \cdot 10^{146}:\\
\;\;\;\;-1 \cdot \left(x \cdot y\right)\\

\mathbf{elif}\;z \le -1.15287383592906728 \cdot 10^{-189}:\\
\;\;\;\;\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\

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

\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot 1\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r299305 = x;
        double r299306 = y;
        double r299307 = r299305 * r299306;
        double r299308 = z;
        double r299309 = r299307 * r299308;
        double r299310 = r299308 * r299308;
        double r299311 = t;
        double r299312 = a;
        double r299313 = r299311 * r299312;
        double r299314 = r299310 - r299313;
        double r299315 = sqrt(r299314);
        double r299316 = r299309 / r299315;
        return r299316;
}

double f(double x, double y, double z, double t, double a) {
        double r299317 = z;
        double r299318 = -1.1613085318430635e+146;
        bool r299319 = r299317 <= r299318;
        double r299320 = -1.0;
        double r299321 = x;
        double r299322 = y;
        double r299323 = r299321 * r299322;
        double r299324 = r299320 * r299323;
        double r299325 = -1.1528738359290673e-189;
        bool r299326 = r299317 <= r299325;
        double r299327 = r299317 * r299317;
        double r299328 = t;
        double r299329 = a;
        double r299330 = r299328 * r299329;
        double r299331 = r299327 - r299330;
        double r299332 = sqrt(r299331);
        double r299333 = r299332 / r299317;
        double r299334 = r299323 / r299333;
        double r299335 = 1.2636554807731635e+101;
        bool r299336 = r299317 <= r299335;
        double r299337 = r299321 / r299332;
        double r299338 = r299317 * r299322;
        double r299339 = r299337 * r299338;
        double r299340 = 1.0;
        double r299341 = r299323 * r299340;
        double r299342 = r299336 ? r299339 : r299341;
        double r299343 = r299326 ? r299334 : r299342;
        double r299344 = r299319 ? r299324 : r299343;
        return r299344;
}

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.1
Target8.1
Herbie7.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 4 regimes
  2. if z < -1.1613085318430635e+146

    1. Initial program 51.0

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied associate-/l*50.1

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt50.1

      \[\leadsto \frac{x \cdot y}{\frac{\sqrt{\color{blue}{\sqrt{z \cdot z - t \cdot a} \cdot \sqrt{z \cdot z - t \cdot a}}}}{z}}\]
    6. Applied sqrt-prod50.2

      \[\leadsto \frac{x \cdot y}{\frac{\color{blue}{\sqrt{\sqrt{z \cdot z - t \cdot a}} \cdot \sqrt{\sqrt{z \cdot z - t \cdot a}}}}{z}}\]
    7. Taylor expanded around -inf 1.6

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

    if -1.1613085318430635e+146 < z < -1.1528738359290673e-189

    1. Initial program 8.7

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied associate-/l*5.4

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

    if -1.1528738359290673e-189 < z < 1.2636554807731635e+101

    1. Initial program 13.0

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied associate-/l*12.4

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied div-inv12.5

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

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

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

    if 1.2636554807731635e+101 < z

    1. Initial program 43.2

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied associate-/l*41.1

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied div-inv41.1

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

      \[\leadsto \left(x \cdot y\right) \cdot \color{blue}{1}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification7.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.1613085318430635 \cdot 10^{146}:\\ \;\;\;\;-1 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;z \le -1.15287383592906728 \cdot 10^{-189}:\\ \;\;\;\;\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \mathbf{elif}\;z \le 1.26365548077316353 \cdot 10^{101}:\\ \;\;\;\;\frac{x}{\sqrt{z \cdot z - t \cdot a}} \cdot \left(z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot 1\\ \end{array}\]

Reproduce

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