Average Error: 7.3 → 3.5
Time: 9.2s
Precision: binary64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
\[\begin{array}{l} \mathbf{if}\;z \leq -8.82873067419859 \cdot 10^{+141}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;z \leq 5.6823258675690636 \cdot 10^{+138}:\\ \;\;\;\;\begin{array}{l} t_1 := z \cdot t - x\\ \frac{z \cdot y}{\left(x + 1\right) \cdot t_1} + \frac{x - \frac{x}{t_1}}{x + 1} \end{array}\\ \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}\;z \leq -8.82873067419859 \cdot 10^{+141}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

\mathbf{elif}\;z \leq 5.6823258675690636 \cdot 10^{+138}:\\
\;\;\;\;\begin{array}{l}
t_1 := z \cdot t - x\\
\frac{z \cdot y}{\left(x + 1\right) \cdot t_1} + \frac{x - \frac{x}{t_1}}{x + 1}
\end{array}\\

\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 (<= z -8.82873067419859e+141)
   (/ (+ x (/ y t)) (+ x 1.0))
   (if (<= z 5.6823258675690636e+138)
     (let* ((t_1 (- (* z t) x)))
       (+ (/ (* z y) (* (+ x 1.0) t_1)) (/ (- x (/ x t_1)) (+ 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 (z <= -8.82873067419859e+141) {
		tmp = (x + (y / t)) / (x + 1.0);
	} else if (z <= 5.6823258675690636e+138) {
		double t_1 = (z * t) - x;
		tmp = ((z * y) / ((x + 1.0) * t_1)) + ((x - (x / t_1)) / (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.3
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 3 regimes
  2. if z < -8.82873067419859e141

    1. Initial program 21.7

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

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

    if -8.82873067419859e141 < z < 5.6823258675690636e138

    1. Initial program 2.3

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

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

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{x + \frac{z \cdot y - x}{t \cdot z - x}}{x + 1}\right)}^{3}}} \]
    5. Taylor expanded around 0 2.3

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

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

    if 5.6823258675690636e138 < z

    1. Initial program 21.2

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

      \[\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 3 regimes into one program.
  4. Final simplification3.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.82873067419859 \cdot 10^{+141}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;z \leq 5.6823258675690636 \cdot 10^{+138}:\\ \;\;\;\;\frac{z \cdot y}{\left(x + 1\right) \cdot \left(z \cdot t - x\right)} + \frac{x - \frac{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 2021196 
(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)))