Average Error: 25.5 → 6.6
Time: 16.0s
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.336528825553058615908837688188395481929 \cdot 10^{154}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 1.836191433086221204663733499021834299306 \cdot 10^{86}:\\ \;\;\;\;\frac{z}{\sqrt{z \cdot z - t \cdot a}} \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{z - \frac{\frac{1}{2} \cdot a}{\frac{z}{t}}} \cdot \left(x \cdot y\right)\\ \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.336528825553058615908837688188395481929 \cdot 10^{154}:\\
\;\;\;\;x \cdot \left(-y\right)\\

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

\mathbf{else}:\\
\;\;\;\;\frac{z}{z - \frac{\frac{1}{2} \cdot a}{\frac{z}{t}}} \cdot \left(x \cdot y\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r251774 = x;
        double r251775 = y;
        double r251776 = r251774 * r251775;
        double r251777 = z;
        double r251778 = r251776 * r251777;
        double r251779 = r251777 * r251777;
        double r251780 = t;
        double r251781 = a;
        double r251782 = r251780 * r251781;
        double r251783 = r251779 - r251782;
        double r251784 = sqrt(r251783);
        double r251785 = r251778 / r251784;
        return r251785;
}

double f(double x, double y, double z, double t, double a) {
        double r251786 = z;
        double r251787 = -1.3365288255530586e+154;
        bool r251788 = r251786 <= r251787;
        double r251789 = x;
        double r251790 = y;
        double r251791 = -r251790;
        double r251792 = r251789 * r251791;
        double r251793 = 1.8361914330862212e+86;
        bool r251794 = r251786 <= r251793;
        double r251795 = r251786 * r251786;
        double r251796 = t;
        double r251797 = a;
        double r251798 = r251796 * r251797;
        double r251799 = r251795 - r251798;
        double r251800 = sqrt(r251799);
        double r251801 = r251786 / r251800;
        double r251802 = r251789 * r251790;
        double r251803 = r251801 * r251802;
        double r251804 = 0.5;
        double r251805 = r251804 * r251797;
        double r251806 = r251786 / r251796;
        double r251807 = r251805 / r251806;
        double r251808 = r251786 - r251807;
        double r251809 = r251786 / r251808;
        double r251810 = r251809 * r251802;
        double r251811 = r251794 ? r251803 : r251810;
        double r251812 = r251788 ? r251792 : r251811;
        return r251812;
}

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.5
Target8.0
Herbie6.6
\[\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.3365288255530586e+154

    1. Initial program 53.0

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity53.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-prod53.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-frac52.6

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

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

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

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

    if -1.3365288255530586e+154 < z < 1.8361914330862212e+86

    1. Initial program 11.8

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

      \[\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-prod11.8

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

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

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

    if 1.8361914330862212e+86 < z

    1. Initial program 42.1

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

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

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

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

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

      \[\leadsto \left(y \cdot x\right) \cdot \frac{z}{\color{blue}{z - \frac{1}{2} \cdot \frac{a \cdot t}{z}}}\]
    8. Simplified2.3

      \[\leadsto \left(y \cdot x\right) \cdot \frac{z}{\color{blue}{z - \frac{a \cdot \frac{1}{2}}{\frac{z}{t}}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.336528825553058615908837688188395481929 \cdot 10^{154}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \le 1.836191433086221204663733499021834299306 \cdot 10^{86}:\\ \;\;\;\;\frac{z}{\sqrt{z \cdot z - t \cdot a}} \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{z - \frac{\frac{1}{2} \cdot a}{\frac{z}{t}}} \cdot \left(x \cdot y\right)\\ \end{array}\]

Reproduce

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