Average Error: 24.9 → 7.2
Time: 19.2s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -6395336884503866936309996195044608815661000:\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{elif}\;z \le 7.643275720107879512063854532156486714456 \cdot 10^{117}:\\ \;\;\;\;\sqrt[3]{\frac{x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}} \cdot \left(\frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}} \cdot \left(\sqrt[3]{\frac{x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}} \cdot \left(y \cdot \sqrt[3]{\frac{x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}}\right)\right)\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 -6395336884503866936309996195044608815661000:\\
\;\;\;\;\left(-x\right) \cdot y\\

\mathbf{elif}\;z \le 7.643275720107879512063854532156486714456 \cdot 10^{117}:\\
\;\;\;\;\sqrt[3]{\frac{x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}} \cdot \left(\frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}} \cdot \left(\sqrt[3]{\frac{x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}} \cdot \left(y \cdot \sqrt[3]{\frac{x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}}\right)\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r217425 = x;
        double r217426 = y;
        double r217427 = r217425 * r217426;
        double r217428 = z;
        double r217429 = r217427 * r217428;
        double r217430 = r217428 * r217428;
        double r217431 = t;
        double r217432 = a;
        double r217433 = r217431 * r217432;
        double r217434 = r217430 - r217433;
        double r217435 = sqrt(r217434);
        double r217436 = r217429 / r217435;
        return r217436;
}

double f(double x, double y, double z, double t, double a) {
        double r217437 = z;
        double r217438 = -6.395336884503867e+42;
        bool r217439 = r217437 <= r217438;
        double r217440 = x;
        double r217441 = -r217440;
        double r217442 = y;
        double r217443 = r217441 * r217442;
        double r217444 = 7.64327572010788e+117;
        bool r217445 = r217437 <= r217444;
        double r217446 = r217437 * r217437;
        double r217447 = t;
        double r217448 = a;
        double r217449 = r217447 * r217448;
        double r217450 = r217446 - r217449;
        double r217451 = sqrt(r217450);
        double r217452 = sqrt(r217451);
        double r217453 = r217440 / r217452;
        double r217454 = cbrt(r217453);
        double r217455 = r217437 / r217452;
        double r217456 = r217442 * r217454;
        double r217457 = r217454 * r217456;
        double r217458 = r217455 * r217457;
        double r217459 = r217454 * r217458;
        double r217460 = r217442 * r217440;
        double r217461 = r217445 ? r217459 : r217460;
        double r217462 = r217439 ? r217443 : r217461;
        return r217462;
}

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.9
Target7.9
Herbie7.2
\[\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 < -6.395336884503867e+42

    1. Initial program 37.0

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Simplified37.3

      \[\leadsto \color{blue}{\frac{z \cdot y}{\sqrt{\mathsf{fma}\left(z, z, -a \cdot t\right)}} \cdot x}\]
    3. Taylor expanded around -inf 4.0

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

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

    if -6.395336884503867e+42 < z < 7.64327572010788e+117

    1. Initial program 11.5

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Simplified11.2

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

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

      \[\leadsto \frac{z \cdot y}{\color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(z, z, -a \cdot t\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(z, z, -a \cdot t\right)}}}} \cdot x\]
    6. Applied associate-/r*11.4

      \[\leadsto \color{blue}{\frac{\frac{z \cdot y}{\sqrt{\sqrt{\mathsf{fma}\left(z, z, -a \cdot t\right)}}}}{\sqrt{\sqrt{\mathsf{fma}\left(z, z, -a \cdot t\right)}}}} \cdot x\]
    7. Simplified10.4

      \[\leadsto \frac{\color{blue}{\frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}} \cdot y}}{\sqrt{\sqrt{\mathsf{fma}\left(z, z, -a \cdot t\right)}}} \cdot x\]
    8. Using strategy rm
    9. Applied div-inv10.4

      \[\leadsto \color{blue}{\left(\left(\frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}} \cdot y\right) \cdot \frac{1}{\sqrt{\sqrt{\mathsf{fma}\left(z, z, -a \cdot t\right)}}}\right)} \cdot x\]
    10. Applied associate-*l*10.8

      \[\leadsto \color{blue}{\left(\frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}} \cdot y\right) \cdot \left(\frac{1}{\sqrt{\sqrt{\mathsf{fma}\left(z, z, -a \cdot t\right)}}} \cdot x\right)}\]
    11. Simplified10.8

      \[\leadsto \left(\frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}} \cdot y\right) \cdot \color{blue}{\frac{x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}}\]
    12. Using strategy rm
    13. Applied add-cube-cbrt11.2

      \[\leadsto \left(\frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}} \cdot y\right) \cdot \color{blue}{\left(\left(\sqrt[3]{\frac{x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}} \cdot \sqrt[3]{\frac{x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}}\right) \cdot \sqrt[3]{\frac{x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}}\right)}\]
    14. Applied associate-*r*11.2

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

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

    if 7.64327572010788e+117 < z

    1. Initial program 46.6

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Simplified46.7

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

      \[\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 -6395336884503866936309996195044608815661000:\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{elif}\;z \le 7.643275720107879512063854532156486714456 \cdot 10^{117}:\\ \;\;\;\;\sqrt[3]{\frac{x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}} \cdot \left(\frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}} \cdot \left(\sqrt[3]{\frac{x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}} \cdot \left(y \cdot \sqrt[3]{\frac{x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array}\]

Reproduce

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