Average Error: 24.7 → 7.2
Time: 18.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 -1.3605793930191254 \cdot 10^{+75}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 4.645470841311438 \cdot 10^{+110}:\\ \;\;\;\;\left(\frac{y}{\sqrt{\sqrt{\sqrt{z \cdot z - t \cdot a}}}} \cdot \frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}\right) \cdot \frac{x}{\sqrt{\sqrt{\sqrt{z \cdot z - t \cdot a}}}}\\ \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.3605793930191254 \cdot 10^{+75}:\\
\;\;\;\;x \cdot \left(-y\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r14023328 = x;
        double r14023329 = y;
        double r14023330 = r14023328 * r14023329;
        double r14023331 = z;
        double r14023332 = r14023330 * r14023331;
        double r14023333 = r14023331 * r14023331;
        double r14023334 = t;
        double r14023335 = a;
        double r14023336 = r14023334 * r14023335;
        double r14023337 = r14023333 - r14023336;
        double r14023338 = sqrt(r14023337);
        double r14023339 = r14023332 / r14023338;
        return r14023339;
}

double f(double x, double y, double z, double t, double a) {
        double r14023340 = z;
        double r14023341 = -1.3605793930191254e+75;
        bool r14023342 = r14023340 <= r14023341;
        double r14023343 = x;
        double r14023344 = y;
        double r14023345 = -r14023344;
        double r14023346 = r14023343 * r14023345;
        double r14023347 = 4.645470841311438e+110;
        bool r14023348 = r14023340 <= r14023347;
        double r14023349 = r14023340 * r14023340;
        double r14023350 = t;
        double r14023351 = a;
        double r14023352 = r14023350 * r14023351;
        double r14023353 = r14023349 - r14023352;
        double r14023354 = sqrt(r14023353);
        double r14023355 = sqrt(r14023354);
        double r14023356 = sqrt(r14023355);
        double r14023357 = r14023344 / r14023356;
        double r14023358 = r14023340 / r14023355;
        double r14023359 = r14023357 * r14023358;
        double r14023360 = r14023343 / r14023356;
        double r14023361 = r14023359 * r14023360;
        double r14023362 = r14023343 * r14023344;
        double r14023363 = r14023348 ? r14023361 : r14023362;
        double r14023364 = r14023342 ? r14023346 : r14023363;
        return r14023364;
}

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
Herbie7.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.3605793930191254e+75

    1. Initial program 40.4

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

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

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

    if -1.3605793930191254e+75 < z < 4.645470841311438e+110

    1. Initial program 11.2

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt11.2

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

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

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

      \[\leadsto \frac{x \cdot y}{\sqrt{\sqrt{\color{blue}{\sqrt{z \cdot z - t \cdot a} \cdot \sqrt{z \cdot z - t \cdot a}}}}} \cdot \frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}\]
    8. Applied sqrt-prod10.5

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{\sqrt{\sqrt{z \cdot z - t \cdot a}}} \cdot \sqrt{\sqrt{\sqrt{z \cdot z - t \cdot a}}}}} \cdot \frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}\]
    10. Applied times-frac10.8

      \[\leadsto \color{blue}{\left(\frac{x}{\sqrt{\sqrt{\sqrt{z \cdot z - t \cdot a}}}} \cdot \frac{y}{\sqrt{\sqrt{\sqrt{z \cdot z - t \cdot a}}}}\right)} \cdot \frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}\]
    11. Applied associate-*l*10.5

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

    if 4.645470841311438e+110 < z

    1. Initial program 46.5

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

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

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

Reproduce

herbie shell --seed 2019162 +o rules:numerics
(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)))))