Average Error: 25.7 → 7.0
Time: 22.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.631171194470569263954315566738703264937 \cdot 10^{164}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 5.492884630545356229744608925100127963585 \cdot 10^{148}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\\ \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.631171194470569263954315566738703264937 \cdot 10^{164}:\\
\;\;\;\;-x \cdot y\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r20214438 = x;
        double r20214439 = y;
        double r20214440 = r20214438 * r20214439;
        double r20214441 = z;
        double r20214442 = r20214440 * r20214441;
        double r20214443 = r20214441 * r20214441;
        double r20214444 = t;
        double r20214445 = a;
        double r20214446 = r20214444 * r20214445;
        double r20214447 = r20214443 - r20214446;
        double r20214448 = sqrt(r20214447);
        double r20214449 = r20214442 / r20214448;
        return r20214449;
}

double f(double x, double y, double z, double t, double a) {
        double r20214450 = z;
        double r20214451 = -1.6311711944705693e+164;
        bool r20214452 = r20214450 <= r20214451;
        double r20214453 = x;
        double r20214454 = y;
        double r20214455 = r20214453 * r20214454;
        double r20214456 = -r20214455;
        double r20214457 = 5.492884630545356e+148;
        bool r20214458 = r20214450 <= r20214457;
        double r20214459 = r20214450 * r20214450;
        double r20214460 = t;
        double r20214461 = a;
        double r20214462 = r20214460 * r20214461;
        double r20214463 = r20214459 - r20214462;
        double r20214464 = sqrt(r20214463);
        double r20214465 = r20214450 / r20214464;
        double r20214466 = r20214455 * r20214465;
        double r20214467 = r20214458 ? r20214466 : r20214455;
        double r20214468 = r20214452 ? r20214456 : r20214467;
        return r20214468;
}

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.7
Target8.1
Herbie7.0
\[\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 < -1.6311711944705693e+164

    1. Initial program 53.5

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

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

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

    if -1.6311711944705693e+164 < z < 5.492884630545356e+148

    1. Initial program 12.3

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

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

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

    if 5.492884630545356e+148 < z

    1. Initial program 53.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.631171194470569263954315566738703264937 \cdot 10^{164}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 5.492884630545356229744608925100127963585 \cdot 10^{148}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

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