Average Error: 6.8 → 1.9
Time: 4.7s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -800510684912870016:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{elif}\;t \le 6.914397869719574 \cdot 10^{-218}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{elif}\;t \le 2.2207595967095594 \cdot 10^{-126}:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \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}\;t \le -800510684912870016:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\

\mathbf{elif}\;t \le 6.914397869719574 \cdot 10^{-218}:\\
\;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\

\mathbf{elif}\;t \le 2.2207595967095594 \cdot 10^{-126}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\

\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - x}{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 <= -8.0051068491287e+17)) {
		VAR = (x + (y / (t / (z - x))));
	} else {
		double VAR_1;
		if ((t <= 6.914397869719574e-218)) {
			VAR_1 = (x + ((y * (z - x)) / t));
		} else {
			double VAR_2;
			if ((t <= 2.2207595967095594e-126)) {
				VAR_2 = (x + ((y / t) * (z - x)));
			} else {
				VAR_2 = (x + (y * ((z - x) / t)));
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	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

Original6.8
Target2.1
Herbie1.9
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 4 regimes
  2. if t < -8.0051068491287e+17

    1. Initial program 9.8

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

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

    if -8.0051068491287e+17 < t < 6.914397869719574e-218

    1. Initial program 2.0

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

    if 6.914397869719574e-218 < t < 2.2207595967095594e-126

    1. Initial program 2.3

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

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

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

    if 2.2207595967095594e-126 < t

    1. Initial program 8.2

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -800510684912870016:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{elif}\;t \le 6.914397869719574 \cdot 10^{-218}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{elif}\;t \le 2.2207595967095594 \cdot 10^{-126}:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - x}{t}\\ \end{array}\]

Reproduce

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