Average Error: 24.3 → 5.5
Time: 9.6s
Precision: binary64
\[[x, y]=\mathsf{sort}([x, y])\]
\[[t, a]=\mathsf{sort}([t, a])\]
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
\[\begin{array}{l} \mathbf{if}\;z \leq -6.319986650356017 \cdot 10^{+152}:\\ \;\;\;\;-y \cdot x\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_1 := \sqrt{z \cdot z - t \cdot a}\\ \mathbf{if}\;z \leq -6.326499446197611 \cdot 10^{-175}:\\ \;\;\;\;\frac{y \cdot x}{\frac{t_1}{z}}\\ \mathbf{elif}\;z \leq 1.910506055102422 \cdot 10^{-188}:\\ \;\;\;\;\frac{y \cdot \left(z \cdot x\right)}{\sqrt{-t}} \cdot \sqrt{\frac{1}{a}}\\ \mathbf{elif}\;z \leq 1.1966322469631946 \cdot 10^{+31}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{z}{t_1}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \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 -6.319986650356017 \cdot 10^{+152}:\\
\;\;\;\;-y \cdot x\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \sqrt{z \cdot z - t \cdot a}\\
\mathbf{if}\;z \leq -6.326499446197611 \cdot 10^{-175}:\\
\;\;\;\;\frac{y \cdot x}{\frac{t_1}{z}}\\

\mathbf{elif}\;z \leq 1.910506055102422 \cdot 10^{-188}:\\
\;\;\;\;\frac{y \cdot \left(z \cdot x\right)}{\sqrt{-t}} \cdot \sqrt{\frac{1}{a}}\\

\mathbf{elif}\;z \leq 1.1966322469631946 \cdot 10^{+31}:\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{z}{t_1}\\

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


\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 -6.319986650356017e+152)
   (- (* y x))
   (let* ((t_1 (sqrt (- (* z z) (* t a)))))
     (if (<= z -6.326499446197611e-175)
       (/ (* y x) (/ t_1 z))
       (if (<= z 1.910506055102422e-188)
         (* (/ (* y (* z x)) (sqrt (- t))) (sqrt (/ 1.0 a)))
         (if (<= z 1.1966322469631946e+31) (* (* y x) (/ z t_1)) (* y x)))))))
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 <= -6.319986650356017e+152) {
		tmp = -(y * x);
	} else {
		double t_1 = sqrt((z * z) - (t * a));
		double tmp_1;
		if (z <= -6.326499446197611e-175) {
			tmp_1 = (y * x) / (t_1 / z);
		} else if (z <= 1.910506055102422e-188) {
			tmp_1 = ((y * (z * x)) / sqrt(-t)) * sqrt(1.0 / a);
		} else if (z <= 1.1966322469631946e+31) {
			tmp_1 = (y * x) * (z / t_1);
		} else {
			tmp_1 = y * x;
		}
		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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original24.3
Target7.3
Herbie5.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 5 regimes
  2. if z < -6.31998665035601711e152

    1. Initial program 53.0

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

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

    if -6.31998665035601711e152 < z < -6.32649944619761107e-175

    1. Initial program 8.9

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

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

    if -6.32649944619761107e-175 < z < 1.91050605510242187e-188

    1. Initial program 18.4

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

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{\frac{\mathsf{hypot}\left(\sqrt{-a \cdot t}, z\right)}{z}}} \]
    4. Applied *-un-lft-identity_binary6416.0

      \[\leadsto \frac{x \cdot y}{\frac{\mathsf{hypot}\left(\sqrt{-a \cdot t}, z\right)}{\color{blue}{1 \cdot z}}} \]
    5. Applied *-un-lft-identity_binary6416.0

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

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

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

      \[\leadsto \color{blue}{x} \cdot \frac{y}{\frac{\mathsf{hypot}\left(\sqrt{-a \cdot t}, z\right)}{z}} \]
    9. Applied distribute-rgt-neg-in_binary6416.2

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

      \[\leadsto x \cdot \frac{y}{\frac{\mathsf{hypot}\left(\color{blue}{\sqrt{a} \cdot \sqrt{-t}}, z\right)}{z}} \]
    11. Taylor expanded in z around 0 12.5

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

    if 1.91050605510242187e-188 < z < 1.19663224696319464e31

    1. Initial program 8.1

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
    2. Applied *-un-lft-identity_binary648.1

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

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

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

    if 1.19663224696319464e31 < z

    1. Initial program 34.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.319986650356017 \cdot 10^{+152}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \leq -6.326499446197611 \cdot 10^{-175}:\\ \;\;\;\;\frac{y \cdot x}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\ \mathbf{elif}\;z \leq 1.910506055102422 \cdot 10^{-188}:\\ \;\;\;\;\frac{y \cdot \left(z \cdot x\right)}{\sqrt{-t}} \cdot \sqrt{\frac{1}{a}}\\ \mathbf{elif}\;z \leq 1.1966322469631946 \cdot 10^{+31}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]

Reproduce

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