Average Error: 6.4 → 1.8
Time: 4.2s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.1794824165367897 \cdot 10^{-126}:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{elif}\;x \le -5.76861790673687925 \cdot 10^{-285}:\\ \;\;\;\;x + \frac{1}{t \cdot \frac{1}{y \cdot \left(z - x\right)}}\\ \mathbf{elif}\;x \le 9.5149408658066749 \cdot 10^{-56}:\\ \;\;\;\;x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z - x}{\sqrt[3]{t}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x \le -4.1794824165367897 \cdot 10^{-126}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\

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

\mathbf{elif}\;x \le 9.5149408658066749 \cdot 10^{-56}:\\
\;\;\;\;x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z - x}{\sqrt[3]{t}}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - x\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 ((x <= -4.17948241653679e-126)) {
		VAR = ((double) (x + ((double) (((double) (y / t)) * ((double) (z - x))))));
	} else {
		double VAR_1;
		if ((x <= -5.768617906736879e-285)) {
			VAR_1 = ((double) (x + ((double) (1.0 / ((double) (t * ((double) (1.0 / ((double) (y * ((double) (z - x))))))))))));
		} else {
			double VAR_2;
			if ((x <= 9.514940865806675e-56)) {
				VAR_2 = ((double) (x + ((double) (((double) (y / ((double) (((double) cbrt(t)) * ((double) cbrt(t)))))) * ((double) (((double) (z - x)) / ((double) cbrt(t))))))));
			} else {
				VAR_2 = ((double) (x + ((double) (((double) (y / t)) * ((double) (z - x))))));
			}
			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.4
Target2.2
Herbie1.8
\[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 < -4.17948241653679e-126 or 9.514940865806675e-56 < x

    1. Initial program 7.5

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

      \[\leadsto x + \color{blue}{\frac{1}{\frac{t}{y \cdot \left(z - x\right)}}}\]
    4. Using strategy rm
    5. Applied associate-/r*0.4

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

      \[\leadsto x + \frac{1}{\color{blue}{\frac{t}{y} \cdot \frac{1}{z - x}}}\]
    8. Applied add-cube-cbrt0.5

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

      \[\leadsto x + \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{t}{y}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{z - x}}}\]
    10. Simplified0.5

      \[\leadsto x + \color{blue}{\frac{y}{t}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{z - x}}\]
    11. Simplified0.5

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

    if -4.17948241653679e-126 < x < -5.768617906736879e-285

    1. Initial program 4.3

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

      \[\leadsto x + \color{blue}{\frac{1}{\frac{t}{y \cdot \left(z - x\right)}}}\]
    4. Using strategy rm
    5. Applied div-inv4.6

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

    if -5.768617906736879e-285 < x < 9.514940865806675e-56

    1. Initial program 4.9

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

      \[\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-frac3.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -4.1794824165367897 \cdot 10^{-126}:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{elif}\;x \le -5.76861790673687925 \cdot 10^{-285}:\\ \;\;\;\;x + \frac{1}{t \cdot \frac{1}{y \cdot \left(z - x\right)}}\\ \mathbf{elif}\;x \le 9.5149408658066749 \cdot 10^{-56}:\\ \;\;\;\;x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z - x}{\sqrt[3]{t}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \end{array}\]

Reproduce

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