Average Error: 24.2 → 6.2
Time: 7.7s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -8.6183547901220424 \cdot 10^{153}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 6.9260668882011419 \cdot 10^{147}:\\ \;\;\;\;y \cdot \left(x \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)\\ \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 -8.6183547901220424 \cdot 10^{153}:\\
\;\;\;\;-x \cdot y\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r53720 = x;
        double r53721 = y;
        double r53722 = r53720 * r53721;
        double r53723 = z;
        double r53724 = r53722 * r53723;
        double r53725 = r53723 * r53723;
        double r53726 = t;
        double r53727 = a;
        double r53728 = r53726 * r53727;
        double r53729 = r53725 - r53728;
        double r53730 = sqrt(r53729);
        double r53731 = r53724 / r53730;
        return r53731;
}

double f(double x, double y, double z, double t, double a) {
        double r53732 = z;
        double r53733 = -8.618354790122042e+153;
        bool r53734 = r53732 <= r53733;
        double r53735 = x;
        double r53736 = y;
        double r53737 = r53735 * r53736;
        double r53738 = -r53737;
        double r53739 = 6.926066888201142e+147;
        bool r53740 = r53732 <= r53739;
        double r53741 = r53732 * r53732;
        double r53742 = t;
        double r53743 = a;
        double r53744 = r53742 * r53743;
        double r53745 = r53741 - r53744;
        double r53746 = sqrt(r53745);
        double r53747 = r53732 / r53746;
        double r53748 = r53735 * r53747;
        double r53749 = r53736 * r53748;
        double r53750 = r53736 * r53735;
        double r53751 = r53740 ? r53749 : r53750;
        double r53752 = r53734 ? r53738 : r53751;
        return r53752;
}

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.2
Target7.7
Herbie6.2
\[\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 < -8.618354790122042e+153

    1. Initial program 54.0

      \[\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 -8.618354790122042e+153 < z < 6.926066888201142e+147

    1. Initial program 11.2

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

      \[\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.2

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

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

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

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

    if 6.926066888201142e+147 < z

    1. Initial program 51.6

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

      \[\leadsto \color{blue}{x \cdot y}\]
    3. Simplified1.2

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

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

Reproduce

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