Average Error: 6.4 → 1.2
Time: 4.9s
Precision: binary64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;y \leq -8.401106217348013 \cdot 10^{+123} \lor \neg \left(y \leq 6.472968581870179 \cdot 10^{-154}\right):\\ \;\;\;\;x + \left(y \cdot \frac{\sqrt[3]{z - x} \cdot \sqrt[3]{z - x}}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\right) \cdot \frac{\sqrt[3]{z - x}}{\sqrt[3]{t}}\\ \mathbf{else}:\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;y \leq -8.401106217348013 \cdot 10^{+123} \lor \neg \left(y \leq 6.472968581870179 \cdot 10^{-154}\right):\\
\;\;\;\;x + \left(y \cdot \frac{\sqrt[3]{z - x} \cdot \sqrt[3]{z - x}}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\right) \cdot \frac{\sqrt[3]{z - x}}{\sqrt[3]{t}}\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -8.401106217348013e+123) (not (<= y 6.472968581870179e-154)))
   (+
    x
    (*
     (* y (/ (* (cbrt (- z x)) (cbrt (- z x))) (* (cbrt t) (cbrt t))))
     (/ (cbrt (- z x)) (cbrt t))))
   (+ x (* (- z x) (/ y 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 <= -8.401106217348013e+123) || !(y <= 6.472968581870179e-154)) {
		tmp = x + ((y * ((cbrt(z - x) * cbrt(z - x)) / (cbrt(t) * cbrt(t)))) * (cbrt(z - x) / cbrt(t)));
	} else {
		tmp = x + ((z - x) * (y / 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
Herbie1.2
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 2 regimes
  2. if y < -8.40110621734801283e123 or 6.47296858187017912e-154 < y

    1. Initial program 12.1

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

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

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

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

      \[\leadsto x + y \cdot \frac{z - x}{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}}\]
    8. Applied add-cube-cbrt_binary644.2

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

      \[\leadsto x + y \cdot \color{blue}{\left(\frac{\sqrt[3]{z - x} \cdot \sqrt[3]{z - x}}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{\sqrt[3]{z - x}}{\sqrt[3]{t}}\right)}\]
    10. Applied associate-*r*_binary641.2

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

    if -8.40110621734801283e123 < y < 6.47296858187017912e-154

    1. Initial program 2.2

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

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

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

      \[\leadsto x + \color{blue}{y} \cdot \frac{z - x}{t}\]
    6. Using strategy rm
    7. Applied div-inv_binary648.4

      \[\leadsto x + y \cdot \color{blue}{\left(\left(z - x\right) \cdot \frac{1}{t}\right)}\]
    8. Applied associate-*r*_binary642.2

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

      \[\leadsto x + \color{blue}{\left(\left(z - x\right) \cdot y\right)} \cdot \frac{1}{t}\]
    10. Using strategy rm
    11. Applied associate-*l*_binary641.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.401106217348013 \cdot 10^{+123} \lor \neg \left(y \leq 6.472968581870179 \cdot 10^{-154}\right):\\ \;\;\;\;x + \left(y \cdot \frac{\sqrt[3]{z - x} \cdot \sqrt[3]{z - x}}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\right) \cdot \frac{\sqrt[3]{z - x}}{\sqrt[3]{t}}\\ \mathbf{else}:\\ \;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\ \end{array}\]

Alternatives

Reproduce

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