?

Average Error: 0.2 → 0.0
Time: 10.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 \]
\[{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(4, \mathsf{fma}\left(b \cdot b, a + 3, a \cdot a\right) - {a}^{3}, -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
 (+
  (pow (hypot a b) 4.0)
  (fma 4.0 (- (fma (* b b) (+ a 3.0) (* a a)) (pow a 3.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 pow(hypot(a, b), 4.0) + fma(4.0, (fma((b * b), (a + 3.0), (a * a)) - pow(a, 3.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 Float64((hypot(a, b) ^ 4.0) + fma(4.0, Float64(fma(Float64(b * b), Float64(a + 3.0), Float64(a * a)) - (a ^ 3.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[(N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision] + N[(a * a), $MachinePrecision]), $MachinePrecision] - N[Power[a, 3.0], $MachinePrecision]), $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
{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(4, \mathsf{fma}\left(b \cdot b, a + 3, a \cdot a\right) - {a}^{3}, -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}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(4, \mathsf{fma}\left(b \cdot b, a + 3, a \cdot a\right) - {a}^{3}, -1\right)} \]
    Proof

    [Start]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 \]

    associate--l+ [=>]0.2

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

    unpow2 [=>]0.2

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

    unpow1 [<=]0.2

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

    sqr-pow [=>]0.2

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

    associate-*l* [=>]0.1

    \[ \color{blue}{{\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} \cdot \left({\left(a \cdot a + b \cdot b\right)}^{\left(\frac{1}{2}\right)} \cdot \left(a \cdot a + b \cdot b\right)\right)} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right) - 1\right) \]
  3. Final simplification0.0

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

Alternatives

Alternative 1
Error0.2
Cost8192
\[-1 + \left({\left(b \cdot b + a \cdot a\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) \]
Alternative 2
Error0.2
Cost7940
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 2 \cdot 10^{-41}:\\ \;\;\;\;-1 + \left({a}^{4} + 4 \cdot \left(\frac{a \cdot a}{-1 - a} \cdot \left(a \cdot a + -1\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left({\left(b \cdot b + a \cdot a\right)}^{2} + b \cdot \left(b \cdot 12\right)\right)\\ \end{array} \]
Alternative 3
Error0.2
Cost7684
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 2 \cdot 10^{-41}:\\ \;\;\;\;{a}^{4} + \left(-1 + \left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left({\left(b \cdot b + a \cdot a\right)}^{2} + b \cdot \left(b \cdot 12\right)\right)\\ \end{array} \]
Alternative 4
Error1.8
Cost7561
\[\begin{array}{l} \mathbf{if}\;a \leq -2.25 \cdot 10^{-8} \lor \neg \left(a \leq 7.5 \cdot 10^{-26}\right):\\ \;\;\;\;{a}^{4} + \left(-1 + \left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left({b}^{4} + 4 \cdot \left(\left(b \cdot b\right) \cdot 3\right)\right)\\ \end{array} \]
Alternative 5
Error1.5
Cost7560
\[\begin{array}{l} t_0 := 4 \cdot \left(a \cdot a\right)\\ \mathbf{if}\;b \leq -0.0092:\\ \;\;\;\;-1 + \left({\left(b \cdot b + a \cdot a\right)}^{2} + t_0\right)\\ \mathbf{elif}\;b \leq 5 \cdot 10^{-10}:\\ \;\;\;\;{a}^{4} + \left(-1 + \left(1 - a\right) \cdot t_0\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left({b}^{4} + 4 \cdot \left(\left(b \cdot b\right) \cdot 3\right)\right)\\ \end{array} \]
Alternative 6
Error1.8
Cost7433
\[\begin{array}{l} \mathbf{if}\;a \leq -2.25 \cdot 10^{-8} \lor \neg \left(a \leq 7.5 \cdot 10^{-26}\right):\\ \;\;\;\;\left(-1 + \left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left({b}^{4} + 4 \cdot \left(\left(b \cdot b\right) \cdot 3\right)\right)\\ \end{array} \]
Alternative 7
Error2.9
Cost6921
\[\begin{array}{l} \mathbf{if}\;a \leq -1.46 \cdot 10^{-8} \lor \neg \left(a \leq 7.5 \cdot 10^{-26}\right):\\ \;\;\;\;\left(-1 + \left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + {b}^{4}\\ \end{array} \]
Alternative 8
Error2.6
Cost6793
\[\begin{array}{l} \mathbf{if}\;b \leq -42 \lor \neg \left(b \leq 1.42\right):\\ \;\;\;\;{b}^{4}\\ \mathbf{else}:\\ \;\;\;\;\left(-1 + \left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \end{array} \]
Alternative 9
Error12.0
Cost1216
\[\left(-1 + \left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right) + \left(a \cdot a\right) \cdot \left(a \cdot a\right) \]
Alternative 10
Error12.9
Cost1088
\[-1 + \left(\left(a \cdot a\right) \cdot \left(a \cdot a\right) - 4 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) \]
Alternative 11
Error12.5
Cost969
\[\begin{array}{l} \mathbf{if}\;a \leq -0.42 \lor \neg \left(a \leq 2.4\right):\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + 4 \cdot \left(b \cdot \left(b \cdot \left(a + 3\right)\right)\right)\\ \end{array} \]
Alternative 12
Error13.4
Cost713
\[\begin{array}{l} \mathbf{if}\;a \leq -0.42 \lor \neg \left(a \leq 2.4\right):\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 13
Error13.2
Cost713
\[\begin{array}{l} \mathbf{if}\;a \leq -1.9 \lor \neg \left(a \leq 5.2\right):\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + a \cdot \left(a \cdot 4\right)\\ \end{array} \]
Alternative 14
Error23.7
Cost64
\[-1 \]

Error

Reproduce?

herbie shell --seed 2023053 
(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))