Average Error: 25.5 → 6.3
Time: 7.5s
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.57340581174290523 \cdot 10^{140}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 1.0315608467704857 \cdot 10^{107}:\\ \;\;\;\;\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \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.57340581174290523 \cdot 10^{140}:\\
\;\;\;\;-x \cdot y\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r404702 = x;
        double r404703 = y;
        double r404704 = r404702 * r404703;
        double r404705 = z;
        double r404706 = r404704 * r404705;
        double r404707 = r404705 * r404705;
        double r404708 = t;
        double r404709 = a;
        double r404710 = r404708 * r404709;
        double r404711 = r404707 - r404710;
        double r404712 = sqrt(r404711);
        double r404713 = r404706 / r404712;
        return r404713;
}

double f(double x, double y, double z, double t, double a) {
        double r404714 = z;
        double r404715 = -1.5734058117429052e+140;
        bool r404716 = r404714 <= r404715;
        double r404717 = x;
        double r404718 = y;
        double r404719 = r404717 * r404718;
        double r404720 = -r404719;
        double r404721 = 1.0315608467704857e+107;
        bool r404722 = r404714 <= r404721;
        double r404723 = r404714 * r404714;
        double r404724 = t;
        double r404725 = a;
        double r404726 = r404724 * r404725;
        double r404727 = r404723 - r404726;
        double r404728 = sqrt(r404727);
        double r404729 = r404728 / r404714;
        double r404730 = r404719 / r404729;
        double r404731 = r404722 ? r404730 : r404719;
        double r404732 = r404716 ? r404720 : r404731;
        return r404732;
}

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.5
Target7.6
Herbie6.3
\[\begin{array}{l} \mathbf{if}\;z \lt -3.1921305903852764 \cdot 10^{46}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \lt 5.9762681209208942 \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.5734058117429052e+140

    1. Initial program 50.9

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

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

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

    if -1.5734058117429052e+140 < z < 1.0315608467704857e+107

    1. Initial program 11.3

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied associate-/l*9.1

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied pow19.1

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

    if 1.0315608467704857e+107 < z

    1. Initial program 45.6

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied associate-/l*43.3

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied pow143.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.57340581174290523 \cdot 10^{140}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 1.0315608467704857 \cdot 10^{107}:\\ \;\;\;\;\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

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