Average Error: 0.2 → 0.0
Time: 3.6s
Precision: binary64
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1 \]
\[\left(\mathsf{fma}\left(4, a \cdot \mathsf{fma}\left(a, a, a\right), {a}^{4}\right) + \mathsf{fma}\left(\mathsf{fma}\left(a, \mathsf{fma}\left(2, a, -12\right), 4\right), b \cdot b, {b}^{4}\right)\right) + -1 \]
(FPCore (a b)
 :precision binary64
 (-
  (+
   (pow (+ (* a a) (* b b)) 2.0)
   (* 4.0 (+ (* (* a a) (+ 1.0 a)) (* (* b b) (- 1.0 (* 3.0 a))))))
  1.0))
(FPCore (a b)
 :precision binary64
 (+
  (+
   (fma 4.0 (* a (fma a a a)) (pow a 4.0))
   (fma (fma a (fma 2.0 a -12.0) 4.0) (* b b) (pow b 4.0)))
  -1.0))
double code(double a, double b) {
	return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
double code(double a, double b) {
	return (fma(4.0, (a * fma(a, a, a)), pow(a, 4.0)) + fma(fma(a, fma(2.0, a, -12.0), 4.0), (b * b), pow(b, 4.0))) + -1.0;
}
function code(a, b)
	return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 + a)) + Float64(Float64(b * b) * Float64(1.0 - Float64(3.0 * a)))))) - 1.0)
end
function code(a, b)
	return Float64(Float64(fma(4.0, Float64(a * fma(a, a, a)), (a ^ 4.0)) + fma(fma(a, fma(2.0, a, -12.0), 4.0), Float64(b * b), (b ^ 4.0))) + -1.0)
end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 + a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
code[a_, b_] := N[(N[(N[(4.0 * N[(a * N[(a * a + a), $MachinePrecision]), $MachinePrecision] + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(2.0 * a + -12.0), $MachinePrecision] + 4.0), $MachinePrecision] * N[(b * b), $MachinePrecision] + N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1
\left(\mathsf{fma}\left(4, a \cdot \mathsf{fma}\left(a, a, a\right), {a}^{4}\right) + \mathsf{fma}\left(\mathsf{fma}\left(a, \mathsf{fma}\left(2, a, -12\right), 4\right), b \cdot b, {b}^{4}\right)\right) + -1

Error

Bits error versus a

Bits error versus b

Derivation

  1. Initial program 0.2

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

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

    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(4, a \cdot \mathsf{fma}\left(a, a, a\right), {a}^{4}\right) + \left(b \cdot b\right) \cdot \left(\mathsf{fma}\left(b, b, 4\right) + a \cdot \left(a \cdot 2 - 12\right)\right)\right)} - 1 \]
  4. Taylor expanded in b around 0 0.0

    \[\leadsto \left(\mathsf{fma}\left(4, a \cdot \mathsf{fma}\left(a, a, a\right), {a}^{4}\right) + \color{blue}{\left(\left(2 \cdot \left({a}^{2} \cdot {b}^{2}\right) + \left(4 \cdot {b}^{2} + {b}^{4}\right)\right) - 12 \cdot \left(a \cdot {b}^{2}\right)\right)}\right) - 1 \]
  5. Simplified0.0

    \[\leadsto \left(\mathsf{fma}\left(4, a \cdot \mathsf{fma}\left(a, a, a\right), {a}^{4}\right) + \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(a, \mathsf{fma}\left(2, a, -12\right), 4\right), b \cdot b, {b}^{4}\right)}\right) - 1 \]
  6. Final simplification0.0

    \[\leadsto \left(\mathsf{fma}\left(4, a \cdot \mathsf{fma}\left(a, a, a\right), {a}^{4}\right) + \mathsf{fma}\left(\mathsf{fma}\left(a, \mathsf{fma}\left(2, a, -12\right), 4\right), b \cdot b, {b}^{4}\right)\right) + -1 \]

Reproduce

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