?

Average Accuracy: 99.9% → 100.0%
Time: 7.3s
Precision: binary64
Cost: 19776

?

\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
\[{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(b, b \cdot 4, -1\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 (hypot a b) 4.0) (fma b (* b 4.0) -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(hypot(a, b), 4.0) + fma(b, (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(b * b))) - 1.0)
end
function code(a, b)
	return Float64((hypot(a, b) ^ 4.0) + fma(b, Float64(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[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
code[a_, b_] := N[(N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision] + N[(b * N[(b * 4.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(b, b \cdot 4, -1\right)

Error?

Derivation?

  1. Initial program 99.9%

    \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  2. Simplified100.0%

    \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(b, b \cdot 4, -1\right)} \]
    Step-by-step derivation

    [Start]99.9

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

    associate--l+ [=>]99.9

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

    unpow2 [=>]99.9

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

    unpow1 [<=]99.9

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

    sqr-pow [=>]99.9

    \[ \left(a \cdot a + b \cdot b\right) \cdot \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)} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]

    associate-*r* [=>]99.9

    \[ \color{blue}{\left(\left(a \cdot a + b \cdot b\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(\frac{1}{2}\right)}} + \left(4 \cdot \left(b \cdot b\right) - 1\right) \]
  3. Final simplification100.0%

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

Alternatives

Alternative 1
Accuracy96.8%
Cost7688
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 20000:\\ \;\;\;\;{a}^{4} + -1\\ \mathbf{elif}\;b \cdot b \leq 2 \cdot 10^{+103}:\\ \;\;\;\;{b}^{4} + 2 \cdot \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]
Alternative 2
Accuracy98.3%
Cost7556
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 20000:\\ \;\;\;\;{a}^{4} + -1\\ \mathbf{else}:\\ \;\;\;\;{b}^{4} + \left(b \cdot b\right) \cdot \left(4 + \left(a \cdot a\right) \cdot 2\right)\\ \end{array} \]
Alternative 3
Accuracy99.9%
Cost7424
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) + -1 \]
Alternative 4
Accuracy94.5%
Cost6920
\[\begin{array}{l} \mathbf{if}\;b \leq -3.8 \cdot 10^{+15}:\\ \;\;\;\;{b}^{4}\\ \mathbf{elif}\;b \leq 1.45 \cdot 10^{+28}:\\ \;\;\;\;{a}^{4} + -1\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]
Alternative 5
Accuracy94.4%
Cost6792
\[\begin{array}{l} \mathbf{if}\;a \leq -27000:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;a \leq 4.2 \cdot 10^{+66}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right) + -1\\ \mathbf{else}:\\ \;\;\;\;{a}^{4}\\ \end{array} \]
Alternative 6
Accuracy80.6%
Cost969
\[\begin{array}{l} \mathbf{if}\;a \leq -1.32 \cdot 10^{+41} \lor \neg \left(a \leq 6.2 \cdot 10^{+52}\right):\\ \;\;\;\;2 \cdot \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right) + -1\\ \end{array} \]
Alternative 7
Accuracy67.6%
Cost841
\[\begin{array}{l} \mathbf{if}\;a \leq -1 \lor \neg \left(a \leq 1\right):\\ \;\;\;\;2 \cdot \left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \left(b \cdot b\right) + -1\\ \end{array} \]
Alternative 8
Accuracy51.8%
Cost448
\[4 \cdot \left(b \cdot b\right) + -1 \]

Error

Reproduce?

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