Average Error: 6.8 → 1.9
Time: 7.2s
Precision: binary64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \leq -8.815637691747206 \cdot 10^{-87} \lor \neg \left(x \leq 3.5767859404124596 \cdot 10^{-131}\right):\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x \leq -8.815637691747206 \cdot 10^{-87} \lor \neg \left(x \leq 3.5767859404124596 \cdot 10^{-131}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -8.815637691747206e-87) (not (<= x 3.5767859404124596e-131)))
   (+ x (* (/ y t) (- z x)))
   (+ x (/ y (/ t (- z x))))))
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 <= -8.815637691747206e-87) || !(x <= 3.5767859404124596e-131)) {
		tmp = x + ((y / t) * (z - x));
	} else {
		tmp = x + (y / (t / (z - x)));
	}
	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.8
Target1.9
Herbie1.9
\[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 < -8.81575e-87 or 3.57679e-131 < x

    1. Initial program 7.7

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Using strategy rm
    3. Applied associate-/l*_binary64_44906.0

      \[\leadsto x + \color{blue}{\frac{y}{\frac{t}{z - x}}}\]
    4. Using strategy rm
    5. Applied associate-/r/_binary64_44910.5

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

    if -8.81575e-87 < x < 3.57679e-131

    1. Initial program 5.2

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Using strategy rm
    3. Applied associate-/l*_binary64_44904.5

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

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

Reproduce

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