Average Error: 26.1 → 7.6
Time: 15.6s
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.856034384511207531410976595340573048785 \cdot 10^{93}:\\ \;\;\;\;-1 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;z \le 1.184378054686837267630111174241026195347 \cdot 10^{97}:\\ \;\;\;\;\left(\left(x \cdot y\right) \cdot z\right) \cdot \frac{1}{\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.856034384511207531410976595340573048785 \cdot 10^{93}:\\
\;\;\;\;-1 \cdot \left(x \cdot y\right)\\

\mathbf{elif}\;z \le 1.184378054686837267630111174241026195347 \cdot 10^{97}:\\
\;\;\;\;\left(\left(x \cdot y\right) \cdot z\right) \cdot \frac{1}{\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 r217228 = x;
        double r217229 = y;
        double r217230 = r217228 * r217229;
        double r217231 = z;
        double r217232 = r217230 * r217231;
        double r217233 = r217231 * r217231;
        double r217234 = t;
        double r217235 = a;
        double r217236 = r217234 * r217235;
        double r217237 = r217233 - r217236;
        double r217238 = sqrt(r217237);
        double r217239 = r217232 / r217238;
        return r217239;
}

double f(double x, double y, double z, double t, double a) {
        double r217240 = z;
        double r217241 = -1.8560343845112075e+93;
        bool r217242 = r217240 <= r217241;
        double r217243 = -1.0;
        double r217244 = x;
        double r217245 = y;
        double r217246 = r217244 * r217245;
        double r217247 = r217243 * r217246;
        double r217248 = 1.1843780546868373e+97;
        bool r217249 = r217240 <= r217248;
        double r217250 = r217246 * r217240;
        double r217251 = 1.0;
        double r217252 = r217240 * r217240;
        double r217253 = t;
        double r217254 = a;
        double r217255 = r217253 * r217254;
        double r217256 = r217252 - r217255;
        double r217257 = sqrt(r217256);
        double r217258 = r217251 / r217257;
        double r217259 = r217250 * r217258;
        double r217260 = r217249 ? r217259 : r217246;
        double r217261 = r217242 ? r217247 : r217260;
        return r217261;
}

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

Original26.1
Target7.7
Herbie7.6
\[\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.8560343845112075e+93

    1. Initial program 44.3

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

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

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

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

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

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

    if -1.8560343845112075e+93 < z < 1.1843780546868373e+97

    1. Initial program 11.6

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

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

    if 1.1843780546868373e+97 < z

    1. Initial program 44.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.856034384511207531410976595340573048785 \cdot 10^{93}:\\ \;\;\;\;-1 \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;z \le 1.184378054686837267630111174241026195347 \cdot 10^{97}:\\ \;\;\;\;\left(\left(x \cdot y\right) \cdot z\right) \cdot \frac{1}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 2019297 
(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)))))