Average Error: 5.9 → 1.6
Time: 3.3s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.02195796067103927 \cdot 10^{101} \lor \neg \left(t \le 1.99437682044040998 \cdot 10^{-19}\right):\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;t \le -1.02195796067103927 \cdot 10^{101} \lor \neg \left(t \le 1.99437682044040998 \cdot 10^{-19}\right):\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\

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

\end{array}
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 VAR;
	if (((t <= -1.0219579606710393e+101) || !(t <= 1.99437682044041e-19))) {
		VAR = (x + ((y / t) * (z - x)));
	} else {
		VAR = (x + ((y * (z - x)) * (1.0 / t)));
	}
	return VAR;
}

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

Original5.9
Target2.0
Herbie1.6
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 2 regimes
  2. if t < -1.0219579606710393e+101 or 1.99437682044041e-19 < t

    1. Initial program 9.0

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

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

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

    if -1.0219579606710393e+101 < t < 1.99437682044041e-19

    1. Initial program 2.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.02195796067103927 \cdot 10^{101} \lor \neg \left(t \le 1.99437682044040998 \cdot 10^{-19}\right):\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t}\\ \end{array}\]

Reproduce

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