Average Error: 24.8 → 6.4
Time: 15.7s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -8.271419220344132473449011043748253490608 \cdot 10^{137}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 6.239560565980056845688368913673998851268 \cdot 10^{82}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{1}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\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 -8.271419220344132473449011043748253490608 \cdot 10^{137}:\\
\;\;\;\;-x \cdot y\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r253620 = x;
        double r253621 = y;
        double r253622 = r253620 * r253621;
        double r253623 = z;
        double r253624 = r253622 * r253623;
        double r253625 = r253623 * r253623;
        double r253626 = t;
        double r253627 = a;
        double r253628 = r253626 * r253627;
        double r253629 = r253625 - r253628;
        double r253630 = sqrt(r253629);
        double r253631 = r253624 / r253630;
        return r253631;
}

double f(double x, double y, double z, double t, double a) {
        double r253632 = z;
        double r253633 = -8.271419220344132e+137;
        bool r253634 = r253632 <= r253633;
        double r253635 = x;
        double r253636 = y;
        double r253637 = r253635 * r253636;
        double r253638 = -r253637;
        double r253639 = 6.239560565980057e+82;
        bool r253640 = r253632 <= r253639;
        double r253641 = 1.0;
        double r253642 = r253632 * r253632;
        double r253643 = t;
        double r253644 = a;
        double r253645 = r253643 * r253644;
        double r253646 = r253642 - r253645;
        double r253647 = sqrt(r253646);
        double r253648 = r253647 / r253632;
        double r253649 = r253641 / r253648;
        double r253650 = r253636 * r253649;
        double r253651 = r253635 * r253650;
        double r253652 = r253640 ? r253651 : r253637;
        double r253653 = r253634 ? r253638 : r253652;
        return r253653;
}

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.8
Target7.7
Herbie6.4
\[\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 < -8.271419220344132e+137

    1. Initial program 50.0

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

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

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

    if -8.271419220344132e+137 < z < 6.239560565980057e+82

    1. Initial program 10.8

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

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

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

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

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

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

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

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

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

    if 6.239560565980057e+82 < z

    1. Initial program 42.5

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

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

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

Reproduce

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