Average Error: 5.8 → 4.1
Time: 2.0s
Precision: binary64
\[\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) + \left(\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) \cdot 0.0100000000000000002\right) \cdot b\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -5.3338325046026145 \cdot 10^{-75}:\\ \;\;\;\;\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) + \left(\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) \cdot 0.0100000000000000002\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(0.0100000000000000002 \cdot b + 1\right) \cdot \left(y \cdot \left(x \cdot \left(0.0100000000000000002 \cdot a\right) + x\right)\right)\\ \end{array}\]
\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) + \left(\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) \cdot 0.0100000000000000002\right) \cdot b
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -5.3338325046026145 \cdot 10^{-75}:\\
\;\;\;\;\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) + \left(\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) \cdot 0.0100000000000000002\right) \cdot b\\

\mathbf{else}:\\
\;\;\;\;\left(0.0100000000000000002 \cdot b + 1\right) \cdot \left(y \cdot \left(x \cdot \left(0.0100000000000000002 \cdot a\right) + x\right)\right)\\

\end{array}
double code(double x, double y, double a, double b) {
	return ((double) (((double) (((double) (x * y)) + ((double) (((double) (((double) (x * y)) * 0.01)) * a)))) + ((double) (((double) (((double) (((double) (x * y)) + ((double) (((double) (((double) (x * y)) * 0.01)) * a)))) * 0.01)) * b))));
}
double code(double x, double y, double a, double b) {
	double VAR;
	if ((((double) (x * y)) <= -5.333832504602614e-75)) {
		VAR = ((double) (((double) (((double) (x * y)) + ((double) (((double) (((double) (x * y)) * 0.01)) * a)))) + ((double) (((double) (((double) (((double) (x * y)) + ((double) (((double) (((double) (x * y)) * 0.01)) * a)))) * 0.01)) * b))));
	} else {
		VAR = ((double) (((double) (((double) (0.01 * b)) + 1.0)) * ((double) (y * ((double) (((double) (x * ((double) (0.01 * a)))) + x))))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (* x y) < -5.3338325046026145e-75

    1. Initial program 0.2

      \[\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) + \left(\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) \cdot 0.0100000000000000002\right) \cdot b\]

    if -5.3338325046026145e-75 < (* x y)

    1. Initial program 7.4

      \[\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) + \left(\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) \cdot 0.0100000000000000002\right) \cdot b\]
    2. Simplified5.3

      \[\leadsto \color{blue}{\left(0.0100000000000000002 \cdot b + 1\right) \cdot \left(y \cdot \left(x \cdot \left(0.0100000000000000002 \cdot a\right) + x\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification4.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -5.3338325046026145 \cdot 10^{-75}:\\ \;\;\;\;\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) + \left(\left(x \cdot y + \left(\left(x \cdot y\right) \cdot 0.0100000000000000002\right) \cdot a\right) \cdot 0.0100000000000000002\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;\left(0.0100000000000000002 \cdot b + 1\right) \cdot \left(y \cdot \left(x \cdot \left(0.0100000000000000002 \cdot a\right) + x\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020153 
(FPCore (x y a b)
  :name "(+ (+ (* x y) (* (* (* x y) 0.01) a)) (* (* (+ (* x y) (* (* (* x y) 0.01) a)) 0.01) b))"
  :precision binary64
  (+ (+ (* x y) (* (* (* x y) 0.01) a)) (* (* (+ (* x y) (* (* (* x y) 0.01) a)) 0.01) b)))