Average Error: 24.2 → 6.5
Time: 16.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 -3.642853120035631608470979075188817806619 \cdot 10^{155}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \le 8.145165494197675224530244364370982483974 \cdot 10^{96}:\\ \;\;\;\;x \cdot \frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \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 -3.642853120035631608470979075188817806619 \cdot 10^{155}:\\
\;\;\;\;-y \cdot x\\

\mathbf{elif}\;z \le 8.145165494197675224530244364370982483974 \cdot 10^{96}:\\
\;\;\;\;x \cdot \frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r188718 = x;
        double r188719 = y;
        double r188720 = r188718 * r188719;
        double r188721 = z;
        double r188722 = r188720 * r188721;
        double r188723 = r188721 * r188721;
        double r188724 = t;
        double r188725 = a;
        double r188726 = r188724 * r188725;
        double r188727 = r188723 - r188726;
        double r188728 = sqrt(r188727);
        double r188729 = r188722 / r188728;
        return r188729;
}

double f(double x, double y, double z, double t, double a) {
        double r188730 = z;
        double r188731 = -3.6428531200356316e+155;
        bool r188732 = r188730 <= r188731;
        double r188733 = y;
        double r188734 = x;
        double r188735 = r188733 * r188734;
        double r188736 = -r188735;
        double r188737 = 8.145165494197675e+96;
        bool r188738 = r188730 <= r188737;
        double r188739 = r188730 * r188730;
        double r188740 = t;
        double r188741 = a;
        double r188742 = r188740 * r188741;
        double r188743 = r188739 - r188742;
        double r188744 = sqrt(r188743);
        double r188745 = r188744 / r188730;
        double r188746 = r188733 / r188745;
        double r188747 = r188734 * r188746;
        double r188748 = r188738 ? r188747 : r188735;
        double r188749 = r188732 ? r188736 : r188748;
        return r188749;
}

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.2
Target8.1
Herbie6.5
\[\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 < -3.6428531200356316e+155

    1. Initial program 53.8

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

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

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

    if -3.6428531200356316e+155 < z < 8.145165494197675e+96

    1. Initial program 11.1

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

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

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

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

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

      \[\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 8.145165494197675e+96 < z

    1. Initial program 42.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.642853120035631608470979075188817806619 \cdot 10^{155}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \le 8.145165494197675224530244364370982483974 \cdot 10^{96}:\\ \;\;\;\;x \cdot \frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array}\]

Reproduce

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