Average Error: 25.0 → 6.2
Time: 14.5s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -4.610508646786433287550784748309774160666 \cdot 10^{104}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 9.925985792422320279557825298855191033448 \cdot 10^{124}:\\ \;\;\;\;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 -4.610508646786433287550784748309774160666 \cdot 10^{104}:\\
\;\;\;\;-x \cdot y\\

\mathbf{elif}\;z \le 9.925985792422320279557825298855191033448 \cdot 10^{124}:\\
\;\;\;\;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 r263307 = x;
        double r263308 = y;
        double r263309 = r263307 * r263308;
        double r263310 = z;
        double r263311 = r263309 * r263310;
        double r263312 = r263310 * r263310;
        double r263313 = t;
        double r263314 = a;
        double r263315 = r263313 * r263314;
        double r263316 = r263312 - r263315;
        double r263317 = sqrt(r263316);
        double r263318 = r263311 / r263317;
        return r263318;
}

double f(double x, double y, double z, double t, double a) {
        double r263319 = z;
        double r263320 = -4.610508646786433e+104;
        bool r263321 = r263319 <= r263320;
        double r263322 = x;
        double r263323 = y;
        double r263324 = r263322 * r263323;
        double r263325 = -r263324;
        double r263326 = 9.92598579242232e+124;
        bool r263327 = r263319 <= r263326;
        double r263328 = r263319 * r263319;
        double r263329 = t;
        double r263330 = a;
        double r263331 = r263329 * r263330;
        double r263332 = r263328 - r263331;
        double r263333 = sqrt(r263332);
        double r263334 = r263333 / r263319;
        double r263335 = r263323 / r263334;
        double r263336 = r263322 * r263335;
        double r263337 = r263327 ? r263336 : r263324;
        double r263338 = r263321 ? r263325 : r263337;
        return r263338;
}

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

Original25.0
Target7.7
Herbie6.2
\[\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 < -4.610508646786433e+104

    1. Initial program 45.4

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

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

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

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

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

    if -4.610508646786433e+104 < z < 9.92598579242232e+124

    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 associate-/l*9.2

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

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

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

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

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

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

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

    if 9.92598579242232e+124 < z

    1. Initial program 47.3

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -4.610508646786433287550784748309774160666 \cdot 10^{104}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 9.925985792422320279557825298855191033448 \cdot 10^{124}:\\ \;\;\;\;x \cdot \frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

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