Average Error: 7.4 → 3.2
Time: 4.9s
Precision: 64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.79387100773201889 \cdot 10^{-122}:\\ \;\;\;\;\frac{1}{\frac{x + 1}{\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 2.684402167383186 \cdot 10^{86}:\\ \;\;\;\;\left(x + \frac{y \cdot z - x}{t \cdot z - x}\right) \cdot \frac{1}{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 -2.79387100773201889 \cdot 10^{-122}:\\
\;\;\;\;\frac{1}{\frac{x + 1}{\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 2.684402167383186 \cdot 10^{86}:\\
\;\;\;\;\left(x + \frac{y \cdot z - x}{t \cdot z - x}\right) \cdot \frac{1}{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 <= -2.793871007732019e-122)) {
		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 <= 2.684402167383186e+86)) {
			temp_1 = ((x + (((y * z) - x) / ((t * z) - x))) * (1.0 / (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.4
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 < -2.793871007732019e-122

    1. Initial program 10.7

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Using strategy rm
    3. Applied div-sub10.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-10.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-sub10.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. Simplified4.5

      \[\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 clear-num4.6

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

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

    if -2.793871007732019e-122 < z < 2.684402167383186e+86

    1. Initial program 0.6

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

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

    if 2.684402167383186e+86 < z

    1. Initial program 19.5

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

      \[\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 -2.79387100773201889 \cdot 10^{-122}:\\ \;\;\;\;\frac{1}{\frac{x + 1}{\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 2.684402167383186 \cdot 10^{86}:\\ \;\;\;\;\left(x + \frac{y \cdot z - x}{t \cdot z - x}\right) \cdot \frac{1}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array}\]

Reproduce

herbie shell --seed 2020058 +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)))