Average Error: 24.4 → 6.1
Time: 15.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 -1.387037513954152204793629697523518119099 \cdot 10^{152}:\\ \;\;\;\;\frac{x \cdot y}{-1}\\ \mathbf{elif}\;z \le 2.81109844001032311849514459419925746028 \cdot 10^{123}:\\ \;\;\;\;x \cdot \frac{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.387037513954152204793629697523518119099 \cdot 10^{152}:\\
\;\;\;\;\frac{x \cdot y}{-1}\\

\mathbf{elif}\;z \le 2.81109844001032311849514459419925746028 \cdot 10^{123}:\\
\;\;\;\;x \cdot \frac{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 r215835 = x;
        double r215836 = y;
        double r215837 = r215835 * r215836;
        double r215838 = z;
        double r215839 = r215837 * r215838;
        double r215840 = r215838 * r215838;
        double r215841 = t;
        double r215842 = a;
        double r215843 = r215841 * r215842;
        double r215844 = r215840 - r215843;
        double r215845 = sqrt(r215844);
        double r215846 = r215839 / r215845;
        return r215846;
}

double f(double x, double y, double z, double t, double a) {
        double r215847 = z;
        double r215848 = -1.3870375139541522e+152;
        bool r215849 = r215847 <= r215848;
        double r215850 = x;
        double r215851 = y;
        double r215852 = r215850 * r215851;
        double r215853 = -1.0;
        double r215854 = r215852 / r215853;
        double r215855 = 2.811098440010323e+123;
        bool r215856 = r215847 <= r215855;
        double r215857 = r215847 * r215847;
        double r215858 = t;
        double r215859 = a;
        double r215860 = r215858 * r215859;
        double r215861 = r215857 - r215860;
        double r215862 = sqrt(r215861);
        double r215863 = r215862 / r215847;
        double r215864 = r215851 / r215863;
        double r215865 = r215850 * r215864;
        double r215866 = r215856 ? r215865 : r215852;
        double r215867 = r215849 ? r215854 : r215866;
        return r215867;
}

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.4
Target7.5
Herbie6.1
\[\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.3870375139541522e+152

    1. Initial program 52.5

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

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

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

      \[\leadsto \frac{x \cdot y}{\frac{\color{blue}{\sqrt{1} \cdot \sqrt{z \cdot z - t \cdot a}}}{z}}\]
    7. Applied associate-/l*52.1

      \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{\sqrt{1}}{\frac{z}{\sqrt{z \cdot z - t \cdot a}}}}}\]
    8. Taylor expanded around -inf 1.5

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

    if -1.3870375139541522e+152 < z < 2.811098440010323e+123

    1. Initial program 10.7

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity8.7

      \[\leadsto \frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{\color{blue}{1 \cdot z}}}\]
    6. Applied *-un-lft-identity8.7

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

      \[\leadsto \frac{x \cdot y}{\frac{\color{blue}{\sqrt{1} \cdot \sqrt{z \cdot z - t \cdot a}}}{1 \cdot z}}\]
    8. Applied times-frac8.7

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

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

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

    if 2.811098440010323e+123 < z

    1. Initial program 47.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}{x \cdot y}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.387037513954152204793629697523518119099 \cdot 10^{152}:\\ \;\;\;\;\frac{x \cdot y}{-1}\\ \mathbf{elif}\;z \le 2.81109844001032311849514459419925746028 \cdot 10^{123}:\\ \;\;\;\;x \cdot \frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

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