Average Error: 5.9 → 0.2
Time: 2.1s
Precision: binary64
\[\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot x2\right) \cdot x3 + \left(3 \cdot x3\right) \cdot x3\right) - \left(\left(x2 \cdot x1\right) \cdot x2\right) \cdot x3\right) + \left(3 \cdot x3\right) \cdot x3\right) - x2\]
\[\begin{array}{l} \mathbf{if}\;\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot x2\right) \cdot x3 + \left(3 \cdot x3\right) \cdot x3\right) - \left(\left(x2 \cdot x1\right) \cdot x2\right) \cdot x3\right) + \left(3 \cdot x3\right) \cdot x3\right) - x2 \le -1.08432228300016621 \cdot 10^{98} \lor \neg \left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot x2\right) \cdot x3 + \left(3 \cdot x3\right) \cdot x3\right) - \left(\left(x2 \cdot x1\right) \cdot x2\right) \cdot x3\right) + \left(3 \cdot x3\right) \cdot x3\right) - x2 \le 6.57015712383150898 \cdot 10^{297}\right):\\ \;\;\;\;\left(3 \cdot x3\right) \cdot \left(x3 + x3\right) + \left(\left(x1 \cdot \left(x2 \cdot x3\right)\right) \cdot \left(2 - x2\right) - x2\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot x2\right) \cdot x3 + \left(3 \cdot x3\right) \cdot x3\right) - \left(\left(x2 \cdot x1\right) \cdot x2\right) \cdot x3\right) + \left(3 \cdot x3\right) \cdot x3\right) - x2\\ \end{array}\]
\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot x2\right) \cdot x3 + \left(3 \cdot x3\right) \cdot x3\right) - \left(\left(x2 \cdot x1\right) \cdot x2\right) \cdot x3\right) + \left(3 \cdot x3\right) \cdot x3\right) - x2
\begin{array}{l}
\mathbf{if}\;\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot x2\right) \cdot x3 + \left(3 \cdot x3\right) \cdot x3\right) - \left(\left(x2 \cdot x1\right) \cdot x2\right) \cdot x3\right) + \left(3 \cdot x3\right) \cdot x3\right) - x2 \le -1.08432228300016621 \cdot 10^{98} \lor \neg \left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot x2\right) \cdot x3 + \left(3 \cdot x3\right) \cdot x3\right) - \left(\left(x2 \cdot x1\right) \cdot x2\right) \cdot x3\right) + \left(3 \cdot x3\right) \cdot x3\right) - x2 \le 6.57015712383150898 \cdot 10^{297}\right):\\
\;\;\;\;\left(3 \cdot x3\right) \cdot \left(x3 + x3\right) + \left(\left(x1 \cdot \left(x2 \cdot x3\right)\right) \cdot \left(2 - x2\right) - x2\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot x2\right) \cdot x3 + \left(3 \cdot x3\right) \cdot x3\right) - \left(\left(x2 \cdot x1\right) \cdot x2\right) \cdot x3\right) + \left(3 \cdot x3\right) \cdot x3\right) - x2\\

\end{array}
double code(double x1, double x2, double x3) {
	return ((double) (((double) (((double) (((double) (((double) (((double) (((double) (2.0 * x1)) * x2)) * x3)) + ((double) (((double) (3.0 * x3)) * x3)))) - ((double) (((double) (((double) (x2 * x1)) * x2)) * x3)))) + ((double) (((double) (3.0 * x3)) * x3)))) - x2));
}
double code(double x1, double x2, double x3) {
	double VAR;
	if (((((double) (((double) (((double) (((double) (((double) (((double) (((double) (2.0 * x1)) * x2)) * x3)) + ((double) (((double) (3.0 * x3)) * x3)))) - ((double) (((double) (((double) (x2 * x1)) * x2)) * x3)))) + ((double) (((double) (3.0 * x3)) * x3)))) - x2)) <= -1.0843222830001662e+98) || !(((double) (((double) (((double) (((double) (((double) (((double) (((double) (2.0 * x1)) * x2)) * x3)) + ((double) (((double) (3.0 * x3)) * x3)))) - ((double) (((double) (((double) (x2 * x1)) * x2)) * x3)))) + ((double) (((double) (3.0 * x3)) * x3)))) - x2)) <= 6.570157123831509e+297))) {
		VAR = ((double) (((double) (((double) (3.0 * x3)) * ((double) (x3 + x3)))) + ((double) (((double) (((double) (x1 * ((double) (x2 * x3)))) * ((double) (2.0 - x2)))) - x2))));
	} else {
		VAR = ((double) (((double) (((double) (((double) (((double) (((double) (((double) (2.0 * x1)) * x2)) * x3)) + ((double) (((double) (3.0 * x3)) * x3)))) - ((double) (((double) (((double) (x2 * x1)) * x2)) * x3)))) + ((double) (((double) (3.0 * x3)) * x3)))) - x2));
	}
	return VAR;
}

