Average Error: 25.0 → 6.6
Time: 16.1s
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.314671456108926512082813208950851125606 \cdot 10^{154}:\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{elif}\;z \le 3.742227003601956059846046304592741853886 \cdot 10^{96}:\\ \;\;\;\;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 -1.314671456108926512082813208950851125606 \cdot 10^{154}:\\
\;\;\;\;\left(-x\right) \cdot y\\

\mathbf{elif}\;z \le 3.742227003601956059846046304592741853886 \cdot 10^{96}:\\
\;\;\;\;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 r182839 = x;
        double r182840 = y;
        double r182841 = r182839 * r182840;
        double r182842 = z;
        double r182843 = r182841 * r182842;
        double r182844 = r182842 * r182842;
        double r182845 = t;
        double r182846 = a;
        double r182847 = r182845 * r182846;
        double r182848 = r182844 - r182847;
        double r182849 = sqrt(r182848);
        double r182850 = r182843 / r182849;
        return r182850;
}

double f(double x, double y, double z, double t, double a) {
        double r182851 = z;
        double r182852 = -1.3146714561089265e+154;
        bool r182853 = r182851 <= r182852;
        double r182854 = x;
        double r182855 = -r182854;
        double r182856 = y;
        double r182857 = r182855 * r182856;
        double r182858 = 3.742227003601956e+96;
        bool r182859 = r182851 <= r182858;
        double r182860 = r182851 * r182851;
        double r182861 = t;
        double r182862 = a;
        double r182863 = r182861 * r182862;
        double r182864 = r182860 - r182863;
        double r182865 = sqrt(r182864);
        double r182866 = r182851 / r182865;
        double r182867 = r182854 * r182866;
        double r182868 = r182856 * r182867;
        double r182869 = r182856 * r182854;
        double r182870 = r182859 ? r182868 : r182869;
        double r182871 = r182853 ? r182857 : r182870;
        return r182871;
}

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.0
Target8.2
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.3146714561089265e+154

    1. Initial program 54.6

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

      \[\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-prod54.6

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

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

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

      \[\leadsto \left(y \cdot x\right) \cdot \frac{z}{\sqrt{\color{blue}{\mathsf{fma}\left(z, z, -t \cdot a\right)}}}\]
    9. Simplified54.2

      \[\leadsto \left(y \cdot x\right) \cdot \frac{z}{\sqrt{\mathsf{fma}\left(z, z, \color{blue}{-a \cdot t}\right)}}\]
    10. Taylor expanded around -inf 1.6

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

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

    if -1.3146714561089265e+154 < z < 3.742227003601956e+96

    1. Initial program 11.4

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

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

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

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

    if 3.742227003601956e+96 < z

    1. Initial program 43.5

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.314671456108926512082813208950851125606 \cdot 10^{154}:\\ \;\;\;\;\left(-x\right) \cdot y\\ \mathbf{elif}\;z \le 3.742227003601956059846046304592741853886 \cdot 10^{96}:\\ \;\;\;\;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 2019235 +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)))))