Average Error: 24.4 → 6.3
Time: 14.2s
Precision: binary64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
\[\begin{array}{l} \mathbf{if}\;z \leq -3.347552958513927 \cdot 10^{+122}:\\ \;\;\;\;\frac{x \cdot y}{\mathsf{fma}\left(0.5, \frac{a \cdot t}{z \cdot z}, -1\right)}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_1 := \frac{\sqrt{z \cdot z - a \cdot t}}{z}\\ \mathbf{if}\;z \leq -1.0802216888912775 \cdot 10^{-139}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{1}{t_1}\right)\\ \mathbf{elif}\;z \leq 6.049021251734141 \cdot 10^{-173}:\\ \;\;\;\;\left(z \cdot \left(x \cdot y\right)\right) \cdot \frac{1}{\mathsf{hypot}\left(\sqrt{-a \cdot t}, z\right)}\\ \mathbf{elif}\;z \leq 5.015223024558922 \cdot 10^{+82}:\\ \;\;\;\;\left(x \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right) \cdot \frac{\sqrt[3]{y}}{t_1}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array}\\ \end{array} \]
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\begin{array}{l}
\mathbf{if}\;z \leq -3.347552958513927 \cdot 10^{+122}:\\
\;\;\;\;\frac{x \cdot y}{\mathsf{fma}\left(0.5, \frac{a \cdot t}{z \cdot z}, -1\right)}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \frac{\sqrt{z \cdot z - a \cdot t}}{z}\\
\mathbf{if}\;z \leq -1.0802216888912775 \cdot 10^{-139}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{1}{t_1}\right)\\

\mathbf{elif}\;z \leq 6.049021251734141 \cdot 10^{-173}:\\
\;\;\;\;\left(z \cdot \left(x \cdot y\right)\right) \cdot \frac{1}{\mathsf{hypot}\left(\sqrt{-a \cdot t}, z\right)}\\

\mathbf{elif}\;z \leq 5.015223024558922 \cdot 10^{+82}:\\
\;\;\;\;\left(x \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right) \cdot \frac{\sqrt[3]{y}}{t_1}\\

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


\end{array}\\


\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 -3.347552958513927e+122)
   (/ (* x y) (fma 0.5 (/ (* a t) (* z z)) -1.0))
   (let* ((t_1 (/ (sqrt (- (* z z) (* a t))) z)))
     (if (<= z -1.0802216888912775e-139)
       (* x (* y (/ 1.0 t_1)))
       (if (<= z 6.049021251734141e-173)
         (* (* z (* x y)) (/ 1.0 (hypot (sqrt (- (* a t))) z)))
         (if (<= z 5.015223024558922e+82)
           (* (* x (* (cbrt y) (cbrt y))) (/ (cbrt y) t_1))
           (* x y)))))))
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 <= -3.347552958513927e+122) {
		tmp = (x * y) / fma(0.5, ((a * t) / (z * z)), -1.0);
	} else {
		double t_1 = sqrt((z * z) - (a * t)) / z;
		double tmp_1;
		if (z <= -1.0802216888912775e-139) {
			tmp_1 = x * (y * (1.0 / t_1));
		} else if (z <= 6.049021251734141e-173) {
			tmp_1 = (z * (x * y)) * (1.0 / hypot(sqrt(-(a * t)), z));
		} else if (z <= 5.015223024558922e+82) {
			tmp_1 = (x * (cbrt(y) * cbrt(y))) * (cbrt(y) / t_1);
		} else {
			tmp_1 = x * y;
		}
		tmp = tmp_1;
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.4
Target7.7
Herbie6.3
\[\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 5 regimes
  2. if z < -3.34755295851392692e122

    1. Initial program 47.1

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    3. Applied div-inv_binary6445.2

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{0.5 \cdot \frac{a \cdot t}{{z}^{2}} - 1}} \]
    5. Simplified6.2

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

    if -3.34755295851392692e122 < z < -1.0802216888912775e-139

    1. Initial program 7.2

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
    2. Applied associate-/l*_binary644.4

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

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

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    5. Applied div-inv_binary644.3

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

    if -1.0802216888912775e-139 < z < 6.04902125173414102e-173

    1. Initial program 16.8

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

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

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

    if 6.04902125173414102e-173 < z < 5.0152230245589217e82

    1. Initial program 7.9

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
    2. Applied associate-/l*_binary645.7

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    3. Applied *-un-lft-identity_binary645.7

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

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

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

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

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

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

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

      \[\leadsto \frac{x}{1} \cdot \color{blue}{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\frac{\sqrt{1}}{1}} \cdot \frac{\sqrt[3]{y}}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\right)} \]
    11. Applied associate-*r*_binary645.9

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

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

    if 5.0152230245589217e82 < z

    1. Initial program 40.0

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
    2. Taylor expanded in z around inf 3.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.347552958513927 \cdot 10^{+122}:\\ \;\;\;\;\frac{x \cdot y}{\mathsf{fma}\left(0.5, \frac{a \cdot t}{z \cdot z}, -1\right)}\\ \mathbf{elif}\;z \leq -1.0802216888912775 \cdot 10^{-139}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{1}{\frac{\sqrt{z \cdot z - a \cdot t}}{z}}\right)\\ \mathbf{elif}\;z \leq 6.049021251734141 \cdot 10^{-173}:\\ \;\;\;\;\left(z \cdot \left(x \cdot y\right)\right) \cdot \frac{1}{\mathsf{hypot}\left(\sqrt{-a \cdot t}, z\right)}\\ \mathbf{elif}\;z \leq 5.015223024558922 \cdot 10^{+82}:\\ \;\;\;\;\left(x \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right) \cdot \frac{\sqrt[3]{y}}{\frac{\sqrt{z \cdot z - a \cdot t}}{z}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Reproduce

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