Average Error: 7.4 → 2.3
Time: 4.0s
Precision: 64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \le -2.58078959493945681 \cdot 10^{283}:\\ \;\;\;\;\left(x + \frac{y}{t}\right) \cdot \frac{1}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \le 2.62582954099330666 \cdot 10^{250}:\\ \;\;\;\;\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}\;\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \le -2.58078959493945681 \cdot 10^{283}:\\
\;\;\;\;\left(x + \frac{y}{t}\right) \cdot \frac{1}{x + 1}\\

\mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \le 2.62582954099330666 \cdot 10^{250}:\\
\;\;\;\;\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 ((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 ((((double) (((double) (x + ((double) (((double) (((double) (y * z)) - x)) / ((double) (((double) (t * z)) - x)))))) / ((double) (x + 1.0)))) <= -2.580789594939457e+283)) {
		VAR = ((double) (((double) (x + ((double) (y / t)))) * ((double) (1.0 / ((double) (x + 1.0))))));
	} else {
		double VAR_1;
		if ((((double) (((double) (x + ((double) (((double) (((double) (y * z)) - x)) / ((double) (((double) (t * z)) - x)))))) / ((double) (x + 1.0)))) <= 2.6258295409933067e+250)) {
			VAR_1 = ((double) (((double) (x + ((double) (((double) (((double) (y * z)) - x)) / ((double) (((double) (t * z)) - x)))))) * ((double) (1.0 / ((double) (x + 1.0))))));
		} else {
			VAR_1 = ((double) (((double) (x + ((double) (y / t)))) / ((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.4
Target0.4
Herbie2.3
\[\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 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)) < -2.580789594939457e+283

    1. Initial program 59.4

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

      \[\leadsto \color{blue}{\left(x + \frac{y \cdot z - x}{t \cdot z - x}\right) \cdot \frac{1}{x + 1}}\]
    4. Taylor expanded around inf 21.5

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

    if -2.580789594939457e+283 < (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)) < 2.6258295409933067e+250

    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.6258295409933067e+250 < (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0))

    1. Initial program 58.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \le -2.58078959493945681 \cdot 10^{283}:\\ \;\;\;\;\left(x + \frac{y}{t}\right) \cdot \frac{1}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \le 2.62582954099330666 \cdot 10^{250}:\\ \;\;\;\;\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 2020120 
(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)))