Average Error: 23.8 → 5.9
Time: 17.7s
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.8913959868564195 \cdot 10^{+154}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 1.1848486164183457 \cdot 10^{+114}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \left(z \cdot \frac{1}{\sqrt{z \cdot z - a \cdot t}}\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 -1.8913959868564195 \cdot 10^{+154}:\\
\;\;\;\;-x \cdot y\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r15071422 = x;
        double r15071423 = y;
        double r15071424 = r15071422 * r15071423;
        double r15071425 = z;
        double r15071426 = r15071424 * r15071425;
        double r15071427 = r15071425 * r15071425;
        double r15071428 = t;
        double r15071429 = a;
        double r15071430 = r15071428 * r15071429;
        double r15071431 = r15071427 - r15071430;
        double r15071432 = sqrt(r15071431);
        double r15071433 = r15071426 / r15071432;
        return r15071433;
}

double f(double x, double y, double z, double t, double a) {
        double r15071434 = z;
        double r15071435 = -1.8913959868564195e+154;
        bool r15071436 = r15071434 <= r15071435;
        double r15071437 = x;
        double r15071438 = y;
        double r15071439 = r15071437 * r15071438;
        double r15071440 = -r15071439;
        double r15071441 = 1.1848486164183457e+114;
        bool r15071442 = r15071434 <= r15071441;
        double r15071443 = 1.0;
        double r15071444 = r15071434 * r15071434;
        double r15071445 = a;
        double r15071446 = t;
        double r15071447 = r15071445 * r15071446;
        double r15071448 = r15071444 - r15071447;
        double r15071449 = sqrt(r15071448);
        double r15071450 = r15071443 / r15071449;
        double r15071451 = r15071434 * r15071450;
        double r15071452 = r15071439 * r15071451;
        double r15071453 = r15071442 ? r15071452 : r15071439;
        double r15071454 = r15071436 ? r15071440 : r15071453;
        return r15071454;
}

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

Original23.8
Target7.6
Herbie5.9
\[\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.8913959868564195e+154

    1. Initial program 53.3

      \[\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}{-1 \cdot \left(x \cdot y\right)}\]
    3. Simplified1.3

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

    if -1.8913959868564195e+154 < z < 1.1848486164183457e+114

    1. Initial program 10.2

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

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

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

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

      \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\]
    7. Using strategy rm
    8. Applied div-inv8.2

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

    if 1.1848486164183457e+114 < z

    1. Initial program 45.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.8913959868564195 \cdot 10^{+154}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 1.1848486164183457 \cdot 10^{+114}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \left(z \cdot \frac{1}{\sqrt{z \cdot z - a \cdot t}}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

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