Average Error: 7.5 → 3.4
Time: 12.9s
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.866042173132971 \cdot 10^{+275}:\\ \;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t + x \cdot t}\right) - \frac{x}{z \cdot \left(t + x \cdot t\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.866042173132971 \cdot 10^{+275}:\\
\;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t + x \cdot t}\right) - \frac{x}{z \cdot \left(t + x \cdot t\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.866042173132971e+275)
   (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))
   (- (+ (/ x (+ x 1.0)) (/ y (+ t (* x t)))) (/ x (* z (+ t (* x t)))))))
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.866042173132971e+275) {
		tmp = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
	} else {
		tmp = ((x / (x + 1.0)) + (y / (t + (x * t)))) - (x / (z * (t + (x * t))));
	}
	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.3
Herbie3.4
\[\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 (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 1.8660421731329709e275

    1. Initial program 2.7

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

    if 1.8660421731329709e275 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1))

    1. Initial program 60.7

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

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

      \[\leadsto \frac{x + \frac{1}{\color{blue}{\frac{t \cdot z - x}{z \cdot y - x}}}}{x + 1}\]
    5. Taylor expanded around inf 11.6

      \[\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)}}\]
    6. Simplified11.6

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

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

Reproduce

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