Average Error: 0.2 → 0.0
Time: 12.9s
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 0.2

    \[\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. Simplified0.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
    (fma.f64 4 (-.f64 (fma.f64 (*.f64 b b) (+.f64 a 3) (*.f64 a a)) (pow.f64 a 3)) (+.f64 (pow.f64 (hypot.f64 a b) 4) -1)): 0 points increase in error, 0 points decrease in error
    (fma.f64 4 (-.f64 (fma.f64 (*.f64 b b) (Rewrite<= +-commutative_binary64 (+.f64 3 a)) (*.f64 a a)) (pow.f64 a 3)) (+.f64 (pow.f64 (hypot.f64 a b) 4) -1)): 31 points increase in error, 0 points decrease in error
    (fma.f64 4 (-.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (*.f64 b b) (+.f64 3 a)) (*.f64 a a))) (pow.f64 a 3)) (+.f64 (pow.f64 (hypot.f64 a b) 4) -1)): 0 points increase in error, 31 points decrease in error
    (fma.f64 4 (-.f64 (+.f64 (*.f64 (*.f64 b b) (+.f64 3 a)) (*.f64 a a)) (Rewrite<= cube-unmult_binary64 (*.f64 a (*.f64 a a)))) (+.f64 (pow.f64 (hypot.f64 a b) 4) -1)): 0 points increase in error, 1 points decrease in error
    (fma.f64 4 (Rewrite<= associate-+r-_binary64 (+.f64 (*.f64 (*.f64 b b) (+.f64 3 a)) (-.f64 (*.f64 a a) (*.f64 a (*.f64 a a))))) (+.f64 (pow.f64 (hypot.f64 a b) 4) -1)): 0 points increase in error, 18 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 b b) (+.f64 3 a)) (-.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 (*.f64 a a))) (*.f64 a (*.f64 a a)))) (+.f64 (pow.f64 (hypot.f64 a b) 4) -1)): 0 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 b b) (+.f64 3 a)) (Rewrite=> distribute-rgt-out--_binary64 (*.f64 (*.f64 a a) (-.f64 1 a)))) (+.f64 (pow.f64 (hypot.f64 a b) 4) -1)): 0 points increase in error, 0 points decrease in error
    (fma.f64 4 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a)))) (+.f64 (pow.f64 (hypot.f64 a b) 4) -1)): 0 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (pow.f64 (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 a a) (*.f64 b b)))) 4) -1)): 25 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (pow.f64 (Rewrite<= unpow1/2_binary64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 1/2)) 4) -1)): 0 points increase in error, 25 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (pow.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (Rewrite<= metadata-eval (/.f64 1 2))) 4) -1)): 0 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (pow.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2)) (Rewrite<= metadata-eval (+.f64 3 1))) -1)): 0 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (Rewrite<= pow-plus_binary64 (*.f64 (pow.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2)) 3) (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2)))) -1)): 0 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (*.f64 (Rewrite<= cube-unmult_binary64 (*.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2)) (*.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2)) (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2))))) (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2))) -1)): 19 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (*.f64 (*.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2)) (Rewrite<= sqr-pow_binary64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 1))) (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2))) -1)): 12 points increase in error, 13 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (*.f64 (*.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2)) (Rewrite=> unpow1_binary64 (+.f64 (*.f64 a a) (*.f64 b b)))) (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2))) -1)): 0 points increase in error, 18 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (*.f64 (*.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2)) (+.f64 (*.f64 a a) (*.f64 b b))) (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2))) (Rewrite<= metadata-eval (neg.f64 1)))): 0 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2)) (*.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2)) (+.f64 (*.f64 a a) (*.f64 b b))))) (neg.f64 1))): 0 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2)) (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) (/.f64 1 2))) (+.f64 (*.f64 a a) (*.f64 b b)))) (neg.f64 1))): 0 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (*.f64 (Rewrite<= sqr-pow_binary64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 1)) (+.f64 (*.f64 a a) (*.f64 b b))) (neg.f64 1))): 31 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (*.f64 (Rewrite=> unpow1_binary64 (+.f64 (*.f64 a a) (*.f64 b b))) (+.f64 (*.f64 a a) (*.f64 b b))) (neg.f64 1))): 0 points increase in error, 31 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (Rewrite<= unpow2_binary64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2)) (neg.f64 1))): 13 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (Rewrite=> +-commutative_binary64 (+.f64 (neg.f64 1) (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2)))): 0 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (Rewrite=> metadata-eval -1) (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2))): 6 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (+.f64 (Rewrite<= metadata-eval (-.f64 0 1)) (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2))): 0 points increase in error, 19 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (Rewrite<= associate--r-_binary64 (-.f64 0 (-.f64 1 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2))))): 0 points increase in error, 0 points decrease in error
    (fma.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))) (Rewrite<= neg-sub0_binary64 (neg.f64 (-.f64 1 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2))))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a)))) (-.f64 1 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2)))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a)))) 1) (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2))): 19 points increase in error, 0 points decrease in error
    (Rewrite<= +-commutative_binary64 (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (-.f64 (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a)))) 1))): 0 points increase in error, 19 points decrease in error
    (Rewrite<= associate--l+_binary64 (-.f64 (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))))) 1)): 0 points increase in error, 0 points decrease in error
  3. Final simplification0.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
