Average Error: 6.3 → 1.7
Time: 3.9s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -4.9055154236988358 \cdot 10^{-116}:\\ \;\;\;\;x + \frac{\frac{y}{t}}{\frac{1}{z - x}}\\ \mathbf{elif}\;t \le 1.3978448114834497 \cdot 10^{-40}:\\ \;\;\;\;x + \frac{1}{\frac{t}{y \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 -4.9055154236988358 \cdot 10^{-116}:\\
\;\;\;\;x + \frac{\frac{y}{t}}{\frac{1}{z - x}}\\

\mathbf{elif}\;t \le 1.3978448114834497 \cdot 10^{-40}:\\
\;\;\;\;x + \frac{1}{\frac{t}{y \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 ((double) (x + ((double) (((double) (y * ((double) (z - x)))) / t))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((t <= -4.905515423698836e-116)) {
		VAR = ((double) (x + ((double) (((double) (y / t)) / ((double) (1.0 / ((double) (z - x))))))));
	} else {
		double VAR_1;
		if ((t <= 1.3978448114834497e-40)) {
			VAR_1 = ((double) (x + ((double) (1.0 / ((double) (t / ((double) (y * ((double) (z - x))))))))));
		} else {
			VAR_1 = ((double) (x + ((double) (y * ((double) (((double) (z - x)) / t))))));
		}
		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.3
Target2.0
Herbie1.7
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 3 regimes
  2. if t < -4.905515423698836e-116

    1. Initial program 7.0

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

      \[\leadsto x + \color{blue}{\frac{y}{\frac{t}{z - x}}}\]
    4. Using strategy rm
    5. Applied div-inv2.1

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

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

    if -4.905515423698836e-116 < t < 1.3978448114834497e-40

    1. Initial program 2.5

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

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

    if 1.3978448114834497e-40 < t

    1. Initial program 8.3

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -4.9055154236988358 \cdot 10^{-116}:\\ \;\;\;\;x + \frac{\frac{y}{t}}{\frac{1}{z - x}}\\ \mathbf{elif}\;t \le 1.3978448114834497 \cdot 10^{-40}:\\ \;\;\;\;x + \frac{1}{\frac{t}{y \cdot \left(z - x\right)}}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - x}{t}\\ \end{array}\]

Reproduce

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