Average Error: 6.4 → 1.2
Time: 2.4s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -4.8433825726185352 \cdot 10^{-33} \lor \neg \left(t \le 3.59028723149019767 \cdot 10^{27}\right):\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right) + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{t}{y \cdot \left(z - x\right)}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;t \le -4.8433825726185352 \cdot 10^{-33} \lor \neg \left(t \le 3.59028723149019767 \cdot 10^{27}\right):\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right) + x\\

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

\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 VAR;
	if (((t <= -4.843382572618535e-33) || !(t <= 3.5902872314901977e+27))) {
		VAR = (((y / t) * (z - x)) + x);
	} else {
		VAR = (x + (1.0 / (t / (y * (z - x)))));
	}
	return VAR;
}

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 t < -4.843382572618535e-33 or 3.5902872314901977e+27 < t

    1. Initial program 9.3

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

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

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

    if -4.843382572618535e-33 < t < 3.5902872314901977e+27

    1. Initial program 1.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -4.8433825726185352 \cdot 10^{-33} \lor \neg \left(t \le 3.59028723149019767 \cdot 10^{27}\right):\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right) + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{t}{y \cdot \left(z - x\right)}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020105 +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)))