?

Average Accuracy: 99.7% → 99.9%
Time: 10.1s
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 99.7%

    \[\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. Simplified99.9%

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

    \[ \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+ [=>]99.7

    \[ \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)} \]
  3. Final simplification99.9%

    \[\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
Accuracy98.7%
Cost8328
\[\begin{array}{l} \mathbf{if}\;a \leq -4.3 \cdot 10^{-7}:\\ \;\;\;\;\left({a}^{4} + 4 \cdot \left(a \cdot \left(a \cdot \left(1 - a\right)\right)\right)\right) + -1\\ \mathbf{elif}\;a \leq 1.05 \cdot 10^{-15}:\\ \;\;\;\;\left({b}^{4} + \left(b \cdot b\right) \cdot 12\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left({\left(b \cdot b + a \cdot a\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + b \cdot \left(a \cdot b\right)\right)\right) + -1\\ \end{array} \]
Alternative 2
Accuracy99.7%
Cost8192
\[\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) + -1 \]
Alternative 3
Accuracy97.1%
Cost7561
\[\begin{array}{l} \mathbf{if}\;a \leq -1.25 \cdot 10^{-6} \lor \neg \left(a \leq 1.05 \cdot 10^{-15}\right):\\ \;\;\;\;a \cdot \left({a}^{3} + a \cdot \left(4 + a \cdot -4\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left({b}^{4} + \left(b \cdot b\right) \cdot 12\right) + -1\\ \end{array} \]
Alternative 4
Accuracy97.2%
Cost7561
\[\begin{array}{l} \mathbf{if}\;a \leq -1 \cdot 10^{-7} \lor \neg \left(a \leq 1.05 \cdot 10^{-15}\right):\\ \;\;\;\;\left({a}^{4} + 4 \cdot \left(a \cdot \left(a \cdot \left(1 - a\right)\right)\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left({b}^{4} + \left(b \cdot b\right) \cdot 12\right) + -1\\ \end{array} \]
Alternative 5
Accuracy95.7%
Cost7433
\[\begin{array}{l} \mathbf{if}\;a \leq -1.9 \cdot 10^{-5} \lor \neg \left(a \leq 10^{-15}\right):\\ \;\;\;\;\left({a}^{4} - 4 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left({b}^{4} + \left(b \cdot b\right) \cdot 12\right) + -1\\ \end{array} \]
Alternative 6
Accuracy95.7%
Cost7305
\[\begin{array}{l} \mathbf{if}\;a \leq -1.9 \cdot 10^{-5} \lor \neg \left(a \leq 1.05 \cdot 10^{-15}\right):\\ \;\;\;\;{a}^{3} \cdot \left(a + -4\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left({b}^{4} + \left(b \cdot b\right) \cdot 12\right) + -1\\ \end{array} \]
Alternative 7
Accuracy95.6%
Cost7241
\[\begin{array}{l} \mathbf{if}\;a \leq -1.4 \cdot 10^{-5} \lor \neg \left(a \leq 1.05 \cdot 10^{-15}\right):\\ \;\;\;\;{a}^{3} \cdot \left(a + -4\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b \cdot b, b \cdot b + 12, -1\right)\\ \end{array} \]
Alternative 8
Accuracy94.2%
Cost7177
\[\begin{array}{l} \mathbf{if}\;a \leq -1.9 \cdot 10^{-5} \lor \neg \left(a \leq 1.05 \cdot 10^{-15}\right):\\ \;\;\;\;{a}^{3} \cdot \left(a + -4\right) + -1\\ \mathbf{else}:\\ \;\;\;\;{b}^{4} + -1\\ \end{array} \]
Alternative 9
Accuracy80.4%
Cost6924
\[\begin{array}{l} t_0 := \left(b \cdot b\right) \cdot 12 + \left(b \cdot b\right) \cdot \left(b \cdot b\right)\\ \mathbf{if}\;b \leq -0.28:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq -3.3 \cdot 10^{-131}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(4 + a \cdot -4\right) + -1\\ \mathbf{elif}\;b \leq -1.95 \cdot 10^{-138}:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;b \leq 0.29:\\ \;\;\;\;a \cdot \left(a \cdot 4\right) + -1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 10
Accuracy93.6%
Cost6921
\[\begin{array}{l} \mathbf{if}\;a \leq -0.00016 \lor \neg \left(a \leq 1.05 \cdot 10^{-15}\right):\\ \;\;\;\;{a}^{4} + -1\\ \mathbf{else}:\\ \;\;\;\;{b}^{4} + -1\\ \end{array} \]
Alternative 11
Accuracy94.6%
Cost6916
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 0.04:\\ \;\;\;\;{a}^{4} + -1\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot b\right) \cdot 12 + \left(b \cdot b\right) \cdot \left(b \cdot b\right)\\ \end{array} \]
Alternative 12
Accuracy80.9%
Cost1097
\[\begin{array}{l} \mathbf{if}\;b \leq -0.28 \lor \neg \left(b \leq 0.29\right):\\ \;\;\;\;\left(b \cdot b\right) \cdot 12 + \left(b \cdot b\right) \cdot \left(b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(a \cdot 4\right) + -1\\ \end{array} \]
Alternative 13
Accuracy63.7%
Cost448
\[-1 + b \cdot \left(b \cdot 12\right) \]
Alternative 14
Accuracy62.1%
Cost64
\[-1 \]

Error

Reproduce?

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