Average Error: 25.7 → 6.6
Time: 19.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.385971485995102879568847063302767488866 \cdot 10^{103}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 7.130903565650380636895506727956454500124 \cdot 10^{148}:\\ \;\;\;\;\frac{x}{\frac{\sqrt[3]{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}{y}} \cdot \frac{1}{\sqrt[3]{\frac{\sqrt{z \cdot z - t \cdot a}}{z}} \cdot \sqrt[3]{\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 -3.385971485995102879568847063302767488866 \cdot 10^{103}:\\
\;\;\;\;-x \cdot y\\

\mathbf{elif}\;z \le 7.130903565650380636895506727956454500124 \cdot 10^{148}:\\
\;\;\;\;\frac{x}{\frac{\sqrt[3]{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}{y}} \cdot \frac{1}{\sqrt[3]{\frac{\sqrt{z \cdot z - t \cdot a}}{z}} \cdot \sqrt[3]{\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 r174069 = x;
        double r174070 = y;
        double r174071 = r174069 * r174070;
        double r174072 = z;
        double r174073 = r174071 * r174072;
        double r174074 = r174072 * r174072;
        double r174075 = t;
        double r174076 = a;
        double r174077 = r174075 * r174076;
        double r174078 = r174074 - r174077;
        double r174079 = sqrt(r174078);
        double r174080 = r174073 / r174079;
        return r174080;
}

double f(double x, double y, double z, double t, double a) {
        double r174081 = z;
        double r174082 = -3.385971485995103e+103;
        bool r174083 = r174081 <= r174082;
        double r174084 = x;
        double r174085 = y;
        double r174086 = r174084 * r174085;
        double r174087 = -r174086;
        double r174088 = 7.130903565650381e+148;
        bool r174089 = r174081 <= r174088;
        double r174090 = r174081 * r174081;
        double r174091 = t;
        double r174092 = a;
        double r174093 = r174091 * r174092;
        double r174094 = r174090 - r174093;
        double r174095 = sqrt(r174094);
        double r174096 = r174095 / r174081;
        double r174097 = cbrt(r174096);
        double r174098 = r174097 / r174085;
        double r174099 = r174084 / r174098;
        double r174100 = 1.0;
        double r174101 = r174097 * r174097;
        double r174102 = r174100 / r174101;
        double r174103 = r174099 * r174102;
        double r174104 = r174089 ? r174103 : r174086;
        double r174105 = r174083 ? r174087 : r174104;
        return r174105;
}

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.7
Target8.1
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 < -3.385971485995103e+103

    1. Initial program 43.7

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Simplified44.0

      \[\leadsto \color{blue}{\frac{z \cdot y}{\sqrt{\mathsf{fma}\left(z, z, -a \cdot t\right)}} \cdot x}\]
    3. Using strategy rm
    4. Applied clear-num44.0

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(z, z, -a \cdot t\right)}}{z \cdot y}}} \cdot x\]
    5. Simplified41.3

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

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

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

    if -3.385971485995103e+103 < z < 7.130903565650381e+148

    1. Initial program 11.6

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Simplified10.9

      \[\leadsto \color{blue}{\frac{z \cdot y}{\sqrt{\mathsf{fma}\left(z, z, -a \cdot t\right)}} \cdot x}\]
    3. Using strategy rm
    4. Applied clear-num11.1

      \[\leadsto \color{blue}{\frac{1}{\frac{\sqrt{\mathsf{fma}\left(z, z, -a \cdot t\right)}}{z \cdot y}}} \cdot x\]
    5. Simplified9.6

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

      \[\leadsto \frac{1}{\frac{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}{\color{blue}{1 \cdot y}}} \cdot x\]
    8. Applied add-cube-cbrt9.8

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

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

      \[\leadsto \frac{\color{blue}{1 \cdot 1}}{\frac{\sqrt[3]{\frac{\sqrt{z \cdot z - t \cdot a}}{z}} \cdot \sqrt[3]{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}{1} \cdot \frac{\sqrt[3]{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}{y}} \cdot x\]
    11. Applied times-frac9.7

      \[\leadsto \color{blue}{\left(\frac{1}{\frac{\sqrt[3]{\frac{\sqrt{z \cdot z - t \cdot a}}{z}} \cdot \sqrt[3]{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}{1}} \cdot \frac{1}{\frac{\sqrt[3]{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}{y}}\right)} \cdot x\]
    12. Applied associate-*l*9.5

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

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

    if 7.130903565650381e+148 < z

    1. Initial program 53.6

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
    2. Simplified53.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.385971485995102879568847063302767488866 \cdot 10^{103}:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;z \le 7.130903565650380636895506727956454500124 \cdot 10^{148}:\\ \;\;\;\;\frac{x}{\frac{\sqrt[3]{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}{y}} \cdot \frac{1}{\sqrt[3]{\frac{\sqrt{z \cdot z - t \cdot a}}{z}} \cdot \sqrt[3]{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(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)))))