Average Error: 7.5 → 3.2
Time: 12.1s
Precision: binary64
\[\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}{z \cdot t - x}}{x + 1} \leq -1.827951620185827 \cdot 10^{+18}:\\ \;\;\;\;\frac{y \cdot z}{\left(z \cdot t - x\right) \cdot \left(x + 1\right)}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2.8875763343058745 \cdot 10^{-46}:\\ \;\;\;\;\frac{x + \left(\left(\frac{y}{t} + \frac{x \cdot y}{t \cdot \left(z \cdot t\right)}\right) - \frac{x}{z \cdot t}\right)}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2.159075804414875 \cdot 10^{+307}:\\ \;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{t \cdot \left(x + 1\right)} + \frac{x}{x + 1}\right) - \frac{x}{t \cdot \left(z \cdot \left(x + 1\right)\right)}\\ \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}{z \cdot t - x}}{x + 1} \leq -1.827951620185827 \cdot 10^{+18}:\\
\;\;\;\;\frac{y \cdot z}{\left(z \cdot t - x\right) \cdot \left(x + 1\right)}\\

\mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2.8875763343058745 \cdot 10^{-46}:\\
\;\;\;\;\frac{x + \left(\left(\frac{y}{t} + \frac{x \cdot y}{t \cdot \left(z \cdot t\right)}\right) - \frac{x}{z \cdot t}\right)}{x + 1}\\

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

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

\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 (<=
      (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))
      -1.827951620185827e+18)
   (/ (* y z) (* (- (* z t) x) (+ x 1.0)))
   (if (<=
        (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))
        2.8875763343058745e-46)
     (/
      (+ x (- (+ (/ y t) (/ (* x y) (* t (* z t)))) (/ x (* z t))))
      (+ x 1.0))
     (if (<=
          (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))
          2.159075804414875e+307)
       (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))
       (-
        (+ (/ y (* t (+ x 1.0))) (/ x (+ x 1.0)))
        (/ x (* t (* z (+ x 1.0)))))))))
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 tmp;
	if (((x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0)) <= -1.827951620185827e+18) {
		tmp = (y * z) / (((z * t) - x) * (x + 1.0));
	} else if (((x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0)) <= 2.8875763343058745e-46) {
		tmp = (x + (((y / t) + ((x * y) / (t * (z * t)))) - (x / (z * t)))) / (x + 1.0);
	} else if (((x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0)) <= 2.159075804414875e+307) {
		tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
	} else {
		tmp = ((y / (t * (x + 1.0))) + (x / (x + 1.0))) - (x / (t * (z * (x + 1.0))));
	}
	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.5
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 4 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -1827951620185827070

    1. Initial program 18.9

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

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

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

    if -1827951620185827070 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 2.8875763343058745e-46

    1. Initial program 3.0

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

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

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

    if 2.8875763343058745e-46 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 2.1590758044148749e307

    1. Initial program 0.1

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

    if 2.1590758044148749e307 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1))

    1. Initial program 63.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq -1.827951620185827 \cdot 10^{+18}:\\ \;\;\;\;\frac{y \cdot z}{\left(z \cdot t - x\right) \cdot \left(x + 1\right)}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2.8875763343058745 \cdot 10^{-46}:\\ \;\;\;\;\frac{x + \left(\left(\frac{y}{t} + \frac{x \cdot y}{t \cdot \left(z \cdot t\right)}\right) - \frac{x}{z \cdot t}\right)}{x + 1}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 2.159075804414875 \cdot 10^{+307}:\\ \;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{y}{t \cdot \left(x + 1\right)} + \frac{x}{x + 1}\right) - \frac{x}{t \cdot \left(z \cdot \left(x + 1\right)\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2021059 
(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)))