Average Error: 25.2 → 6.7
Time: 1.3m
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.10649338000724949433232669239319553399 \cdot 10^{111}:\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{elif}\;z \le -5.724817248923862073820996612199459744158 \cdot 10^{-277}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{z \cdot z - t \cdot a}}{z \cdot \left(y \cdot x\right)}}\\ \mathbf{elif}\;z \le 5.269881922884741006979772141958737835512 \cdot 10^{-110}:\\ \;\;\;\;x \cdot \frac{y \cdot z}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{elif}\;z \le 5.436017192620622397238815607199475065105 \cdot 10^{141}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{z}{\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 -2.10649338000724949433232669239319553399 \cdot 10^{111}:\\
\;\;\;\;\left(-x\right) \cdot y\\

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

\mathbf{elif}\;z \le 5.269881922884741006979772141958737835512 \cdot 10^{-110}:\\
\;\;\;\;x \cdot \frac{y \cdot z}{\sqrt{z \cdot z - t \cdot a}}\\

\mathbf{elif}\;z \le 5.436017192620622397238815607199475065105 \cdot 10^{141}:\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{z}{\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 r16948340 = x;
        double r16948341 = y;
        double r16948342 = r16948340 * r16948341;
        double r16948343 = z;
        double r16948344 = r16948342 * r16948343;
        double r16948345 = r16948343 * r16948343;
        double r16948346 = t;
        double r16948347 = a;
        double r16948348 = r16948346 * r16948347;
        double r16948349 = r16948345 - r16948348;
        double r16948350 = sqrt(r16948349);
        double r16948351 = r16948344 / r16948350;
        return r16948351;
}

double f(double x, double y, double z, double t, double a) {
        double r16948352 = z;
        double r16948353 = -2.1064933800072495e+111;
        bool r16948354 = r16948352 <= r16948353;
        double r16948355 = x;
        double r16948356 = -r16948355;
        double r16948357 = y;
        double r16948358 = r16948356 * r16948357;
        double r16948359 = -5.724817248923862e-277;
        bool r16948360 = r16948352 <= r16948359;
        double r16948361 = 1.0;
        double r16948362 = r16948352 * r16948352;
        double r16948363 = t;
        double r16948364 = a;
        double r16948365 = r16948363 * r16948364;
        double r16948366 = r16948362 - r16948365;
        double r16948367 = sqrt(r16948366);
        double r16948368 = r16948357 * r16948355;
        double r16948369 = r16948352 * r16948368;
        double r16948370 = r16948367 / r16948369;
        double r16948371 = r16948361 / r16948370;
        double r16948372 = 5.269881922884741e-110;
        bool r16948373 = r16948352 <= r16948372;
        double r16948374 = r16948357 * r16948352;
        double r16948375 = r16948374 / r16948367;
        double r16948376 = r16948355 * r16948375;
        double r16948377 = 5.4360171926206224e+141;
        bool r16948378 = r16948352 <= r16948377;
        double r16948379 = r16948352 / r16948367;
        double r16948380 = r16948368 * r16948379;
        double r16948381 = r16948378 ? r16948380 : r16948368;
        double r16948382 = r16948373 ? r16948376 : r16948381;
        double r16948383 = r16948360 ? r16948371 : r16948382;
        double r16948384 = r16948354 ? r16948358 : r16948383;
        return r16948384;
}

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

Original25.2
Target7.7
Herbie6.7
\[\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 5 regimes
  2. if z < -2.1064933800072495e+111

    1. Initial program 45.9

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity45.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-prod45.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-frac43.6

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot y\right)}\]
    10. Simplified1.6

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

    if -2.1064933800072495e+111 < z < -5.724817248923862e-277

    1. Initial program 10.4

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

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

    if -5.724817248923862e-277 < z < 5.269881922884741e-110

    1. Initial program 16.3

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)}\]
    9. Using strategy rm
    10. Applied associate-*r/15.3

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

    if 5.269881922884741e-110 < z < 5.4360171926206224e+141

    1. Initial program 8.1

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity8.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-prod8.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-frac4.8

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

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

    if 5.4360171926206224e+141 < z

    1. Initial program 51.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.10649338000724949433232669239319553399 \cdot 10^{111}:\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{elif}\;z \le -5.724817248923862073820996612199459744158 \cdot 10^{-277}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{z \cdot z - t \cdot a}}{z \cdot \left(y \cdot x\right)}}\\ \mathbf{elif}\;z \le 5.269881922884741006979772141958737835512 \cdot 10^{-110}:\\ \;\;\;\;x \cdot \frac{y \cdot z}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{elif}\;z \le 5.436017192620622397238815607199475065105 \cdot 10^{141}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array}\]

Reproduce

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