Average Error: 6.2 → 2.0
Time: 8.1s
Precision: binary64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \leq 3.4318297806200757 \cdot 10^{-307} \lor \neg \left(x \leq 1.6885056191188459 \cdot 10^{-211}\right):\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - x}{t}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x \leq 3.4318297806200757 \cdot 10^{-307} \lor \neg \left(x \leq 1.6885056191188459 \cdot 10^{-211}\right):\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\

\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x 3.4318297806200757e-307) (not (<= x 1.6885056191188459e-211)))
   (+ x (* (- z x) (/ y t)))
   (+ x (* y (/ (- z x) t)))))
double code(double x, double y, double z, double t) {
	return x + ((y * (z - x)) / t);
}
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= 3.4318297806200757e-307) || !(x <= 1.6885056191188459e-211)) {
		tmp = x + ((z - x) * (y / t));
	} else {
		tmp = x + (y * ((z - 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

Original6.2
Target2.3
Herbie2.0
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 2 regimes
  2. if x < 3.4318297806200757e-307 or 1.6885056191188459e-211 < x

    1. Initial program 6.2

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Using strategy rm
    3. Applied clear-num_binary64_109896.3

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

      \[\leadsto x + \frac{1}{\color{blue}{\frac{t}{\left(z - x\right) \cdot y}}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity_binary64_109906.3

      \[\leadsto x + \frac{1}{\frac{\color{blue}{1 \cdot t}}{\left(z - x\right) \cdot y}}\]
    7. Applied times-frac_binary64_109961.8

      \[\leadsto x + \frac{1}{\color{blue}{\frac{1}{z - x} \cdot \frac{t}{y}}}\]
    8. Applied add-sqr-sqrt_binary64_110121.8

      \[\leadsto x + \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{\frac{1}{z - x} \cdot \frac{t}{y}}\]
    9. Applied times-frac_binary64_109961.9

      \[\leadsto x + \color{blue}{\frac{\sqrt{1}}{\frac{1}{z - x}} \cdot \frac{\sqrt{1}}{\frac{t}{y}}}\]
    10. Simplified1.9

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

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

    if 3.4318297806200757e-307 < x < 1.6885056191188459e-211

    1. Initial program 5.4

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary64_109905.4

      \[\leadsto x + \frac{y \cdot \left(z - x\right)}{\color{blue}{1 \cdot t}}\]
    4. Applied times-frac_binary64_109964.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3.4318297806200757 \cdot 10^{-307} \lor \neg \left(x \leq 1.6885056191188459 \cdot 10^{-211}\right):\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - x}{t}\\ \end{array}\]

Reproduce

herbie shell --seed 2021098 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
  :precision binary64

  :herbie-target
  (- x (+ (* x (/ y t)) (* (- z) (/ y t))))

  (+ x (/ (* y (- z x)) t)))