?

Average Accuracy: 99.7% → 100.0%
Time: 9.7s
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 \cdot b, a + 3, 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(Float64(b * 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[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $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 \cdot b, a + 3, a \cdot a\right) - {a}^{3}, {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + -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. Simplified100.0%

    \[\leadsto \color{blue}{\mathsf{fma}\left(4, \mathsf{fma}\left(b \cdot b, a + 3, a \cdot a\right) - {a}^{3}, {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + -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)} \]

    +-commutative [=>]99.7

    \[ \color{blue}{\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) + {\left(a \cdot a + b \cdot b\right)}^{2}} \]

    associate-+l- [=>]99.7

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

    fma-neg [=>]99.7

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

    +-commutative [=>]99.7

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

    distribute-rgt-out-- [<=]99.7

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

    *-lft-identity [=>]99.7

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

    associate-+r- [=>]99.7

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

    fma-def [=>]99.7

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

    +-commutative [=>]99.7

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

    cube-unmult [=>]99.7

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

    neg-sub0 [=>]99.7

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

    associate--r- [=>]99.7

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

    metadata-eval [=>]99.7

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

    metadata-eval [<=]99.7

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

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

Alternatives

Alternative 1
Accuracy99.7%
Cost20736
\[{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(-1 + 4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) \]
Alternative 2
Accuracy99.6%
Cost8196
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 5 \cdot 10^{-73}:\\ \;\;\;\;-1 + \left({a}^{4} + 4 \cdot \left(a \cdot \left(a \cdot \left(1 - a\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left({\left(b \cdot b + a \cdot a\right)}^{2} + 4 \cdot \left(a \cdot a + \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right)\\ \end{array} \]
Alternative 3
Accuracy99.7%
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 4
Accuracy98.1%
Cost8064
\[-1 + \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(b \cdot a\right)\right)\right) \]
Alternative 5
Accuracy98.0%
Cost7817
\[\begin{array}{l} \mathbf{if}\;b \leq -0.015 \lor \neg \left(b \leq 5 \cdot 10^{-42}\right):\\ \;\;\;\;-1 + \left({\left(b \cdot b + a \cdot a\right)}^{2} + b \cdot \left(b \cdot \left(4 \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left({a}^{4} + 4 \cdot \left(a \cdot \left(a \cdot \left(1 - a\right)\right)\right)\right)\\ \end{array} \]
Alternative 6
Accuracy94.9%
Cost7556
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 5 \cdot 10^{-73}:\\ \;\;\;\;-1 + \left({a}^{4} + -4 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 \cdot \left(a + 3\right)\right) + \left(-1 + {b}^{4}\right)\\ \end{array} \]
Alternative 7
Accuracy96.1%
Cost7556
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 5 \cdot 10^{-73}:\\ \;\;\;\;-1 + a \cdot \left({a}^{3} + \left(1 - a\right) \cdot \left(4 \cdot a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 \cdot \left(a + 3\right)\right) + \left(-1 + {b}^{4}\right)\\ \end{array} \]
Alternative 8
Accuracy96.2%
Cost7556
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 5 \cdot 10^{-73}:\\ \;\;\;\;-1 + \left({a}^{4} + 4 \cdot \left(a \cdot \left(a \cdot \left(1 - a\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 \cdot \left(a + 3\right)\right) + \left(-1 + {b}^{4}\right)\\ \end{array} \]
Alternative 9
Accuracy93.2%
Cost7428
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 5 \cdot 10^{-73}:\\ \;\;\;\;-1 + \left({a}^{4} + -4 \cdot \left(a \cdot \left(a \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + {b}^{4}\\ \end{array} \]
Alternative 10
Accuracy93.2%
Cost7172
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 5 \cdot 10^{-73}:\\ \;\;\;\;-1 + {a}^{3} \cdot \left(a + -4\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + {b}^{4}\\ \end{array} \]
Alternative 11
Accuracy94.3%
Cost6920
\[\begin{array}{l} \mathbf{if}\;b \leq -0.3:\\ \;\;\;\;{b}^{4}\\ \mathbf{elif}\;b \leq 6.6:\\ \;\;\;\;-1 + {a}^{4}\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]
Alternative 12
Accuracy93.2%
Cost6920
\[\begin{array}{l} \mathbf{if}\;a \leq -2.75 \cdot 10^{+17}:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;a \leq 4 \cdot 10^{-19}:\\ \;\;\;\;-1 + {b}^{4}\\ \mathbf{else}:\\ \;\;\;\;-1 + {a}^{4}\\ \end{array} \]
Alternative 13
Accuracy79.6%
Cost6792
\[\begin{array}{l} \mathbf{if}\;a \leq -4.8:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;a \leq 2.4:\\ \;\;\;\;-1 + \left(4 \cdot a\right) \cdot \left(a - a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;{a}^{4}\\ \end{array} \]
Alternative 14
Accuracy64.4%
Cost448
\[-1 + a \cdot \left(4 \cdot a\right) \]
Alternative 15
Accuracy63.1%
Cost64
\[-1 \]

Error

Reproduce?

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