Average Error: 0.2 → 0.0
Time: 2.2s
Precision: binary64
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
\[{a}^{4} + \left(\mathsf{fma}\left(\mathsf{fma}\left(a, a \cdot 2, 4\right), b \cdot b, 0.5 \cdot {b}^{4}\right) + \mathsf{fma}\left({b}^{4}, 0.5, -1\right)\right) \]
(FPCore (a b)
 :precision binary64
 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))
(FPCore (a b)
 :precision binary64
 (+
  (pow a 4.0)
  (+
   (fma (fma a (* a 2.0) 4.0) (* b b) (* 0.5 (pow b 4.0)))
   (fma (pow b 4.0) 0.5 -1.0))))
double code(double a, double b) {
	return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
double code(double a, double b) {
	return pow(a, 4.0) + (fma(fma(a, (a * 2.0), 4.0), (b * b), (0.5 * pow(b, 4.0))) + fma(pow(b, 4.0), 0.5, -1.0));
}
function code(a, b)
	return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(b * b))) - 1.0)
end
function code(a, b)
	return Float64((a ^ 4.0) + Float64(fma(fma(a, Float64(a * 2.0), 4.0), Float64(b * b), Float64(0.5 * (b ^ 4.0))) + fma((b ^ 4.0), 0.5, -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[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
code[a_, b_] := N[(N[Power[a, 4.0], $MachinePrecision] + N[(N[(N[(a * N[(a * 2.0), $MachinePrecision] + 4.0), $MachinePrecision] * N[(b * b), $MachinePrecision] + N[(0.5 * N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[b, 4.0], $MachinePrecision] * 0.5 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
{a}^{4} + \left(\mathsf{fma}\left(\mathsf{fma}\left(a, a \cdot 2, 4\right), b \cdot b, 0.5 \cdot {b}^{4}\right) + \mathsf{fma}\left({b}^{4}, 0.5, -1\right)\right)

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(b \cdot b\right)\right) - 1 \]
  2. Simplified0.0

    \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(b, b \cdot 4, -1\right)} \]
  3. Taylor expanded in a around inf 30.9

    \[\leadsto \color{blue}{\left({a}^{4} + \left(0.5 \cdot {b}^{4} + \left(0.25 \cdot \frac{{b}^{6}}{{a}^{2}} + \left(-0.25 \cdot \frac{{b}^{6}}{{a}^{2}} + \left({b}^{4} + \left(2 \cdot \left({a}^{2} \cdot {b}^{2}\right) + \left(2 \cdot \frac{\left(-0.25 \cdot {b}^{4} + 0.25 \cdot {b}^{4}\right) \cdot {b}^{2}}{{a}^{2}} + \left(-0.5 \cdot {b}^{4} + 4 \cdot {b}^{2}\right)\right)\right)\right)\right)\right)\right)\right) - 1} \]
  4. Simplified0.0

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

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

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

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

Reproduce

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