Average Error: 24.6 → 6.0
Time: 15.2s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.465998159965367372739527425522646175119 \cdot 10^{149}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \le 4.020794709845025708842624738781094962913 \cdot 10^{94}:\\ \;\;\;\;y \cdot \left(x \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)\\ \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 -2.465998159965367372739527425522646175119 \cdot 10^{149}:\\
\;\;\;\;-y \cdot x\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r150726 = x;
        double r150727 = y;
        double r150728 = r150726 * r150727;
        double r150729 = z;
        double r150730 = r150728 * r150729;
        double r150731 = r150729 * r150729;
        double r150732 = t;
        double r150733 = a;
        double r150734 = r150732 * r150733;
        double r150735 = r150731 - r150734;
        double r150736 = sqrt(r150735);
        double r150737 = r150730 / r150736;
        return r150737;
}

double f(double x, double y, double z, double t, double a) {
        double r150738 = z;
        double r150739 = -2.4659981599653674e+149;
        bool r150740 = r150738 <= r150739;
        double r150741 = y;
        double r150742 = x;
        double r150743 = r150741 * r150742;
        double r150744 = -r150743;
        double r150745 = 4.020794709845026e+94;
        bool r150746 = r150738 <= r150745;
        double r150747 = r150738 * r150738;
        double r150748 = t;
        double r150749 = a;
        double r150750 = r150748 * r150749;
        double r150751 = r150747 - r150750;
        double r150752 = sqrt(r150751);
        double r150753 = r150738 / r150752;
        double r150754 = r150742 * r150753;
        double r150755 = r150741 * r150754;
        double r150756 = r150746 ? r150755 : r150743;
        double r150757 = r150740 ? r150744 : r150756;
        return r150757;
}

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.6
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 < -2.4659981599653674e+149

    1. Initial program 52.9

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

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

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

    if -2.4659981599653674e+149 < z < 4.020794709845026e+94

    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 *-un-lft-identity10.7

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

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

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

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

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

    if 4.020794709845026e+94 < z

    1. Initial program 42.9

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

      \[\leadsto \color{blue}{x \cdot y}\]
    3. Simplified2.4

      \[\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 -2.465998159965367372739527425522646175119 \cdot 10^{149}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \le 4.020794709845025708842624738781094962913 \cdot 10^{94}:\\ \;\;\;\;y \cdot \left(x \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array}\]

Reproduce

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