Average Error: 24.6 → 7.9
Time: 13.0s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.603369414995160960353922152048984349949 \cdot 10^{90}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 1.292716185531284079912157099666096901234 \cdot 10^{-12}:\\ \;\;\;\;\frac{x \cdot \left(z \cdot y\right)}{\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 -3.603369414995160960353922152048984349949 \cdot 10^{90}:\\
\;\;\;\;-x \cdot y\\

\mathbf{elif}\;z \le 1.292716185531284079912157099666096901234 \cdot 10^{-12}:\\
\;\;\;\;\frac{x \cdot \left(z \cdot y\right)}{\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 r177076 = x;
        double r177077 = y;
        double r177078 = r177076 * r177077;
        double r177079 = z;
        double r177080 = r177078 * r177079;
        double r177081 = r177079 * r177079;
        double r177082 = t;
        double r177083 = a;
        double r177084 = r177082 * r177083;
        double r177085 = r177081 - r177084;
        double r177086 = sqrt(r177085);
        double r177087 = r177080 / r177086;
        return r177087;
}

double f(double x, double y, double z, double t, double a) {
        double r177088 = z;
        double r177089 = -3.603369414995161e+90;
        bool r177090 = r177088 <= r177089;
        double r177091 = x;
        double r177092 = y;
        double r177093 = r177091 * r177092;
        double r177094 = -r177093;
        double r177095 = 1.292716185531284e-12;
        bool r177096 = r177088 <= r177095;
        double r177097 = r177088 * r177092;
        double r177098 = r177091 * r177097;
        double r177099 = r177088 * r177088;
        double r177100 = t;
        double r177101 = a;
        double r177102 = r177100 * r177101;
        double r177103 = r177099 - r177102;
        double r177104 = sqrt(r177103);
        double r177105 = r177098 / r177104;
        double r177106 = r177096 ? r177105 : r177093;
        double r177107 = r177090 ? r177094 : r177106;
        return r177107;
}

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.6
Target7.3
Herbie7.9
\[\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 < -3.603369414995161e+90

    1. Initial program 42.5

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

      \[\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-prod42.5

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot y\right)}\]
    8. Simplified2.5

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

    if -3.603369414995161e+90 < z < 1.292716185531284e-12

    1. Initial program 11.4

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

      \[\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-prod11.4

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

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

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

    if 1.292716185531284e-12 < z

    1. Initial program 31.8

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

      \[\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-prod31.8

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

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

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

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

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

Reproduce

herbie shell --seed 2019305 +o rules:numerics
(FPCore (x y z t a)
  :name "Statistics.Math.RootFinding:ridders from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (if (< z -3.1921305903852764e46) (- (* y x)) (if (< z 5.9762681209208942e90) (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y)) (* y x)))

  (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))