Average Error: 24.8 → 7.4
Time: 19.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.3631090406228963 \cdot 10^{+19}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 3.3038276235904442 \cdot 10^{+103}:\\ \;\;\;\;\frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}} \cdot \frac{y \cdot x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}\\ \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 -1.3631090406228963 \cdot 10^{+19}:\\
\;\;\;\;x \cdot \left(-y\right)\\

\mathbf{elif}\;z \le 3.3038276235904442 \cdot 10^{+103}:\\
\;\;\;\;\frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}} \cdot \frac{y \cdot x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r16884511 = x;
        double r16884512 = y;
        double r16884513 = r16884511 * r16884512;
        double r16884514 = z;
        double r16884515 = r16884513 * r16884514;
        double r16884516 = r16884514 * r16884514;
        double r16884517 = t;
        double r16884518 = a;
        double r16884519 = r16884517 * r16884518;
        double r16884520 = r16884516 - r16884519;
        double r16884521 = sqrt(r16884520);
        double r16884522 = r16884515 / r16884521;
        return r16884522;
}

double f(double x, double y, double z, double t, double a) {
        double r16884523 = z;
        double r16884524 = -1.3631090406228963e+19;
        bool r16884525 = r16884523 <= r16884524;
        double r16884526 = x;
        double r16884527 = y;
        double r16884528 = -r16884527;
        double r16884529 = r16884526 * r16884528;
        double r16884530 = 3.3038276235904442e+103;
        bool r16884531 = r16884523 <= r16884530;
        double r16884532 = r16884523 * r16884523;
        double r16884533 = t;
        double r16884534 = a;
        double r16884535 = r16884533 * r16884534;
        double r16884536 = r16884532 - r16884535;
        double r16884537 = sqrt(r16884536);
        double r16884538 = sqrt(r16884537);
        double r16884539 = r16884523 / r16884538;
        double r16884540 = r16884527 * r16884526;
        double r16884541 = r16884540 / r16884538;
        double r16884542 = r16884539 * r16884541;
        double r16884543 = r16884531 ? r16884542 : r16884540;
        double r16884544 = r16884525 ? r16884529 : r16884543;
        return r16884544;
}

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.8
Target7.9
Herbie7.4
\[\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.3631090406228963e+19

    1. Initial program 34.1

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

      \[\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-prod34.3

      \[\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-frac33.0

      \[\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. Taylor expanded around -inf 4.0

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

      \[\leadsto \color{blue}{-y \cdot x}\]

    if -1.3631090406228963e+19 < z < 3.3038276235904442e+103

    1. Initial program 12.0

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

      \[\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-prod12.1

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

      \[\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}}}}\]

    if 3.3038276235904442e+103 < z

    1. Initial program 44.4

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

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

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

Reproduce

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