Average Error: 24.1 → 7.1
Time: 4.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 -5.841072424480832961575433736923648161714 \cdot 10^{103}:\\ \;\;\;\;\left(x \cdot y\right) \cdot -1\\ \mathbf{elif}\;z \le 6.447720564522468628519061845818630465482 \cdot 10^{-228}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)\\ \mathbf{elif}\;z \le 5.408002280660189019237963487412179983855 \cdot 10^{-170}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;z \le 6.344623429916867054620353842811536561075 \cdot 10^{113}:\\ \;\;\;\;x \cdot \left(y \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 -5.841072424480832961575433736923648161714 \cdot 10^{103}:\\
\;\;\;\;\left(x \cdot y\right) \cdot -1\\

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

\mathbf{elif}\;z \le 5.408002280660189019237963487412179983855 \cdot 10^{-170}:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;z \le 6.344623429916867054620353842811536561075 \cdot 10^{113}:\\
\;\;\;\;x \cdot \left(y \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 r311622 = x;
        double r311623 = y;
        double r311624 = r311622 * r311623;
        double r311625 = z;
        double r311626 = r311624 * r311625;
        double r311627 = r311625 * r311625;
        double r311628 = t;
        double r311629 = a;
        double r311630 = r311628 * r311629;
        double r311631 = r311627 - r311630;
        double r311632 = sqrt(r311631);
        double r311633 = r311626 / r311632;
        return r311633;
}

double f(double x, double y, double z, double t, double a) {
        double r311634 = z;
        double r311635 = -5.841072424480833e+103;
        bool r311636 = r311634 <= r311635;
        double r311637 = x;
        double r311638 = y;
        double r311639 = r311637 * r311638;
        double r311640 = -1.0;
        double r311641 = r311639 * r311640;
        double r311642 = 6.447720564522469e-228;
        bool r311643 = r311634 <= r311642;
        double r311644 = r311634 * r311634;
        double r311645 = t;
        double r311646 = a;
        double r311647 = r311645 * r311646;
        double r311648 = r311644 - r311647;
        double r311649 = sqrt(r311648);
        double r311650 = r311634 / r311649;
        double r311651 = r311638 * r311650;
        double r311652 = r311637 * r311651;
        double r311653 = 5.408002280660189e-170;
        bool r311654 = r311634 <= r311653;
        double r311655 = 6.344623429916867e+113;
        bool r311656 = r311634 <= r311655;
        double r311657 = r311656 ? r311652 : r311639;
        double r311658 = r311654 ? r311639 : r311657;
        double r311659 = r311643 ? r311652 : r311658;
        double r311660 = r311636 ? r311641 : r311659;
        return r311660;
}

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.1
Target7.4
Herbie7.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 3 regimes
  2. if z < -5.841072424480833e+103

    1. Initial program 44.4

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

      \[\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-prod44.4

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

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

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

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

    if -5.841072424480833e+103 < z < 6.447720564522469e-228 or 5.408002280660189e-170 < z < 6.344623429916867e+113

    1. Initial program 10.0

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

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

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

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

      \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\]
    7. Using strategy rm
    8. Applied associate-*l*8.3

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

    if 6.447720564522469e-228 < z < 5.408002280660189e-170 or 6.344623429916867e+113 < z

    1. Initial program 40.5

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

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

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

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

      \[\leadsto \color{blue}{\left(x \cdot y\right)} \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\]
    7. Using strategy rm
    8. Applied associate-*l*38.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -5.841072424480832961575433736923648161714 \cdot 10^{103}:\\ \;\;\;\;\left(x \cdot y\right) \cdot -1\\ \mathbf{elif}\;z \le 6.447720564522468628519061845818630465482 \cdot 10^{-228}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)\\ \mathbf{elif}\;z \le 5.408002280660189019237963487412179983855 \cdot 10^{-170}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;z \le 6.344623429916867054620353842811536561075 \cdot 10^{113}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 2019354 
(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)))))