Average Error: 24.8 → 6.4
Time: 6.8s
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.068598920199789518598282705570987537021 \cdot 10^{144}:\\ \;\;\;\;x \cdot \left(-1 \cdot y\right)\\ \mathbf{elif}\;z \le 1.584842902493884824536728315524484983777 \cdot 10^{121}:\\ \;\;\;\;\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \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 -1.068598920199789518598282705570987537021 \cdot 10^{144}:\\
\;\;\;\;x \cdot \left(-1 \cdot y\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r359161 = x;
        double r359162 = y;
        double r359163 = r359161 * r359162;
        double r359164 = z;
        double r359165 = r359163 * r359164;
        double r359166 = r359164 * r359164;
        double r359167 = t;
        double r359168 = a;
        double r359169 = r359167 * r359168;
        double r359170 = r359166 - r359169;
        double r359171 = sqrt(r359170);
        double r359172 = r359165 / r359171;
        return r359172;
}

double f(double x, double y, double z, double t, double a) {
        double r359173 = z;
        double r359174 = -1.0685989201997895e+144;
        bool r359175 = r359173 <= r359174;
        double r359176 = x;
        double r359177 = -1.0;
        double r359178 = y;
        double r359179 = r359177 * r359178;
        double r359180 = r359176 * r359179;
        double r359181 = 1.5848429024938848e+121;
        bool r359182 = r359173 <= r359181;
        double r359183 = r359176 * r359178;
        double r359184 = r359173 * r359173;
        double r359185 = t;
        double r359186 = a;
        double r359187 = r359185 * r359186;
        double r359188 = r359184 - r359187;
        double r359189 = sqrt(r359188);
        double r359190 = r359189 / r359173;
        double r359191 = r359183 / r359190;
        double r359192 = r359182 ? r359191 : r359183;
        double r359193 = r359175 ? r359180 : r359192;
        return r359193;
}

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.6
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 < -1.0685989201997895e+144

    1. Initial program 51.3

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity50.6

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

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

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

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

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

      \[\leadsto \color{blue}{x} \cdot \frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\]
    11. Taylor expanded around -inf 1.2

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

    if -1.0685989201997895e+144 < z < 1.5848429024938848e+121

    1. Initial program 11.2

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

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

    if 1.5848429024938848e+121 < z

    1. Initial program 48.0

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Taylor expanded around inf 1.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 -1.068598920199789518598282705570987537021 \cdot 10^{144}:\\ \;\;\;\;x \cdot \left(-1 \cdot y\right)\\ \mathbf{elif}\;z \le 1.584842902493884824536728315524484983777 \cdot 10^{121}:\\ \;\;\;\;\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

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