Average Error: 24.9 → 8.1
Time: 21.4s
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:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \le 10.24214518159790365814387769205495715141:\\ \;\;\;\;\left(z \cdot \frac{y}{\frac{\left|\sqrt[3]{z \cdot z - t \cdot a}\right|}{x}}\right) \cdot \frac{1}{\sqrt{\sqrt[3]{z \cdot z - t \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\mathsf{fma}\left(\frac{-1}{2}, \frac{a}{\frac{z}{t}}, z\right)} \cdot \left(y \cdot x\right)\\ \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:\\
\;\;\;\;y \cdot \left(-x\right)\\

\mathbf{elif}\;z \le 10.24214518159790365814387769205495715141:\\
\;\;\;\;\left(z \cdot \frac{y}{\frac{\left|\sqrt[3]{z \cdot z - t \cdot a}\right|}{x}}\right) \cdot \frac{1}{\sqrt{\sqrt[3]{z \cdot z - t \cdot a}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{z}{\mathsf{fma}\left(\frac{-1}{2}, \frac{a}{\frac{z}{t}}, z\right)} \cdot \left(y \cdot x\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r14410321 = x;
        double r14410322 = y;
        double r14410323 = r14410321 * r14410322;
        double r14410324 = z;
        double r14410325 = r14410323 * r14410324;
        double r14410326 = r14410324 * r14410324;
        double r14410327 = t;
        double r14410328 = a;
        double r14410329 = r14410327 * r14410328;
        double r14410330 = r14410326 - r14410329;
        double r14410331 = sqrt(r14410330);
        double r14410332 = r14410325 / r14410331;
        return r14410332;
}

double f(double x, double y, double z, double t, double a) {
        double r14410333 = z;
        double r14410334 = -6.395336884503867e+42;
        bool r14410335 = r14410333 <= r14410334;
        double r14410336 = y;
        double r14410337 = x;
        double r14410338 = -r14410337;
        double r14410339 = r14410336 * r14410338;
        double r14410340 = 10.242145181597904;
        bool r14410341 = r14410333 <= r14410340;
        double r14410342 = r14410333 * r14410333;
        double r14410343 = t;
        double r14410344 = a;
        double r14410345 = r14410343 * r14410344;
        double r14410346 = r14410342 - r14410345;
        double r14410347 = cbrt(r14410346);
        double r14410348 = fabs(r14410347);
        double r14410349 = r14410348 / r14410337;
        double r14410350 = r14410336 / r14410349;
        double r14410351 = r14410333 * r14410350;
        double r14410352 = 1.0;
        double r14410353 = sqrt(r14410347);
        double r14410354 = r14410352 / r14410353;
        double r14410355 = r14410351 * r14410354;
        double r14410356 = -0.5;
        double r14410357 = r14410333 / r14410343;
        double r14410358 = r14410344 / r14410357;
        double r14410359 = fma(r14410356, r14410358, r14410333);
        double r14410360 = r14410333 / r14410359;
        double r14410361 = r14410336 * r14410337;
        double r14410362 = r14410360 * r14410361;
        double r14410363 = r14410341 ? r14410355 : r14410362;
        double r14410364 = r14410335 ? r14410339 : r14410363;
        return r14410364;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.9
Target7.9
Herbie8.1
\[\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. Taylor expanded around -inf 4.0

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

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

    if -6.395336884503867e+42 < z < 10.242145181597904

    1. Initial program 12.1

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

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

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

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

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

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

      \[\leadsto \left(y \cdot x\right) \cdot \frac{z}{\color{blue}{\sqrt{\sqrt[3]{z \cdot z - t \cdot a} \cdot \sqrt[3]{z \cdot z - t \cdot a}} \cdot \sqrt{\sqrt[3]{z \cdot z - t \cdot a}}}}\]
    10. Applied *-un-lft-identity11.8

      \[\leadsto \left(y \cdot x\right) \cdot \frac{\color{blue}{1 \cdot z}}{\sqrt{\sqrt[3]{z \cdot z - t \cdot a} \cdot \sqrt[3]{z \cdot z - t \cdot a}} \cdot \sqrt{\sqrt[3]{z \cdot z - t \cdot a}}}\]
    11. Applied times-frac11.8

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

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

      \[\leadsto \color{blue}{\frac{y}{\frac{\left|\sqrt[3]{z \cdot z - t \cdot a}\right|}{x}}} \cdot \frac{z}{\sqrt{\sqrt[3]{z \cdot z - t \cdot a}}}\]
    14. Using strategy rm
    15. Applied div-inv12.6

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

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

    if 10.242145181597904 < z

    1. Initial program 32.9

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

      \[\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-prod32.9

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

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

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

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

      \[\leadsto \left(y \cdot x\right) \cdot \frac{z}{\color{blue}{\mathsf{fma}\left(\frac{-1}{2}, \frac{a}{\frac{z}{t}}, z\right)}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification8.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -6395336884503866936309996195044608815661000:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \le 10.24214518159790365814387769205495715141:\\ \;\;\;\;\left(z \cdot \frac{y}{\frac{\left|\sqrt[3]{z \cdot z - t \cdot a}\right|}{x}}\right) \cdot \frac{1}{\sqrt{\sqrt[3]{z \cdot z - t \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\mathsf{fma}\left(\frac{-1}{2}, \frac{a}{\frac{z}{t}}, z\right)} \cdot \left(y \cdot x\right)\\ \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)))))