Average Error: 7.4 → 3.2
Time: 4.3s
Precision: binary64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -6.265345281220906 \cdot 10^{-32}:\\ \;\;\;\;\frac{x + \left(z \cdot \left(y \cdot \frac{1}{z \cdot t - x}\right) - \frac{x}{z \cdot t - x}\right)}{x + 1}\\ \mathbf{elif}\;z \leq 1.1093987823313588 \cdot 10^{+84}:\\ \;\;\;\;\frac{x + \frac{1}{\frac{z \cdot t - x}{z \cdot y - 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 \leq -6.265345281220906 \cdot 10^{-32}:\\
\;\;\;\;\frac{x + \left(z \cdot \left(y \cdot \frac{1}{z \cdot t - x}\right) - \frac{x}{z \cdot t - x}\right)}{x + 1}\\

\mathbf{elif}\;z \leq 1.1093987823313588 \cdot 10^{+84}:\\
\;\;\;\;\frac{x + \frac{1}{\frac{z \cdot t - x}{z \cdot y - x}}}{x + 1}\\

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

\end{array}
(FPCore (x y z t)
 :precision binary64
 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
(FPCore (x y z t)
 :precision binary64
 (if (<= z -6.265345281220906e-32)
   (/
    (+ x (- (* z (* y (/ 1.0 (- (* z t) x)))) (/ x (- (* z t) x))))
    (+ x 1.0))
   (if (<= z 1.1093987823313588e+84)
     (/ (+ x (/ 1.0 (/ (- (* z t) x) (- (* z y) x)))) (+ x 1.0))
     (/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
	return (((double) (x + (((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 tmp;
	if ((z <= -6.265345281220906e-32)) {
		tmp = (((double) (x + ((double) (((double) (z * ((double) (y * (1.0 / ((double) (((double) (z * t)) - x))))))) - (x / ((double) (((double) (z * t)) - x))))))) / ((double) (x + 1.0)));
	} else {
		double tmp_1;
		if ((z <= 1.1093987823313588e+84)) {
			tmp_1 = (((double) (x + (1.0 / (((double) (((double) (z * t)) - x)) / ((double) (((double) (z * y)) - x)))))) / ((double) (x + 1.0)));
		} else {
			tmp_1 = (((double) (x + (y / t))) / ((double) (x + 1.0)));
		}
		tmp = tmp_1;
	}
	return tmp;
}

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
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.26534528122090565e-32

    1. Initial program Error: 13.7 bits

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

      \[\leadsto \frac{x + \color{blue}{\left(\frac{y \cdot z}{t \cdot z - x} - \frac{x}{t \cdot z - x}\right)}}{x + 1}\]
    4. SimplifiedError: 5.4 bits

      \[\leadsto \frac{x + \left(\color{blue}{z \cdot \frac{y}{z \cdot t - x}} - \frac{x}{t \cdot z - x}\right)}{x + 1}\]
    5. SimplifiedError: 5.4 bits

      \[\leadsto \frac{x + \left(z \cdot \frac{y}{z \cdot t - x} - \color{blue}{\frac{x}{z \cdot t - x}}\right)}{x + 1}\]
    6. Using strategy rm
    7. Applied div-invError: 5.4 bits

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

    if -6.26534528122090565e-32 < z < 1.10939878233135884e84

    1. Initial program Error: 0.6 bits

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

      \[\leadsto \frac{x + \color{blue}{\frac{1}{\frac{t \cdot z - x}{y \cdot z - x}}}}{x + 1}\]
    4. SimplifiedError: 0.6 bits

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

    if 1.10939878233135884e84 < z

    1. Initial program Error: 19.4 bits

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.265345281220906 \cdot 10^{-32}:\\ \;\;\;\;\frac{x + \left(z \cdot \left(y \cdot \frac{1}{z \cdot t - x}\right) - \frac{x}{z \cdot t - x}\right)}{x + 1}\\ \mathbf{elif}\;z \leq 1.1093987823313588 \cdot 10^{+84}:\\ \;\;\;\;\frac{x + \frac{1}{\frac{z \cdot t - x}{z \cdot y - x}}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array}\]

Reproduce

herbie shell --seed 2020203 
(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.0))

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