Average Error: 3.3 → 0.3
Time: 1.6s
Precision: binary64
\[\left(\left(x \cdot y\right) \cdot z + x \cdot y\right) - \frac{z \cdot y}{x}\]
\[\begin{array}{l} \mathbf{if}\;z \le -8.21076906967250683 \cdot 10^{-15} \lor \neg \left(z \le 6.87113325920619179 \cdot 10^{46}\right):\\ \;\;\;\;\left(\left(x \cdot y\right) \cdot z + x \cdot y\right) - \frac{z \cdot y}{x}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot z + \left(x - \frac{z}{x}\right)\right)\\ \end{array}\]
\left(\left(x \cdot y\right) \cdot z + x \cdot y\right) - \frac{z \cdot y}{x}
\begin{array}{l}
\mathbf{if}\;z \le -8.21076906967250683 \cdot 10^{-15} \lor \neg \left(z \le 6.87113325920619179 \cdot 10^{46}\right):\\
\;\;\;\;\left(\left(x \cdot y\right) \cdot z + x \cdot y\right) - \frac{z \cdot y}{x}\\

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

\end{array}
double code(double x, double y, double z) {
	return ((double) (((double) (((double) (((double) (x * y)) * z)) + ((double) (x * y)))) - ((double) (((double) (z * y)) / x))));
}
double code(double x, double y, double z) {
	double VAR;
	if (((z <= -8.210769069672507e-15) || !(z <= 6.871133259206192e+46))) {
		VAR = ((double) (((double) (((double) (((double) (x * y)) * z)) + ((double) (x * y)))) - ((double) (((double) (z * y)) / x))));
	} else {
		VAR = ((double) (y * ((double) (((double) (x * z)) + ((double) (x - ((double) (z / x))))))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if z < -8.21076906967250683e-15 or 6.87113325920619179e46 < z

    1. Initial program 0.3

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

    if -8.21076906967250683e-15 < z < 6.87113325920619179e46

    1. Initial program 4.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -8.21076906967250683 \cdot 10^{-15} \lor \neg \left(z \le 6.87113325920619179 \cdot 10^{46}\right):\\ \;\;\;\;\left(\left(x \cdot y\right) \cdot z + x \cdot y\right) - \frac{z \cdot y}{x}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot z + \left(x - \frac{z}{x}\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020152 
(FPCore (x y z)
  :name "(- (+ (* (* x y) z) (* x y)) (/ (* z y) x))"
  :precision binary64
  (- (+ (* (* x y) z) (* x y)) (/ (* z y) x)))