Average Error: 6.4 → 2.0
Time: 6.5s
Precision: binary64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1960217229363404 \cdot 10^{-83} \lor \neg \left(x \leq 1.020953492061312 \cdot 10^{-244}\right):\\ \;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{t}{\left(z - x\right) \cdot y}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x \leq -1.1960217229363404 \cdot 10^{-83} \lor \neg \left(x \leq 1.020953492061312 \cdot 10^{-244}\right):\\
\;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{1}{\frac{t}{\left(z - x\right) \cdot y}}\\

\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -1.1960217229363404e-83) (not (<= x 1.020953492061312e-244)))
   (+ x (/ (- z x) (/ t y)))
   (+ x (/ 1.0 (/ t (* (- z x) y))))))
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 <= -1.1960217229363404e-83) || !(x <= 1.020953492061312e-244)) {
		tmp = x + ((z - x) / (t / y));
	} else {
		tmp = x + (1.0 / (t / ((z - x) * y)));
	}
	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.4
Target2.2
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 < -1.19602172293634039e-83 or 1.02095349206131194e-244 < x

    1. Initial program 6.9

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

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

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

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

      \[\leadsto x + \frac{1}{\color{blue}{\frac{1}{z - x} \cdot \frac{t}{y}}}\]
    8. Applied associate-/r*_binary64_116161.0

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

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

    if -1.19602172293634039e-83 < x < 1.02095349206131194e-244

    1. Initial program 4.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.1960217229363404 \cdot 10^{-83} \lor \neg \left(x \leq 1.020953492061312 \cdot 10^{-244}\right):\\ \;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{t}{\left(z - x\right) \cdot y}}\\ \end{array}\]

Reproduce

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