Average Error: 7.8 → 3.7
Time: 4.1s
Precision: 64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.681890316947814 \cdot 10^{58}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;z \le 9.89867328733950834 \cdot 10^{-82}:\\ \;\;\;\;\frac{x + \frac{y \cdot z - x}{\left(\sqrt[3]{t \cdot z - x} \cdot \sqrt[3]{t \cdot z - x}\right) \cdot \sqrt[3]{t \cdot z - x}}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\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}\\ \end{array}\]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
\mathbf{if}\;z \le -2.681890316947814 \cdot 10^{58}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

\mathbf{elif}\;z \le 9.89867328733950834 \cdot 10^{-82}:\\
\;\;\;\;\frac{x + \frac{y \cdot z - x}{\left(\sqrt[3]{t \cdot z - x} \cdot \sqrt[3]{t \cdot z - x}\right) \cdot \sqrt[3]{t \cdot z - x}}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\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}\\

\end{array}
double code(double x, double y, double z, double t) {
	return ((double) (((double) (x + ((double) (((double) (((double) (y * z)) - x)) / ((double) (((double) (t * z)) - x)))))) / ((double) (x + 1.0))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((z <= -2.681890316947814e+58)) {
		VAR = ((double) (((double) (x + ((double) (y / t)))) / ((double) (x + 1.0))));
	} else {
		double VAR_1;
		if ((z <= 9.898673287339508e-82)) {
			VAR_1 = ((double) (((double) (x + ((double) (((double) (((double) (y * z)) - x)) / ((double) (((double) (((double) cbrt(((double) (((double) (t * z)) - x)))) * ((double) cbrt(((double) (((double) (t * z)) - x)))))) * ((double) cbrt(((double) (((double) (t * z)) - x)))))))))) / ((double) (x + 1.0))));
		} else {
			VAR_1 = ((double) (((double) (((double) (1.0 / ((double) (x + 1.0)))) * ((double) fma(((double) (y / ((double) (((double) (t * z)) - x)))), z, x)))) - ((double) (((double) (x / ((double) (((double) (t * z)) - x)))) / ((double) (x + 1.0))))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.8
Target0.4
Herbie3.7
\[\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.681890316947814e+58

    1. Initial program 18.9

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

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

    if -2.681890316947814e+58 < z < 9.898673287339508e-82

    1. Initial program 0.4

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt0.9

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

    if 9.898673287339508e-82 < z

    1. Initial program 12.3

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

      \[\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-12.3

      \[\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-sub12.3

      \[\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. Simplified5.1

      \[\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-identity5.1

      \[\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-frac5.2

      \[\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. Simplified5.2

      \[\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}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification3.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.681890316947814 \cdot 10^{58}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;z \le 9.89867328733950834 \cdot 10^{-82}:\\ \;\;\;\;\frac{x + \frac{y \cdot z - x}{\left(\sqrt[3]{t \cdot z - x} \cdot \sqrt[3]{t \cdot z - x}\right) \cdot \sqrt[3]{t \cdot z - x}}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\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}\\ \end{array}\]

Reproduce

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