Error

Bits error versus x1

Bits error versus x2

Bits error versus x3

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (- (+ (- (+ (* (* (* 2.0 x1) x2) x3) (* (* 3.0 x3) x3)) (* (* (* x2 x1) x2) x3)) (* (* 3.0 x3) x3)) x2) < -1.08432228300016621e98 or 6.57015712383150898e297 < (- (+ (- (+ (* (* (* 2.0 x1) x2) x3) (* (* 3.0 x3) x3)) (* (* (* x2 x1) x2) x3)) (* (* 3.0 x3) x3)) x2)

    1. Initial program 29.9

      \[\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot x2\right) \cdot x3 + \left(3 \cdot x3\right) \cdot x3\right) - \left(\left(x2 \cdot x1\right) \cdot x2\right) \cdot x3\right) + \left(3 \cdot x3\right) \cdot x3\right) - x2\]
    2. Simplified0.3

      \[\leadsto \color{blue}{\left(3 \cdot x3\right) \cdot \left(x3 + x3\right) + \left(\left(x1 \cdot \left(x2 \cdot x3\right)\right) \cdot \left(2 - x2\right) - x2\right)}\]

    if -1.08432228300016621e98 < (- (+ (- (+ (* (* (* 2.0 x1) x2) x3) (* (* 3.0 x3) x3)) (* (* (* x2 x1) x2) x3)) (* (* 3.0 x3) x3)) x2) < 6.57015712383150898e297

    1. Initial program 0.1

      \[\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot x2\right) \cdot x3 + \left(3 \cdot x3\right) \cdot x3\right) - \left(\left(x2 \cdot x1\right) \cdot x2\right) \cdot x3\right) + \left(3 \cdot x3\right) \cdot x3\right) - x2\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot x2\right) \cdot x3 + \left(3 \cdot x3\right) \cdot x3\right) - \left(\left(x2 \cdot x1\right) \cdot x2\right) \cdot x3\right) + \left(3 \cdot x3\right) \cdot x3\right) - x2 \le -1.08432228300016621 \cdot 10^{98} \lor \neg \left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot x2\right) \cdot x3 + \left(3 \cdot x3\right) \cdot x3\right) - \left(\left(x2 \cdot x1\right) \cdot x2\right) \cdot x3\right) + \left(3 \cdot x3\right) \cdot x3\right) - x2 \le 6.57015712383150898 \cdot 10^{297}\right):\\ \;\;\;\;\left(3 \cdot x3\right) \cdot \left(x3 + x3\right) + \left(\left(x1 \cdot \left(x2 \cdot x3\right)\right) \cdot \left(2 - x2\right) - x2\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot x2\right) \cdot x3 + \left(3 \cdot x3\right) \cdot x3\right) - \left(\left(x2 \cdot x1\right) \cdot x2\right) \cdot x3\right) + \left(3 \cdot x3\right) \cdot x3\right) - x2\\ \end{array}\]

Reproduce

herbie shell --seed 2020153 
(FPCore (x1 x2 x3)
  :name "(- (+ (- (+ (* (* (* 2 x1) x2) x3) (* (* 3 x3) x3)) (* (* (* x2 x1) x2) x3)) (* (* 3 x3) x3)) x2)"
  :precision binary64
  (- (+ (- (+ (* (* (* 2.0 x1) x2) x3) (* (* 3.0 x3) x3)) (* (* (* x2 x1) x2) x3)) (* (* 3.0 x3) x3)) x2))