Average Error: 7.3 → 3.8
Time: 2.1min
Precision: binary64
Cost: 2114
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -9.328497088022616 \cdot 10^{+141}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;z \leq 1.0879556616863109 \cdot 10^{+222}:\\ \;\;\;\;\frac{x + \frac{z \cdot y - x}{z \cdot t - x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\right) - \frac{x}{z \cdot \left(t \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 -9.328497088022616 \cdot 10^{+141}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

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

\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\right) - \frac{x}{z \cdot \left(t \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 -9.328497088022616e+141)
   (/ (+ x (/ y t)) (+ x 1.0))
   (if (<= z 1.0879556616863109e+222)
     (/ (+ x (/ (- (* z y) x) (- (* z t) x))) (+ x 1.0))
     (-
      (+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0))))
      (/ x (* z (* t (+ 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 <= -9.328497088022616e+141) {
		tmp = (x + (y / t)) / (x + 1.0);
	} else if (z <= 1.0879556616863109e+222) {
		tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0);
	} else {
		tmp = ((x / (x + 1.0)) + (y / (t * (x + 1.0)))) - (x / (z * (t * (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.8
\[\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}\]

Alternatives

Alternative 1
Error3.8
Cost1416
\[\begin{array}{l} \mathbf{if}\;z \leq -1.0695191963954157 \cdot 10^{+142} \lor \neg \left(z \leq 1.0879556616863109 \cdot 10^{+222}\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{z \cdot y - x}{z \cdot t - x}}{x + 1}\\ \end{array}\]
Alternative 2
Error10.1
Cost2244
\[\begin{array}{l} \mathbf{if}\;z \leq -9.670170807005501 \cdot 10^{+141}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{elif}\;z \leq -1.7345976578799139 \cdot 10^{-65}:\\ \;\;\;\;\frac{x + \frac{z \cdot y}{z \cdot t - x}}{x + 1}\\ \mathbf{elif}\;z \leq 2.837635080653265 \cdot 10^{-232}:\\ \;\;\;\;1 - \frac{z \cdot y}{x + x \cdot x}\\ \mathbf{elif}\;z \leq 1.0879556616863109 \cdot 10^{+222}:\\ \;\;\;\;\frac{x + \frac{z \cdot y}{z \cdot t - x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array}\]
Alternative 3
Error11.7
Cost1160
\[\begin{array}{l} \mathbf{if}\;t \leq -8.810507029432719 \cdot 10^{-33} \lor \neg \left(t \leq 0.0034668645918251003\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{x - z \cdot y}{x}}{x + 1}\\ \end{array}\]
Alternative 4
Error11.7
Cost1032
\[\begin{array}{l} \mathbf{if}\;t \leq -8.810507029432719 \cdot 10^{-33} \lor \neg \left(t \leq 0.00042847104283616965\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{z \cdot y}{x + x \cdot x}\\ \end{array}\]
Alternative 5
Error14.5
Cost1218
\[\begin{array}{l} \mathbf{if}\;x \leq -0.0010532974059516956:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1.1248014555164982 \cdot 10^{+54}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 6
Error20.9
Cost776
\[\begin{array}{l} \mathbf{if}\;x \leq -7.109175419512253 \cdot 10^{-16} \lor \neg \left(x \leq 4.693160006787083 \cdot 10^{-76}\right):\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{t}}{x + 1}\\ \end{array}\]
Alternative 7
Error20.9
Cost648
\[\begin{array}{l} \mathbf{if}\;x \leq -1.3325626053870181 \cdot 10^{-15} \lor \neg \left(x \leq 8.393024474691187 \cdot 10^{-78}\right):\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t}\\ \end{array}\]
Alternative 8
Error21.0
Cost834
\[\begin{array}{l} \mathbf{if}\;x \leq -2.10966419312659 \cdot 10^{-05}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 5.75900720157915 \cdot 10^{-79}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array}\]
Alternative 9
Error28.3
Cost64
\[1\]

Error

Derivation

  1. Split input into 3 regimes
  2. if z < -9.32849708802261581e141

    1. Initial program 21.6

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

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1}\]
    3. Simplified6.4

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

    if -9.32849708802261581e141 < z < 1.0879556616863109e222

    1. Initial program 3.2

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

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

    if 1.0879556616863109e222 < z

    1. Initial program 27.5

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

      \[\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. Simplified5.6

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

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

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

Reproduce

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