Average Error: 6.5 → 1.9
Time: 6.1s
Precision: binary64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \leq -1.1482738035764579 \cdot 10^{+26}:\\ \;\;\;\;x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z - x}{\sqrt[3]{t}}\\ \mathbf{elif}\;t \leq 7.798937390756335 \cdot 10^{+152}:\\ \;\;\;\;x + \left(\frac{y \cdot z}{t} - \frac{x \cdot y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\sqrt{t}} \cdot \frac{z - x}{\sqrt{t}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;t \leq -1.1482738035764579 \cdot 10^{+26}:\\
\;\;\;\;x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z - x}{\sqrt[3]{t}}\\

\mathbf{elif}\;t \leq 7.798937390756335 \cdot 10^{+152}:\\
\;\;\;\;x + \left(\frac{y \cdot z}{t} - \frac{x \cdot y}{t}\right)\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\sqrt{t}} \cdot \frac{z - x}{\sqrt{t}}\\

\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
 :precision binary64
 (if (<= t -1.1482738035764579e+26)
   (+ x (* (/ y (* (cbrt t) (cbrt t))) (/ (- z x) (cbrt t))))
   (if (<= t 7.798937390756335e+152)
     (+ x (- (/ (* y z) t) (/ (* x y) t)))
     (+ x (* (/ y (sqrt t)) (/ (- z x) (sqrt 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 (t <= -1.1482738035764579e+26) {
		tmp = x + ((y / (cbrt(t) * cbrt(t))) * ((z - x) / cbrt(t)));
	} else if (t <= 7.798937390756335e+152) {
		tmp = x + (((y * z) / t) - ((x * y) / t));
	} else {
		tmp = x + ((y / sqrt(t)) * ((z - x) / sqrt(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.5
Target2.0
Herbie1.9
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 3 regimes
  2. if t < -1.1482738035764579e26

    1. Initial program 10.3

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt_binary64_1170710.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-frac_binary64_116780.9

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

    if -1.1482738035764579e26 < t < 7.79893739075633478e152

    1. Initial program 2.8

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Taylor expanded around 0 2.8

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

    if 7.79893739075633478e152 < t

    1. Initial program 12.8

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

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

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

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

Reproduce

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