Average Error: 6.7 → 1.6
Time: 4.1s
Precision: binary64
\[x + \frac{y \cdot \left(z - x\right)}{t} \]
\[\begin{array}{l} \mathbf{if}\;y \leq -2.6226741267212798 \cdot 10^{-79}:\\ \;\;\;\;x - \frac{y}{\frac{t}{x - z}}\\ \mathbf{else}:\\ \;\;\;\;\begin{array}{l} t_1 := \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\\ \mathbf{if}\;y \leq 8997470401671517000:\\ \;\;\;\;x + \frac{t_1 \cdot \left(z - x\right)}{\sqrt[3]{t}}\\ \mathbf{else}:\\ \;\;\;\;x + t_1 \cdot \frac{z - x}{\sqrt[3]{t}}\\ \end{array}\\ \end{array} \]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;y \leq -2.6226741267212798 \cdot 10^{-79}:\\
\;\;\;\;x - \frac{y}{\frac{t}{x - z}}\\

\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\\
\mathbf{if}\;y \leq 8997470401671517000:\\
\;\;\;\;x + \frac{t_1 \cdot \left(z - x\right)}{\sqrt[3]{t}}\\

\mathbf{else}:\\
\;\;\;\;x + t_1 \cdot \frac{z - x}{\sqrt[3]{t}}\\


\end{array}\\


\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
 :precision binary64
 (if (<= y -2.6226741267212798e-79)
   (- x (/ y (/ t (- x z))))
   (let* ((t_1 (/ y (* (cbrt t) (cbrt t)))))
     (if (<= y 8997470401671517000.0)
       (+ x (/ (* t_1 (- z x)) (cbrt t)))
       (+ x (* t_1 (/ (- z x) (cbrt t))))))))
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 tmp;
	if (y <= -2.6226741267212798e-79) {
		tmp = x - (y / (t / (x - z)));
	} else {
		double t_1 = y / (cbrt(t) * cbrt(t));
		double tmp_1;
		if (y <= 8997470401671517000.0) {
			tmp_1 = x + ((t_1 * (z - x)) / cbrt(t));
		} else {
			tmp_1 = x + (t_1 * ((z - x) / cbrt(t)));
		}
		tmp = tmp_1;
	}
	return tmp;
}

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.7
Target2.1
Herbie1.6
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right) \]

Derivation

  1. Split input into 3 regimes
  2. if y < -2.62267412672127976e-79

    1. Initial program 11.3

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

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

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

      \[\leadsto x + \color{blue}{y} \cdot \frac{z - x}{t} \]
    6. Using strategy rm
    7. Applied add-cube-cbrt_binary642.7

      \[\leadsto x + \color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}\right)} \cdot \frac{z - x}{t} \]
    8. Applied associate-*l*_binary642.7

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

      \[\leadsto x + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \color{blue}{\left(\frac{z - x}{t} \cdot \sqrt[3]{y}\right)} \]
    10. Taylor expanded around -inf 11.3

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

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

    if -2.62267412672127976e-79 < y < 8997470401671517180

    1. Initial program 1.3

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

      \[\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 associate-/r*_binary641.7

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

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

    if 8997470401671517180 < y

    1. Initial program 16.7

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

      \[\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-frac_binary642.8

      \[\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.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.6226741267212798 \cdot 10^{-79}:\\ \;\;\;\;x - \frac{y}{\frac{t}{x - z}}\\ \mathbf{elif}\;y \leq 8997470401671517000:\\ \;\;\;\;x + \frac{\frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \left(z - x\right)}{\sqrt[3]{t}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z - x}{\sqrt[3]{t}}\\ \end{array} \]

Reproduce

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