Average Error: 7.6 → 6.8
Time: 4.6s
Precision: binary64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -1.2449024052312966 \cdot 10^{+145}:\\ \;\;\;\;\frac{1}{\frac{x + 1}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{\frac{1}{z \cdot t - x}}{\frac{1}{z \cdot y - x}}}{x + 1}\\ \end{array}\]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
\mathbf{if}\;x \leq -1.2449024052312966 \cdot 10^{+145}:\\
\;\;\;\;\frac{1}{\frac{x + 1}{x}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{\frac{1}{z \cdot t - x}}{\frac{1}{z \cdot y - x}}}{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 (<= x -1.2449024052312966e+145)
   (/ 1.0 (/ (+ x 1.0) x))
   (/ (+ x (/ (/ 1.0 (- (* z t) x)) (/ 1.0 (- (* z y) x)))) (+ 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 <= -1.2449024052312966e+145) {
		tmp = 1.0 / ((x + 1.0) / x);
	} else {
		tmp = (x + ((1.0 / ((z * t) - x)) / (1.0 / ((z * y) - x)))) / (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.6
Target0.4
Herbie6.8
\[\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 x < -1.24490240523129657e145

    1. Initial program 8.7

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary648.7

      \[\leadsto \frac{x + \color{blue}{1 \cdot \frac{y \cdot z - x}{t \cdot z - x}}}{x + 1}\]
    4. Applied *-un-lft-identity_binary648.7

      \[\leadsto \frac{\color{blue}{1 \cdot x} + 1 \cdot \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    5. Applied distribute-lft-out_binary648.7

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x + \frac{y \cdot z - x}{t \cdot z - x}\right)}}{x + 1}\]
    6. Applied associate-/l*_binary648.7

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

      \[\leadsto \frac{1}{\color{blue}{\frac{x + 1}{x + \frac{y \cdot z - x}{z \cdot t - x}}}}\]
    8. Taylor expanded around 0 2.1

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

    if -1.24490240523129657e145 < x

    1. Initial program 7.5

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary647.5

      \[\leadsto \frac{x + \frac{\color{blue}{1 \cdot \left(y \cdot z - x\right)}}{t \cdot z - x}}{x + 1}\]
    4. Applied associate-/l*_binary647.5

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

      \[\leadsto \frac{x + \frac{1}{\color{blue}{\frac{z \cdot t - x}{y \cdot z - x}}}}{x + 1}\]
    6. Using strategy rm
    7. Applied div-inv_binary647.5

      \[\leadsto \frac{x + \frac{1}{\color{blue}{\left(z \cdot t - x\right) \cdot \frac{1}{y \cdot z - x}}}}{x + 1}\]
    8. Applied associate-/r*_binary647.5

      \[\leadsto \frac{x + \color{blue}{\frac{\frac{1}{z \cdot t - x}}{\frac{1}{y \cdot z - x}}}}{x + 1}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification6.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.2449024052312966 \cdot 10^{+145}:\\ \;\;\;\;\frac{1}{\frac{x + 1}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{\frac{1}{z \cdot t - x}}{\frac{1}{z \cdot y - x}}}{x + 1}\\ \end{array}\]

Reproduce

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