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

Error

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(3 + a\right)\right)\right) - 1 \]
  2. Simplified0.0

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

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

Alternatives

Alternative 1
Error0.2
Cost8192
\[-1 + \left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(a + 3\right) \cdot \left(b \cdot b\right)\right)\right) \]
Alternative 2
Error1.1
Cost7680
\[-1 + \left({\left(a \cdot a + b \cdot b\right)}^{2} + a \cdot \left(a \cdot \left(4 + a \cdot -4\right)\right)\right) \]
Alternative 3
Error1.7
Cost7424
\[-1 + \left({\left(a \cdot a + b \cdot b\right)}^{2} + b \cdot \left(b \cdot 12\right)\right) \]
Alternative 4
Error2.2
Cost7304
\[\begin{array}{l} t_0 := -1 + \left(b \cdot \left(b \cdot 12\right) + {b}^{4}\right)\\ \mathbf{if}\;b \leq -5.66961418752657:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 8.21218619349424 \cdot 10^{-36}:\\ \;\;\;\;-1 + \left(a \cdot a\right) \cdot \left(4 + a \cdot \left(a + -4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error2.3
Cost7240
\[\begin{array}{l} t_0 := -1 + b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 12\right)\right)\\ \mathbf{if}\;b \leq -5.66961418752657:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 8.21218619349424 \cdot 10^{-36}:\\ \;\;\;\;-1 + \left(a \cdot a\right) \cdot \left(4 + a \cdot \left(a + -4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error2.3
Cost1224
\[\begin{array}{l} t_0 := -1 + \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) + \left(b \cdot b\right) \cdot 12\right)\\ \mathbf{if}\;b \leq -5.66961418752657:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 8.21218619349424 \cdot 10^{-36}:\\ \;\;\;\;-1 + \left(a \cdot a\right) \cdot \left(4 + a \cdot \left(a + -4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error12.0
Cost832
\[-1 + \left(a \cdot a\right) \cdot \left(4 + a \cdot \left(a + -4\right)\right) \]
Alternative 8
Error13.3
Cost704
\[-1 + \left(a \cdot a\right) \cdot \left(4 + a \cdot a\right) \]
Alternative 9
Error23.1
Cost448
\[-1 + 4 \cdot \left(a \cdot a\right) \]

Error

Reproduce

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