Average Error: 24.9 → 6.0
Time: 15.9s
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.63912937841539549499323805785233795264 \cdot 10^{153}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \le 1.972031711751160647332172966105322255619 \cdot 10^{149}:\\ \;\;\;\;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.63912937841539549499323805785233795264 \cdot 10^{153}:\\
\;\;\;\;-y \cdot x\\

\mathbf{elif}\;z \le 1.972031711751160647332172966105322255619 \cdot 10^{149}:\\
\;\;\;\;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 r268217 = x;
        double r268218 = y;
        double r268219 = r268217 * r268218;
        double r268220 = z;
        double r268221 = r268219 * r268220;
        double r268222 = r268220 * r268220;
        double r268223 = t;
        double r268224 = a;
        double r268225 = r268223 * r268224;
        double r268226 = r268222 - r268225;
        double r268227 = sqrt(r268226);
        double r268228 = r268221 / r268227;
        return r268228;
}

double f(double x, double y, double z, double t, double a) {
        double r268229 = z;
        double r268230 = -1.6391293784153955e+153;
        bool r268231 = r268229 <= r268230;
        double r268232 = y;
        double r268233 = x;
        double r268234 = r268232 * r268233;
        double r268235 = -r268234;
        double r268236 = 1.9720317117511606e+149;
        bool r268237 = r268229 <= r268236;
        double r268238 = r268229 * r268229;
        double r268239 = t;
        double r268240 = a;
        double r268241 = r268239 * r268240;
        double r268242 = r268238 - r268241;
        double r268243 = sqrt(r268242);
        double r268244 = r268243 / r268229;
        double r268245 = r268232 / r268244;
        double r268246 = r268233 * r268245;
        double r268247 = r268237 ? r268246 : r268234;
        double r268248 = r268231 ? r268235 : r268247;
        return r268248;
}

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.9
Target7.5
Herbie6.0
\[\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.6391293784153955e+153

    1. Initial program 53.6

      \[\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}{-y \cdot x}\]

    if -1.6391293784153955e+153 < z < 1.9720317117511606e+149

    1. Initial program 10.9

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

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

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

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

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

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

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

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

    if 1.9720317117511606e+149 < z

    1. Initial program 53.6

      \[\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}{x \cdot y}\]
    3. Simplified1.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.63912937841539549499323805785233795264 \cdot 10^{153}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \le 1.972031711751160647332172966105322255619 \cdot 10^{149}:\\ \;\;\;\;x \cdot \frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array}\]

Reproduce

herbie shell --seed 2019304 +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.1921305903852764e46) (- (* y x)) (if (< z 5.9762681209208942e90) (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y)) (* y x)))

  (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))