Average Error: 25.2 → 8.0
Time: 46.4s
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.696983515699775782779959954264589471041 \cdot 10^{105}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \le 7.410290891207556983039101983857581216146 \cdot 10^{58}:\\ \;\;\;\;\frac{y}{\frac{1}{z}} \cdot \frac{x}{\sqrt{z \cdot z - t \cdot a}}\\ \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.696983515699775782779959954264589471041 \cdot 10^{105}:\\
\;\;\;\;y \cdot \left(-x\right)\\

\mathbf{elif}\;z \le 7.410290891207556983039101983857581216146 \cdot 10^{58}:\\
\;\;\;\;\frac{y}{\frac{1}{z}} \cdot \frac{x}{\sqrt{z \cdot z - t \cdot a}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r16908051 = x;
        double r16908052 = y;
        double r16908053 = r16908051 * r16908052;
        double r16908054 = z;
        double r16908055 = r16908053 * r16908054;
        double r16908056 = r16908054 * r16908054;
        double r16908057 = t;
        double r16908058 = a;
        double r16908059 = r16908057 * r16908058;
        double r16908060 = r16908056 - r16908059;
        double r16908061 = sqrt(r16908060);
        double r16908062 = r16908055 / r16908061;
        return r16908062;
}

double f(double x, double y, double z, double t, double a) {
        double r16908063 = z;
        double r16908064 = -1.6969835156997758e+105;
        bool r16908065 = r16908063 <= r16908064;
        double r16908066 = y;
        double r16908067 = x;
        double r16908068 = -r16908067;
        double r16908069 = r16908066 * r16908068;
        double r16908070 = 7.410290891207557e+58;
        bool r16908071 = r16908063 <= r16908070;
        double r16908072 = 1.0;
        double r16908073 = r16908072 / r16908063;
        double r16908074 = r16908066 / r16908073;
        double r16908075 = r16908063 * r16908063;
        double r16908076 = t;
        double r16908077 = a;
        double r16908078 = r16908076 * r16908077;
        double r16908079 = r16908075 - r16908078;
        double r16908080 = sqrt(r16908079);
        double r16908081 = r16908067 / r16908080;
        double r16908082 = r16908074 * r16908081;
        double r16908083 = r16908066 * r16908067;
        double r16908084 = r16908071 ? r16908082 : r16908083;
        double r16908085 = r16908065 ? r16908069 : r16908084;
        return r16908085;
}

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.2
Target8.0
Herbie8.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.6969835156997758e+105

    1. Initial program 44.1

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

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

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

      \[\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-prod42.0

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

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

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

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

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

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

    if -1.6969835156997758e+105 < z < 7.410290891207557e+58

    1. Initial program 12.2

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied associate-/l*10.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-identity10.9

      \[\leadsto \frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{\color{blue}{1 \cdot z}}}\]
    6. Applied *-un-lft-identity10.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-prod10.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-frac10.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-frac10.5

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

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

      \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{z \cdot z - t \cdot a} \cdot \frac{1}{z}}}\]
    13. Applied *-un-lft-identity10.5

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

      \[\leadsto x \cdot \color{blue}{\left(\frac{1}{\sqrt{z \cdot z - t \cdot a}} \cdot \frac{y}{\frac{1}{z}}\right)}\]
    15. Applied associate-*r*12.6

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

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

    if 7.410290891207557e+58 < z

    1. Initial program 39.0

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Taylor expanded around inf 3.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.696983515699775782779959954264589471041 \cdot 10^{105}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \le 7.410290891207556983039101983857581216146 \cdot 10^{58}:\\ \;\;\;\;\frac{y}{\frac{1}{z}} \cdot \frac{x}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array}\]

Reproduce

herbie shell --seed 2019168 
(FPCore (x y z t a)
  :name "Statistics.Math.RootFinding:ridders from math-functions-0.1.5.2"

  :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)))))