Average Error: 6.6 → 2.2
Time: 4.6s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.62456598796659967 \cdot 10^{-44} \lor \neg \left(y \le 1.0561959963379154 \cdot 10^{-168}\right):\\ \;\;\;\;y \cdot \frac{z - x}{t} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \left(\frac{y}{\sqrt[3]{t}} \cdot \left(z - x\right)\right) + x\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;y \le -1.62456598796659967 \cdot 10^{-44} \lor \neg \left(y \le 1.0561959963379154 \cdot 10^{-168}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t} + x\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \left(\frac{y}{\sqrt[3]{t}} \cdot \left(z - x\right)\right) + x\\

\end{array}
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 temp;
	if (((y <= -1.6245659879665997e-44) || !(y <= 1.0561959963379154e-168))) {
		temp = ((y * ((z - x) / t)) + x);
	} else {
		temp = (((1.0 / (cbrt(t) * cbrt(t))) * ((y / cbrt(t)) * (z - x))) + x);
	}
	return temp;
}

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.6
Target2.1
Herbie2.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 < -1.6245659879665997e-44 or 1.0561959963379154e-168 < y

    1. Initial program 10.3

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Simplified2.8

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef2.8

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

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

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

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

    if -1.6245659879665997e-44 < y < 1.0561959963379154e-168

    1. Initial program 1.4

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Simplified1.2

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef1.2

      \[\leadsto \color{blue}{\frac{y}{t} \cdot \left(z - x\right) + x}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt1.5

      \[\leadsto \frac{y}{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}} \cdot \left(z - x\right) + x\]
    7. Applied *-un-lft-identity1.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.62456598796659967 \cdot 10^{-44} \lor \neg \left(y \le 1.0561959963379154 \cdot 10^{-168}\right):\\ \;\;\;\;y \cdot \frac{z - x}{t} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \left(\frac{y}{\sqrt[3]{t}} \cdot \left(z - x\right)\right) + x\\ \end{array}\]

Reproduce

herbie shell --seed 2020049 +o rules:numerics
(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)))