Average Error: 24.4 → 6.1
Time: 15.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 -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}:\\ \;\;\;\;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 -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}:\\
\;\;\;\;y \cdot x\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r221844 = x;
        double r221845 = y;
        double r221846 = r221844 * r221845;
        double r221847 = z;
        double r221848 = r221846 * r221847;
        double r221849 = r221847 * r221847;
        double r221850 = t;
        double r221851 = a;
        double r221852 = r221850 * r221851;
        double r221853 = r221849 - r221852;
        double r221854 = sqrt(r221853);
        double r221855 = r221848 / r221854;
        return r221855;
}

double f(double x, double y, double z, double t, double a) {
        double r221856 = z;
        double r221857 = -1.3870375139541522e+152;
        bool r221858 = r221856 <= r221857;
        double r221859 = x;
        double r221860 = y;
        double r221861 = r221859 * r221860;
        double r221862 = -1.0;
        double r221863 = r221861 / r221862;
        double r221864 = 2.811098440010323e+123;
        bool r221865 = r221856 <= r221864;
        double r221866 = r221856 * r221856;
        double r221867 = t;
        double r221868 = a;
        double r221869 = r221867 * r221868;
        double r221870 = r221866 - r221869;
        double r221871 = sqrt(r221870);
        double r221872 = r221871 / r221856;
        double r221873 = r221860 / r221872;
        double r221874 = r221859 * r221873;
        double r221875 = r221860 * r221859;
        double r221876 = r221865 ? r221874 : r221875;
        double r221877 = r221858 ? r221863 : r221876;
        return r221877;
}

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 clear-num52.1

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

      \[\leadsto \frac{x \cdot y}{\frac{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. Using strategy rm
    3. Applied associate-/l*45.9

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

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

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

      \[\leadsto \color{blue}{y \cdot x}\]
  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}:\\ \;\;\;\;y \cdot x\\ \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)))))