?

Average Error: 0.2 → 0.0
Time: 13.9s
Precision: binary64
Cost: 14016

?

\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
\[\left(\left({b}^{4} + {a}^{4}\right) + \left(4 + 2 \cdot \left(a \cdot a\right)\right) \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 b 4.0) (pow a 4.0)) (* (+ 4.0 (* 2.0 (* a a))) (* 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(b, 4.0) + pow(a, 4.0)) + ((4.0 + (2.0 * (a * a))) * (b * b))) + -1.0;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (b * b))) - 1.0d0
end function
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (((b ** 4.0d0) + (a ** 4.0d0)) + ((4.0d0 + (2.0d0 * (a * a))) * (b * b))) + (-1.0d0)
end function
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(b, 4.0) + Math.pow(a, 4.0)) + ((4.0 + (2.0 * (a * a))) * (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(b, 4.0) + math.pow(a, 4.0)) + ((4.0 + (2.0 * (a * a))) * (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(Float64((b ^ 4.0) + (a ^ 4.0)) + Float64(Float64(4.0 + Float64(2.0 * Float64(a * a))) * 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 = (((b ^ 4.0) + (a ^ 4.0)) + ((4.0 + (2.0 * (a * a))) * (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[(N[Power[b, 4.0], $MachinePrecision] + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision] + N[(N[(4.0 + N[(2.0 * N[(a * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 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({b}^{4} + {a}^{4}\right) + \left(4 + 2 \cdot \left(a \cdot a\right)\right) \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. Taylor expanded in a around 0 0.0

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

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

    [Start]0.0

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

    +-commutative [=>]0.0

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

    associate-+r+ [=>]0.0

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

    fma-def [=>]0.0

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

    unpow2 [=>]0.0

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

    unpow2 [=>]0.0

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

    \[\leadsto \left(\left(\color{blue}{\left({b}^{4} + {\left(a \cdot b\right)}^{2} \cdot 2\right)} + {a}^{4}\right) + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  5. Taylor expanded in b around 0 0.0

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

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

    [Start]0.0

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

    associate-+r+ [=>]0.0

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

    unpow2 [=>]0.0

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

    unpow2 [=>]0.0

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

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

Alternatives

Alternative 1
Error0.2
Cost7424
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) + -1 \]
Alternative 2
Error1.7
Cost7305
\[\begin{array}{l} \mathbf{if}\;a \leq -580 \lor \neg \left(a \leq 1.18 \cdot 10^{-7}\right):\\ \;\;\;\;{a}^{4} + -1\\ \mathbf{else}:\\ \;\;\;\;\left({b}^{4} + 4 \cdot \left(b \cdot b\right)\right) + -1\\ \end{array} \]
Alternative 3
Error0.6
Cost7305
\[\begin{array}{l} \mathbf{if}\;a \leq -580 \lor \neg \left(a \leq 10^{-149}\right):\\ \;\;\;\;{\left(a \cdot a + b \cdot b\right)}^{2} + -1\\ \mathbf{else}:\\ \;\;\;\;\left({b}^{4} + 4 \cdot \left(b \cdot b\right)\right) + -1\\ \end{array} \]
Alternative 4
Error1.8
Cost7241
\[\begin{array}{l} \mathbf{if}\;a \leq -580 \lor \neg \left(a \leq 5 \cdot 10^{-10}\right):\\ \;\;\;\;{a}^{4} + -1\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 4\right)\right) + -1\\ \end{array} \]
Alternative 5
Error1.8
Cost6921
\[\begin{array}{l} \mathbf{if}\;a \leq -580 \lor \neg \left(a \leq 1.18 \cdot 10^{-7}\right):\\ \;\;\;\;{a}^{4} + -1\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right) + -1\\ \end{array} \]
Alternative 6
Error1.9
Cost969
\[\begin{array}{l} \mathbf{if}\;a \leq -580 \lor \neg \left(a \leq 1.18 \cdot 10^{-7}\right):\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right) + -1\\ \end{array} \]
Alternative 7
Error11.1
Cost841
\[\begin{array}{l} \mathbf{if}\;a \leq -580 \lor \neg \left(a \leq 1.18 \cdot 10^{-7}\right):\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right) + -1\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(b \cdot 4\right) + -1\\ \end{array} \]
Alternative 8
Error2.4
Cost841
\[\begin{array}{l} \mathbf{if}\;b \leq -1900 \lor \neg \left(b \leq 0.65\right):\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(b \cdot b\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right) + -1\\ \end{array} \]
Alternative 9
Error22.1
Cost448
\[b \cdot \left(b \cdot 4\right) + -1 \]
Alternative 10
Error23.1
Cost64
\[-1 \]

Error

Reproduce?

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