Average Error: 6.4 → 0.9
Time: 3.1s
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} \leq -\infty \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \leq 7.368615275434186 \cdot 10^{+270}\right):\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \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} \leq -\infty \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \leq 7.368615275434186 \cdot 10^{+270}\right):\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (+ x (/ (* y (- z x)) t)) (- INFINITY))
         (not (<= (+ x (/ (* y (- z x)) t)) 7.368615275434186e+270)))
   (+ x (* (- z x) (/ y t)))
   (+ x (/ (* y (- z x)) 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 (((x + ((y * (z - x)) / t)) <= -((double) INFINITY)) || !((x + ((y * (z - x)) / t)) <= 7.368615275434186e+270)) {
		tmp = x + ((z - x) * (y / t));
	} else {
		tmp = x + ((y * (z - x)) / t);
	}
	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.4
Target2.0
Herbie0.9
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 2 regimes
  2. if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0 or 7.3686152754341861e270 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t))

    1. Initial program 44.7

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

      \[\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_binary645.0

      \[\leadsto x + \color{blue}{\frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z - x}{\sqrt[3]{t}}}\]
    5. Using strategy rm
    6. Applied pow1_binary645.0

      \[\leadsto x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \color{blue}{{\left(\frac{z - x}{\sqrt[3]{t}}\right)}^{1}}\]
    7. Applied pow1_binary645.0

      \[\leadsto x + \color{blue}{{\left(\frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\right)}^{1}} \cdot {\left(\frac{z - x}{\sqrt[3]{t}}\right)}^{1}\]
    8. Applied pow-prod-down_binary645.0

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

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

    if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 7.3686152754341861e270

    1. Initial program 0.8

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \leq -\infty \lor \neg \left(x + \frac{y \cdot \left(z - x\right)}{t} \leq 7.368615275434186 \cdot 10^{+270}\right):\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \end{array}\]

Reproduce

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