Average Error: 24.7 → 6.5
Time: 18.0s
Precision: binary64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -2.3321377759488846 \cdot 10^{+67}:\\ \;\;\;\;x \cdot \frac{y}{\frac{0.5 \cdot \frac{t}{\frac{z}{a}} - z}{z}}\\ \mathbf{elif}\;z \leq 7.8352056567318 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{\frac{\sqrt{\sqrt{z \cdot z - t \cdot a}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}} \cdot \frac{y}{\frac{\sqrt{\sqrt{z \cdot z - t \cdot a}}}{\sqrt[3]{z}}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{\frac{z - 0.5 \cdot \left(a \cdot \frac{t}{z}\right)}{z}}\\ \end{array}\]
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\begin{array}{l}
\mathbf{if}\;z \leq -2.3321377759488846 \cdot 10^{+67}:\\
\;\;\;\;x \cdot \frac{y}{\frac{0.5 \cdot \frac{t}{\frac{z}{a}} - z}{z}}\\

\mathbf{elif}\;z \leq 7.8352056567318 \cdot 10^{-12}:\\
\;\;\;\;\frac{x}{\frac{\sqrt{\sqrt{z \cdot z - t \cdot a}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}} \cdot \frac{y}{\frac{\sqrt{\sqrt{z \cdot z - t \cdot a}}}{\sqrt[3]{z}}}\\

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

\end{array}
(FPCore (x y z t a)
 :precision binary64
 (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))
(FPCore (x y z t a)
 :precision binary64
 (if (<= z -2.3321377759488846e+67)
   (* x (/ y (/ (- (* 0.5 (/ t (/ z a))) z) z)))
   (if (<= z 7.8352056567318e-12)
     (*
      (/ x (/ (sqrt (sqrt (- (* z z) (* t a)))) (* (cbrt z) (cbrt z))))
      (/ y (/ (sqrt (sqrt (- (* z z) (* t a)))) (cbrt z))))
     (* x (/ y (/ (- z (* 0.5 (* a (/ t z)))) z))))))
double code(double x, double y, double z, double t, double a) {
	return ((x * y) * z) / sqrt((z * z) - (t * a));
}
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (z <= -2.3321377759488846e+67) {
		tmp = x * (y / (((0.5 * (t / (z / a))) - z) / z));
	} else if (z <= 7.8352056567318e-12) {
		tmp = (x / (sqrt(sqrt((z * z) - (t * a))) / (cbrt(z) * cbrt(z)))) * (y / (sqrt(sqrt((z * z) - (t * a))) / cbrt(z)));
	} else {
		tmp = x * (y / ((z - (0.5 * (a * (t / z)))) / z));
	}
	return tmp;
}

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.7
Target7.7
Herbie6.5
\[\begin{array}{l} \mathbf{if}\;z < -3.1921305903852764 \cdot 10^{+46}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z < 5.976268120920894 \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 < -2.3321377759488846e67

    1. Initial program 39.6

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

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

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

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

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

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

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

      \[\leadsto x \cdot \frac{y}{\frac{\color{blue}{0.5 \cdot \frac{t \cdot a}{z} - z}}{z}}\]
    10. Simplified2.9

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

    if -2.3321377759488846e67 < z < 7.8352056567317998e-12

    1. Initial program 12.4

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt_binary64_1170712.2

      \[\leadsto \frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}}\]
    5. Applied add-sqr-sqrt_binary64_1169412.2

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

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

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

    if 7.8352056567317998e-12 < z

    1. Initial program 31.4

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{1}{1}} \cdot \frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    8. Simplified28.9

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

      \[\leadsto x \cdot \frac{y}{\frac{\color{blue}{z - 0.5 \cdot \frac{t \cdot a}{z}}}{z}}\]
    10. Simplified4.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.3321377759488846 \cdot 10^{+67}:\\ \;\;\;\;x \cdot \frac{y}{\frac{0.5 \cdot \frac{t}{\frac{z}{a}} - z}{z}}\\ \mathbf{elif}\;z \leq 7.8352056567318 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{\frac{\sqrt{\sqrt{z \cdot z - t \cdot a}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}} \cdot \frac{y}{\frac{\sqrt{\sqrt{z \cdot z - t \cdot a}}}{\sqrt[3]{z}}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{\frac{z - 0.5 \cdot \left(a \cdot \frac{t}{z}\right)}{z}}\\ \end{array}\]

Reproduce

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