Error0.2
Cost27840
\[\begin{array}{l} t_0 := {\left(\mathsf{hypot}\left(b, a\right)\right)}^{2}\\ -1 + \left(\left(\left(b \cdot b\right) \cdot t_0 + \left(a \cdot a\right) \cdot t_0\right) + 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) \end{array} \]
Alternative 2
Error0.2
Cost8192
\[-1 + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) + {\left(b \cdot b + a \cdot a\right)}^{2}\right) \]
Alternative 3
Error0.2
Cost7684
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 10^{-34}:\\ \;\;\;\;-1 + \left({a}^{4} + \left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left({\left(b \cdot b + a \cdot a\right)}^{2} + \left(b \cdot b\right) \cdot 12\right)\\ \end{array} \]
Alternative 4
Error2.9
Cost7560
\[\begin{array}{l} \mathbf{if}\;b \leq -5.4 \cdot 10^{-7}:\\ \;\;\;\;-1 + \left(\left(b \cdot b\right) \cdot 12 + {b}^{4}\right)\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-30}:\\ \;\;\;\;-1 + {a}^{3} \cdot \left(a + -4\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-1 + {b}^{4}\right) + \left(b \cdot b\right) \cdot \left(12 + 4 \cdot a\right)\\ \end{array} \]
Alternative 5
Error1.9
Cost7560
\[\begin{array}{l} \mathbf{if}\;b \leq -5.4 \cdot 10^{-7}:\\ \;\;\;\;-1 + \left(\left(b \cdot b\right) \cdot 12 + {b}^{4}\right)\\ \mathbf{elif}\;b \leq 2.45 \cdot 10^{-30}:\\ \;\;\;\;-1 + \left({a}^{4} + \left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-1 + {b}^{4}\right) + \left(b \cdot b\right) \cdot \left(12 + 4 \cdot a\right)\\ \end{array} \]
Alternative 6
Error2.9
Cost7300
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 10^{-34}:\\ \;\;\;\;-1 + {a}^{3} \cdot \left(a + -4\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot b\right) \cdot 12 + \left(-1 + {b}^{4}\right)\\ \end{array} \]
Alternative 7
Error2.9
Cost7300
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 10^{-34}:\\ \;\;\;\;-1 + {a}^{3} \cdot \left(a + -4\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left(\left(b \cdot b\right) \cdot 12 + {b}^{4}\right)\\ \end{array} \]
Alternative 8
Error3.4
Cost7172
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 0.02:\\ \;\;\;\;-1 + {a}^{3} \cdot \left(a + -4\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]
Alternative 9
Error3.8
Cost6920
\[\begin{array}{l} \mathbf{if}\;b \leq -0.44:\\ \;\;\;\;{b}^{4}\\ \mathbf{elif}\;b \leq 5.7:\\ \;\;\;\;-1 + {a}^{4}\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]
Alternative 10
Error12.7
Cost6793
\[\begin{array}{l} \mathbf{if}\;a \leq -0.42 \lor \neg \left(a \leq 2.4\right):\\ \;\;\;\;{a}^{4}\\ \mathbf{else}:\\ \;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(12 + 4 \cdot a\right)\\ \end{array} \]
Alternative 11
Error3.9
Cost6788
\[\begin{array}{l} \mathbf{if}\;b \cdot b \leq 0.02:\\ \;\;\;\;\left(a \cdot a + 1\right) \cdot \left(a \cdot a + -1\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]
Alternative 12
Error12.8
Cost969
\[\begin{array}{l} \mathbf{if}\;a \leq -0.00175 \lor \neg \left(a \leq 0.051\right):\\ \;\;\;\;\left(a \cdot a + 1\right) \cdot \left(a \cdot a + -1\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left(b \cdot b\right) \cdot 12\\ \end{array} \]
Alternative 13
Error12.8
Cost969
\[\begin{array}{l} \mathbf{if}\;a \leq -0.00175 \lor \neg \left(a \leq 0.051\right):\\ \;\;\;\;\left(a \cdot a + 1\right) \cdot \left(a \cdot a + -1\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left(b \cdot b\right) \cdot \left(12 + 4 \cdot a\right)\\ \end{array} \]
Alternative 14
Error22.9
Cost448
\[-1 + \left(b \cdot b\right) \cdot 12 \]
Alternative 15
Error24.0
Cost64
\[-1 \]

Error

Reproduce

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