Average Error: 24.3 → 6.1
Time: 10.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.946183083718863474818276422295884963474 \cdot 10^{77}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \le 1.132986739591150831053019488325308932922 \cdot 10^{-234}:\\ \;\;\;\;\left(\left(x \cdot y\right) \cdot z\right) \cdot \frac{1}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{elif}\;z \le 9.94290835006487306171241040296170532934 \cdot 10^{94}:\\ \;\;\;\;y \cdot \left(x \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)\\ \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.946183083718863474818276422295884963474 \cdot 10^{77}:\\
\;\;\;\;-y \cdot x\\

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r337918 = x;
        double r337919 = y;
        double r337920 = r337918 * r337919;
        double r337921 = z;
        double r337922 = r337920 * r337921;
        double r337923 = r337921 * r337921;
        double r337924 = t;
        double r337925 = a;
        double r337926 = r337924 * r337925;
        double r337927 = r337923 - r337926;
        double r337928 = sqrt(r337927);
        double r337929 = r337922 / r337928;
        return r337929;
}

double f(double x, double y, double z, double t, double a) {
        double r337930 = z;
        double r337931 = -1.9461830837188635e+77;
        bool r337932 = r337930 <= r337931;
        double r337933 = y;
        double r337934 = x;
        double r337935 = r337933 * r337934;
        double r337936 = -r337935;
        double r337937 = 1.1329867395911508e-234;
        bool r337938 = r337930 <= r337937;
        double r337939 = r337934 * r337933;
        double r337940 = r337939 * r337930;
        double r337941 = 1.0;
        double r337942 = r337930 * r337930;
        double r337943 = t;
        double r337944 = a;
        double r337945 = r337943 * r337944;
        double r337946 = r337942 - r337945;
        double r337947 = sqrt(r337946);
        double r337948 = r337941 / r337947;
        double r337949 = r337940 * r337948;
        double r337950 = 9.942908350064873e+94;
        bool r337951 = r337930 <= r337950;
        double r337952 = r337930 / r337947;
        double r337953 = r337934 * r337952;
        double r337954 = r337933 * r337953;
        double r337955 = r337951 ? r337954 : r337939;
        double r337956 = r337938 ? r337949 : r337955;
        double r337957 = r337932 ? r337936 : r337956;
        return r337957;
}

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.3
Target7.2
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 4 regimes
  2. if z < -1.9461830837188635e+77

    1. Initial program 40.2

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity40.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-prod40.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-frac37.7

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

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

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

    if -1.9461830837188635e+77 < z < 1.1329867395911508e-234

    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 div-inv11.3

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

    if 1.1329867395911508e-234 < z < 9.942908350064873e+94

    1. Initial program 9.1

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

      \[\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-prod9.1

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

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

      \[\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*6.7

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

    if 9.942908350064873e+94 < z

    1. Initial program 43.2

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity43.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-prod43.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-frac40.7

      \[\leadsto \color{blue}{\frac{x \cdot y}{\sqrt{1}} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}}\]
    6. Simplified40.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*40.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.946183083718863474818276422295884963474 \cdot 10^{77}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \le 1.132986739591150831053019488325308932922 \cdot 10^{-234}:\\ \;\;\;\;\left(\left(x \cdot y\right) \cdot z\right) \cdot \frac{1}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{elif}\;z \le 9.94290835006487306171241040296170532934 \cdot 10^{94}:\\ \;\;\;\;y \cdot \left(x \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

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