Average Error: 24.9 → 7.0
Time: 10.1s
Precision: binary64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
\[\begin{array}{l} \mathbf{if}\;z \leq -1.0422014424664703 \cdot 10^{+91}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \leq 4.967878028669063 \cdot 10^{+25}:\\ \;\;\;\;\begin{array}{l} t_1 := \sqrt{\sqrt{z \cdot z - t \cdot a}}\\ \frac{y \cdot x}{t_1} \cdot \frac{z}{t_1} \end{array}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\begin{array}{l}
\mathbf{if}\;z \leq -1.0422014424664703 \cdot 10^{+91}:\\
\;\;\;\;-y \cdot x\\

\mathbf{elif}\;z \leq 4.967878028669063 \cdot 10^{+25}:\\
\;\;\;\;\begin{array}{l}
t_1 := \sqrt{\sqrt{z \cdot z - t \cdot a}}\\
\frac{y \cdot x}{t_1} \cdot \frac{z}{t_1}
\end{array}\\

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


\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 -1.0422014424664703e+91)
   (- (* y x))
   (if (<= z 4.967878028669063e+25)
     (let* ((t_1 (sqrt (sqrt (- (* z z) (* t a))))))
       (* (/ (* y x) t_1) (/ 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 <= -1.0422014424664703e+91) {
		tmp = -(y * x);
	} else if (z <= 4.967878028669063e+25) {
		double t_1 = sqrt(sqrt((z * z) - (t * a)));
		tmp = ((y * x) / t_1) * (z / t_1);
	} else {
		tmp = y * x;
	}
	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.9
Target7.7
Herbie7.0
\[\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 < -1.0422014424664703e91

    1. Initial program 43.0

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

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

      \[\leadsto \color{blue}{-y \cdot x} \]

    if -1.0422014424664703e91 < z < 4.96787802866906328e25

    1. Initial program 11.0

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
    2. Applied add-sqr-sqrt_binary6411.2

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

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

    if 4.96787802866906328e25 < z

    1. Initial program 35.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.0422014424664703 \cdot 10^{+91}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \leq 4.967878028669063 \cdot 10^{+25}:\\ \;\;\;\;\frac{y \cdot x}{\sqrt{\sqrt{z \cdot z - t \cdot a}}} \cdot \frac{z}{\sqrt{\sqrt{z \cdot z - t \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]

Reproduce

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