Average Error: 6.9 → 3.5
Time: 3.3s
Precision: 64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
\[\begin{array}{l} \mathbf{if}\;z \le -6.0925830708951564 \cdot 10^{44} \lor \neg \left(z \le 8.00147659353467507 \cdot 10^{41}\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{t \cdot z - x}}}\\ \end{array}\]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
\mathbf{if}\;z \le -6.0925830708951564 \cdot 10^{44} \lor \neg \left(z \le 8.00147659353467507 \cdot 10^{41}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

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

\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 VAR;
	if (((z <= -6.092583070895156e+44) || !(z <= 8.001476593534675e+41))) {
		VAR = ((x + (y / t)) / (x + 1.0));
	} else {
		VAR = (1.0 / ((x + 1.0) / (x + (((y * z) - x) / ((t * z) - x)))));
	}
	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

Original6.9
Target0.3
Herbie3.5
\[\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -6.092583070895156e+44 or 8.001476593534675e+41 < z

    1. Initial program 16.1

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

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

    if -6.092583070895156e+44 < z < 8.001476593534675e+41

    1. Initial program 0.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -6.0925830708951564 \cdot 10^{44} \lor \neg \left(z \le 8.00147659353467507 \cdot 10^{41}\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{x + 1}{x + \frac{y \cdot z - x}{t \cdot z - x}}}\\ \end{array}\]

Reproduce

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