?

Average Error: 15.9 → 0.3
Time: 2.4s
Precision: binary64
Cost: 6720

?

\[-\left(\left(a \cdot a\right) \cdot b\right) \cdot b \]
\[-{\left(a \cdot b\right)}^{2} \]
(FPCore (a b) :precision binary64 (- (* (* (* a a) b) b)))
(FPCore (a b) :precision binary64 (- (pow (* a b) 2.0)))
double code(double a, double b) {
	return -(((a * a) * b) * b);
}
double code(double a, double b) {
	return -pow((a * b), 2.0);
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = -(((a * a) * b) * b)
end function
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = -((a * b) ** 2.0d0)
end function
public static double code(double a, double b) {
	return -(((a * a) * b) * b);
}
public static double code(double a, double b) {
	return -Math.pow((a * b), 2.0);
}
def code(a, b):
	return -(((a * a) * b) * b)
def code(a, b):
	return -math.pow((a * b), 2.0)
function code(a, b)
	return Float64(-Float64(Float64(Float64(a * a) * b) * b))
end
function code(a, b)
	return Float64(-(Float64(a * b) ^ 2.0))
end
function tmp = code(a, b)
	tmp = -(((a * a) * b) * b);
end
function tmp = code(a, b)
	tmp = -((a * b) ^ 2.0);
end
code[a_, b_] := (-N[(N[(N[(a * a), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision])
code[a_, b_] := (-N[Power[N[(a * b), $MachinePrecision], 2.0], $MachinePrecision])
-\left(\left(a \cdot a\right) \cdot b\right) \cdot b
-{\left(a \cdot b\right)}^{2}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 15.9

    \[-\left(\left(a \cdot a\right) \cdot b\right) \cdot b \]
  2. Simplified16.0

    \[\leadsto \color{blue}{a \cdot \left(\left(b \cdot b\right) \cdot \left(-a\right)\right)} \]
    Proof

    [Start]15.9

    \[ -\left(\left(a \cdot a\right) \cdot b\right) \cdot b \]

    rational_best-simplify-9 [=>]15.9

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

    rational_best-simplify-2 [=>]15.9

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

    rational_best-simplify-44 [=>]21.4

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

    rational_best-simplify-47 [=>]21.4

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

    rational_best-simplify-47 [=>]21.4

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

    rational_best-simplify-44 [=>]16.0

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

    rational_best-simplify-8 [=>]16.0

    \[ a \cdot \left(\left(b \cdot b\right) \cdot \color{blue}{\left(-a\right)}\right) \]
  3. Taylor expanded in a around 0 21.4

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

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

    [Start]21.4

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

    rational_best-simplify-2 [=>]21.4

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

    rational_best-simplify-12 [=>]21.4

    \[ \color{blue}{-{a}^{2} \cdot {b}^{2}} \]

    exponential-simplify-27 [=>]0.3

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

    rational_best-simplify-2 [=>]0.3

    \[ -{\color{blue}{\left(a \cdot b\right)}}^{2} \]
  5. Final simplification0.3

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

Alternatives

Alternative 1
Error3.0
Cost1032
\[\begin{array}{l} t_0 := a \cdot \left(b \cdot \left(b \cdot \left(-a\right)\right)\right)\\ \mathbf{if}\;a \cdot a \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \cdot a \leq 2 \cdot 10^{+245}:\\ \;\;\;\;-\left(\left(a \cdot a\right) \cdot b\right) \cdot b\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error3.3
Cost908
\[\begin{array}{l} t_0 := a \cdot \left(b \cdot \left(b \cdot \left(-a\right)\right)\right)\\ t_1 := b \cdot \left(a \cdot \left(a \cdot \left(-b\right)\right)\right)\\ \mathbf{if}\;a \leq -3.6 \cdot 10^{+217}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq -5 \cdot 10^{-227}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 3.5 \cdot 10^{-304}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error15.9
Cost512
\[-\left(\left(a \cdot a\right) \cdot b\right) \cdot b \]

Error

Reproduce?

herbie shell --seed 2023096 
(FPCore (a b)
  :name "ab-angle->ABCF D"
  :precision binary64
  (- (* (* (* a a) b) b)))