| Alternative 1 | |
|---|---|
| Error | 99.7% |
| Cost | 7744.00 |
\[\left(b \cdot \left(b \cdot 4\right) + \mathsf{fma}\left(b, b, a \cdot a\right) \cdot \left(a \cdot a + b \cdot b\right)\right) + -1
\]
(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) (* 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) + (b * (b * 4.0))) + -1.0;
}
public static double code(double a, double b) {
return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
public static double code(double a, double b) {
return (Math.pow(Math.hypot(a, b), 4.0) + (b * (b * 4.0))) + -1.0;
}
def code(a, b): return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0
def code(a, b): return (math.pow(math.hypot(a, b), 4.0) + (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(Float64((hypot(a, b) ^ 4.0) + Float64(b * Float64(b * 4.0))) + -1.0) end
function tmp = code(a, b) tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (b * b))) - 1.0; end
function tmp = code(a, b) tmp = ((hypot(a, b) ^ 4.0) + (b * (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[(N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision] + N[(b * N[(b * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + b \cdot \left(b \cdot 4\right)\right) + -1
Results
Initial program 99.7
Applied egg-rr96.6
Simplified100.0
[Start]96.6 | \[ \left(e^{\mathsf{log1p}\left({\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2}\right)} - \left(1 - b \cdot \left(b \cdot 4\right)\right)\right) - 1
\] |
|---|---|
associate--r- [=>]96.6 | \[ \color{blue}{\left(\left(e^{\mathsf{log1p}\left({\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2}\right)} - 1\right) + b \cdot \left(b \cdot 4\right)\right)} - 1
\] |
expm1-def [=>]96.6 | \[ \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2}\right)\right)} + b \cdot \left(b \cdot 4\right)\right) - 1
\] |
expm1-log1p [=>]99.7 | \[ \left(\color{blue}{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2}} + b \cdot \left(b \cdot 4\right)\right) - 1
\] |
unpow2 [=>]99.7 | \[ \left(\color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}} + b \cdot \left(b \cdot 4\right)\right) - 1
\] |
pow-sqr [=>]100.0 | \[ \left(\color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}} + b \cdot \left(b \cdot 4\right)\right) - 1
\] |
metadata-eval [=>]100.0 | \[ \left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{\color{blue}{4}} + b \cdot \left(b \cdot 4\right)\right) - 1
\] |
Final simplification100.0
| Alternative 1 | |
|---|---|
| Error | 99.7% |
| Cost | 7744.00 |
| Alternative 2 | |
|---|---|
| Error | 96.8% |
| Cost | 1480.00 |
| Alternative 3 | |
|---|---|
| Error | 99.7% |
| Cost | 1472.00 |
| Alternative 4 | |
|---|---|
| Error | 80.0% |
| Cost | 708.00 |
| Alternative 5 | |
|---|---|
| Error | 81.2% |
| Cost | 704.00 |
| Alternative 6 | |
|---|---|
| Error | 19.8% |
| Cost | 448.00 |
herbie shell --seed 2023093
(FPCore (a b)
:name "Bouland and Aaronson, Equation (26)"
:precision binary64
(- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))