Average Error: 0.2 → 0.0
Time: 6.1s
Precision: binary64
Cost: 13504
\[\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} + 4 \cdot \left(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) (* 4.0 (* b b))) -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) + (4.0 * (b * b))) + -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) + (4.0 * (b * b))) + -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) + (4.0 * (b * b))) + -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(4.0 * Float64(b * b))) + -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) + (4.0 * (b * b))) + -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[(4.0 * N[(b * b), $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} + 4 \cdot \left(b \cdot b\right)\right) + -1

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.2

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

    \[\leadsto \color{blue}{\mathsf{expm1}\left(2 \cdot \log \left(\mathsf{hypot}\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}, b \cdot 2\right)\right)\right)} \]
  3. Applied egg-rr0.0

    \[\leadsto \color{blue}{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + 4 \cdot \left(b \cdot b\right)\right) - 1} \]
  4. Final simplification0.0

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

Alternatives

Alternative 1
Error0.2
Cost7424
\[\left(4 \cdot \left(b \cdot b\right) + {\left(b \cdot b + a \cdot a\right)}^{2}\right) + -1 \]
Alternative 2
Error1.8
Cost7304
\[\begin{array}{l} t_0 := {a}^{4} + -1\\ \mathbf{if}\;a \leq -1.1641693355304894:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq 6.689087316151212:\\ \;\;\;\;-1 + \left(4 \cdot \left(b \cdot b\right) + {b}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error1.9
Cost6920
\[\begin{array}{l} t_0 := {a}^{4} + -1\\ \mathbf{if}\;a \leq -1.1641693355304894:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq 6.689087316151212:\\ \;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(\left(4 + b \cdot b\right) + \left(a \cdot a\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error2.0
Cost1352
\[\begin{array}{l} t_0 := \left(1 + a \cdot a\right) \cdot \left(a \cdot a + -1\right)\\ \mathbf{if}\;a \leq -1.1641693355304894:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq 6.689087316151212:\\ \;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(\left(4 + b \cdot b\right) + \left(a \cdot a\right) \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error2.9
Cost968
\[\begin{array}{l} t_0 := \left(1 + a \cdot a\right) \cdot \left(a \cdot a + -1\right)\\ \mathbf{if}\;a \leq -1.1641693355304894:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq 6.689087316151212:\\ \;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error13.1
Cost840
\[\begin{array}{l} t_0 := \left(a \cdot a\right) \cdot \left(a \cdot a + -1\right)\\ \mathbf{if}\;a \leq -1.1641693355304894:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq 1.407791111266992 \cdot 10^{-6}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error3.3
Cost840
\[\begin{array}{l} t_0 := \left(a \cdot a\right) \cdot \left(a \cdot a + -1\right)\\ \mathbf{if}\;a \leq -1.1641693355304894:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq 6.689087316151212:\\ \;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(b \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error23.2
Cost320
\[a \cdot a + -1 \]
Alternative 9
Error23.7
Cost64
\[-1 \]

Error

Reproduce

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