Average Error: 25.1 → 7.7
Time: 3.5s
Precision: 64
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\]
\[\begin{array}{l} \mathbf{if}\;z \le -5.192230488731093 \cdot 10^{36}:\\ \;\;\;\;y \cdot \left(-1 \cdot x\right)\\ \mathbf{elif}\;z \le 2.3156939502955866 \cdot 10^{75}:\\ \;\;\;\;\frac{x \cdot \left(y \cdot z\right)}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot \frac{z}{\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{a}{z}, t, z\right)}\right)\\ \end{array}\]
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\begin{array}{l}
\mathbf{if}\;z \le -5.192230488731093 \cdot 10^{36}:\\
\;\;\;\;y \cdot \left(-1 \cdot x\right)\\

\mathbf{elif}\;z \le 2.3156939502955866 \cdot 10^{75}:\\
\;\;\;\;\frac{x \cdot \left(y \cdot z\right)}{\sqrt{z \cdot z - t \cdot a}}\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \frac{z}{\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{a}{z}, t, z\right)}\right)\\

\end{array}
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 VAR;
	if ((z <= -5.192230488731093e+36)) {
		VAR = (y * (-1.0 * x));
	} else {
		double VAR_1;
		if ((z <= 2.3156939502955866e+75)) {
			VAR_1 = ((x * (y * z)) / sqrt(((z * z) - (t * a))));
		} else {
			VAR_1 = (y * (x * (z / fma((-0.5 * (a / z)), t, z))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.1
Target7.9
Herbie7.7
\[\begin{array}{l} \mathbf{if}\;z \lt -3.1921305903852764 \cdot 10^{46}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z \lt 5.9762681209208942 \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 < -5.192230488731093e+36

    1. Initial program 36.2

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied *-commutative34.0

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\]
    6. Applied associate-/l*34.0

      \[\leadsto \color{blue}{\frac{y}{\frac{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}{x}}}\]
    7. Using strategy rm
    8. Applied clear-num34.0

      \[\leadsto \frac{y}{\frac{\color{blue}{\frac{1}{\frac{z}{\sqrt{z \cdot z - t \cdot a}}}}}{x}}\]
    9. Applied associate-/l/34.0

      \[\leadsto \frac{y}{\color{blue}{\frac{1}{x \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}}}}\]
    10. Applied associate-/r/33.9

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

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

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

    if -5.192230488731093e+36 < z < 2.3156939502955866e+75

    1. Initial program 11.9

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

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

    if 2.3156939502955866e+75 < z

    1. Initial program 40.6

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}\]
    4. Using strategy rm
    5. Applied *-commutative38.1

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\]
    6. Applied associate-/l*38.1

      \[\leadsto \color{blue}{\frac{y}{\frac{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}{x}}}\]
    7. Using strategy rm
    8. Applied clear-num38.1

      \[\leadsto \frac{y}{\frac{\color{blue}{\frac{1}{\frac{z}{\sqrt{z \cdot z - t \cdot a}}}}}{x}}\]
    9. Applied associate-/l/38.1

      \[\leadsto \frac{y}{\color{blue}{\frac{1}{x \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}}}}\]
    10. Applied associate-/r/38.1

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

      \[\leadsto \color{blue}{y} \cdot \left(x \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)\]
    12. Taylor expanded around inf 5.7

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

      \[\leadsto y \cdot \left(x \cdot \frac{z}{\color{blue}{\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{a}{z}, t, z\right)}}\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification7.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -5.192230488731093 \cdot 10^{36}:\\ \;\;\;\;y \cdot \left(-1 \cdot x\right)\\ \mathbf{elif}\;z \le 2.3156939502955866 \cdot 10^{75}:\\ \;\;\;\;\frac{x \cdot \left(y \cdot z\right)}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot \frac{z}{\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{a}{z}, t, z\right)}\right)\\ \end{array}\]

Reproduce

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