Average Error: 7.7 → 3.2
Time: 4.7s
Precision: 64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
\[\begin{array}{l} \mathbf{if}\;z \le -6.3088357711862659 \cdot 10^{63}:\\ \;\;\;\;\frac{1}{x + 1} \cdot \mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right) - \frac{\frac{x}{t \cdot z - x}}{x + 1}\\ \mathbf{elif}\;z \le 4.56682903308585354 \cdot 10^{76}:\\ \;\;\;\;\frac{x + \frac{1}{\frac{t \cdot z - x}{y \cdot z - x}}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array}\]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
\mathbf{if}\;z \le -6.3088357711862659 \cdot 10^{63}:\\
\;\;\;\;\frac{1}{x + 1} \cdot \mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right) - \frac{\frac{x}{t \cdot z - x}}{x + 1}\\

\mathbf{elif}\;z \le 4.56682903308585354 \cdot 10^{76}:\\
\;\;\;\;\frac{x + \frac{1}{\frac{t \cdot z - x}{y \cdot z - x}}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

\end{array}
double code(double x, double y, double z, double t) {
	return ((x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0));
}
double code(double x, double y, double z, double t) {
	double temp;
	if ((z <= -6.308835771186266e+63)) {
		temp = (((1.0 / (x + 1.0)) * fma((y / ((t * z) - x)), z, x)) - ((x / ((t * z) - x)) / (x + 1.0)));
	} else {
		double temp_1;
		if ((z <= 4.5668290330858535e+76)) {
			temp_1 = ((x + (1.0 / (((t * z) - x) / ((y * z) - x)))) / (x + 1.0));
		} else {
			temp_1 = ((x + (y / t)) / (x + 1.0));
		}
		temp = temp_1;
	}
	return temp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.7
Target0.3
Herbie3.2
\[\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -6.308835771186266e+63

    1. Initial program 18.7

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Using strategy rm
    3. Applied div-sub18.7

      \[\leadsto \frac{x + \color{blue}{\left(\frac{y \cdot z}{t \cdot z - x} - \frac{x}{t \cdot z - x}\right)}}{x + 1}\]
    4. Applied associate-+r-18.7

      \[\leadsto \frac{\color{blue}{\left(x + \frac{y \cdot z}{t \cdot z - x}\right) - \frac{x}{t \cdot z - x}}}{x + 1}\]
    5. Applied div-sub18.7

      \[\leadsto \color{blue}{\frac{x + \frac{y \cdot z}{t \cdot z - x}}{x + 1} - \frac{\frac{x}{t \cdot z - x}}{x + 1}}\]
    6. Simplified7.9

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right)}{\left(x + 1\right) \cdot 1}} - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity7.9

      \[\leadsto \frac{\color{blue}{1 \cdot \mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right)}}{\left(x + 1\right) \cdot 1} - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    9. Applied times-frac8.0

      \[\leadsto \color{blue}{\frac{1}{x + 1} \cdot \frac{\mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right)}{1}} - \frac{\frac{x}{t \cdot z - x}}{x + 1}\]
    10. Simplified8.0

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

    if -6.308835771186266e+63 < z < 4.5668290330858535e+76

    1. Initial program 0.7

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Using strategy rm
    3. Applied clear-num0.7

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

    if 4.5668290330858535e+76 < z

    1. Initial program 20.2

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Taylor expanded around inf 7.0

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification3.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -6.3088357711862659 \cdot 10^{63}:\\ \;\;\;\;\frac{1}{x + 1} \cdot \mathsf{fma}\left(\frac{y}{t \cdot z - x}, z, x\right) - \frac{\frac{x}{t \cdot z - x}}{x + 1}\\ \mathbf{elif}\;z \le 4.56682903308585354 \cdot 10^{76}:\\ \;\;\;\;\frac{x + \frac{1}{\frac{t \cdot z - x}{y \cdot z - x}}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array}\]

Reproduce

herbie shell --seed 2020057 +o rules:numerics
(FPCore (x y z t)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, A"
  :precision binary64

  :herbie-target
  (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1))

  (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1)))