Average Error: 0.2 → 0.1
Time: 4.6s
Precision: 64
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
\[\begin{array}{l} \mathbf{if}\;a \cdot a \le 2.6990555438724414 \cdot 10^{-50}:\\ \;\;\;\;\left(\left({b}^{4} + 2 \cdot \left({a}^{2} \cdot {b}^{2}\right)\right) + 4 \cdot \left(b \cdot b\right)\right) - 1\\ \mathbf{else}:\\ \;\;\;\;\left({a}^{4} + \left({b}^{4} + 2 \cdot \left({a}^{2} \cdot {b}^{2}\right)\right)\right) - 1\\ \end{array}\]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\begin{array}{l}
\mathbf{if}\;a \cdot a \le 2.6990555438724414 \cdot 10^{-50}:\\
\;\;\;\;\left(\left({b}^{4} + 2 \cdot \left({a}^{2} \cdot {b}^{2}\right)\right) + 4 \cdot \left(b \cdot b\right)\right) - 1\\

\mathbf{else}:\\
\;\;\;\;\left({a}^{4} + \left({b}^{4} + 2 \cdot \left({a}^{2} \cdot {b}^{2}\right)\right)\right) - 1\\

\end{array}
double code(double a, double b) {
	return ((double) (((double) (((double) pow(((double) (((double) (a * a)) + ((double) (b * b)))), 2.0)) + ((double) (4.0 * ((double) (b * b)))))) - 1.0));
}
double code(double a, double b) {
	double VAR;
	if ((((double) (a * a)) <= 2.6990555438724414e-50)) {
		VAR = ((double) (((double) (((double) (((double) pow(b, 4.0)) + ((double) (2.0 * ((double) (((double) pow(a, 2.0)) * ((double) pow(b, 2.0)))))))) + ((double) (4.0 * ((double) (b * b)))))) - 1.0));
	} else {
		VAR = ((double) (((double) (((double) pow(a, 4.0)) + ((double) (((double) pow(b, 4.0)) + ((double) (2.0 * ((double) (((double) pow(a, 2.0)) * ((double) pow(b, 2.0)))))))))) - 1.0));
	}
	return VAR;
}

Error

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 (* a a) < 2.6990555438724414e-50

    1. Initial program 0.1

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
    2. Taylor expanded around 0 0.0

      \[\leadsto \left(\color{blue}{\left({b}^{4} + 2 \cdot \left({a}^{2} \cdot {b}^{2}\right)\right)} + 4 \cdot \left(b \cdot b\right)\right) - 1\]

    if 2.6990555438724414e-50 < (* a a)

    1. Initial program 0.4

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
    2. Taylor expanded around inf 0.4

      \[\leadsto \color{blue}{\left({a}^{4} + \left({b}^{4} + 2 \cdot \left({a}^{2} \cdot {b}^{2}\right)\right)\right)} - 1\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot a \le 2.6990555438724414 \cdot 10^{-50}:\\ \;\;\;\;\left(\left({b}^{4} + 2 \cdot \left({a}^{2} \cdot {b}^{2}\right)\right) + 4 \cdot \left(b \cdot b\right)\right) - 1\\ \mathbf{else}:\\ \;\;\;\;\left({a}^{4} + \left({b}^{4} + 2 \cdot \left({a}^{2} \cdot {b}^{2}\right)\right)\right) - 1\\ \end{array}\]

Reproduce

herbie shell --seed 2020128 
(FPCore (a b)
  :name "Bouland and Aaronson, Equation (26)"
  :precision binary64
  (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))