Average Error: 6.1 → 2.0
Time: 5.5s
Precision: binary64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \le -3.4760467715488486 \cdot 10^{-259}:\\ \;\;\;\;x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z - x}{\sqrt[3]{t}}\\ \mathbf{elif}\;x + \frac{y \cdot \left(z - x\right)}{t} \le 6.66498605674414355 \cdot 10^{303}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(\frac{z}{t} - \frac{x}{t}\right)\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \le -3.4760467715488486 \cdot 10^{-259}:\\
\;\;\;\;x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z - x}{\sqrt[3]{t}}\\

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

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

\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 ((((double) (x + ((double) (((double) (y * ((double) (z - x)))) / t)))) <= -3.4760467715488486e-259)) {
		VAR = ((double) (x + ((double) (((double) (y / ((double) (((double) cbrt(t)) * ((double) cbrt(t)))))) * ((double) (((double) (z - x)) / ((double) cbrt(t))))))));
	} else {
		double VAR_1;
		if ((((double) (x + ((double) (((double) (y * ((double) (z - x)))) / t)))) <= 6.664986056744144e+303)) {
			VAR_1 = ((double) (x + ((double) (((double) (y * ((double) (z - x)))) / t))));
		} else {
			VAR_1 = ((double) (x + ((double) (y * ((double) (((double) (z / t)) - ((double) (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.1
Target2.3
Herbie2.0
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 3 regimes
  2. if (+ x (/ (* y (- z x)) t)) < -3.4760467715488486e-259

    1. Initial program 5.9

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

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

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

    if -3.4760467715488486e-259 < (+ x (/ (* y (- z x)) t)) < 6.66498605674414355e303

    1. Initial program 1.0

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

    if 6.66498605674414355e303 < (+ x (/ (* y (- z x)) t))

    1. Initial program 58.3

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

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

      \[\leadsto x + \color{blue}{\frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z - x}{\sqrt[3]{t}}}\]
    5. Taylor expanded around 0 58.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \le -3.4760467715488486 \cdot 10^{-259}:\\ \;\;\;\;x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z - x}{\sqrt[3]{t}}\\ \mathbf{elif}\;x + \frac{y \cdot \left(z - x\right)}{t} \le 6.66498605674414355 \cdot 10^{303}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(\frac{z}{t} - \frac{x}{t}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020168 
(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)) (* (neg z) (/ y t))))

  (+ x (/ (* y (- z x)) t)))