ab-angle->ABCF D

Percentage Accurate: 82.3% → 99.7%
Time: 7.2s
Alternatives: 7
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ -\left(\left(a \cdot a\right) \cdot b\right) \cdot b \end{array} \]
(FPCore (a b) :precision binary64 (- (* (* (* a a) b) b)))
double code(double a, double b) {
	return -(((a * a) * b) * b);
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = -(((a * a) * b) * b)
end function
public static double code(double a, double b) {
	return -(((a * a) * b) * b);
}
def code(a, b):
	return -(((a * a) * b) * b)
function code(a, b)
	return Float64(-Float64(Float64(Float64(a * a) * b) * b))
end
function tmp = code(a, b)
	tmp = -(((a * a) * b) * b);
end
code[a_, b_] := (-N[(N[(N[(a * a), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision])
\begin{array}{l}

\\
-\left(\left(a \cdot a\right) \cdot b\right) \cdot b
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 7 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 82.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ -\left(\left(a \cdot a\right) \cdot b\right) \cdot b \end{array} \]
(FPCore (a b) :precision binary64 (- (* (* (* a a) b) b)))
double code(double a, double b) {
	return -(((a * a) * b) * b);
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = -(((a * a) * b) * b)
end function
public static double code(double a, double b) {
	return -(((a * a) * b) * b);
}
def code(a, b):
	return -(((a * a) * b) * b)
function code(a, b)
	return Float64(-Float64(Float64(Float64(a * a) * b) * b))
end
function tmp = code(a, b)
	tmp = -(((a * a) * b) * b);
end
code[a_, b_] := (-N[(N[(N[(a * a), $MachinePrecision] * b), $MachinePrecision] * b), $MachinePrecision])
\begin{array}{l}

\\
-\left(\left(a \cdot a\right) \cdot b\right) \cdot b
\end{array}

Alternative 1: 99.7% accurate, 0.5× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ [a, b_m] = \mathsf{sort}([a, b_m])\\ \\ \frac{a \cdot b\_m}{\frac{\frac{-1}{b\_m}}{a}} \end{array} \]
b_m = (fabs.f64 b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
(FPCore (a b_m) :precision binary64 (/ (* a b_m) (/ (/ -1.0 b_m) a)))
b_m = fabs(b);
assert(a < b_m);
double code(double a, double b_m) {
	return (a * b_m) / ((-1.0 / b_m) / a);
}
b_m = abs(b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
real(8) function code(a, b_m)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    code = (a * b_m) / (((-1.0d0) / b_m) / a)
end function
b_m = Math.abs(b);
assert a < b_m;
public static double code(double a, double b_m) {
	return (a * b_m) / ((-1.0 / b_m) / a);
}
b_m = math.fabs(b)
[a, b_m] = sort([a, b_m])
def code(a, b_m):
	return (a * b_m) / ((-1.0 / b_m) / a)
b_m = abs(b)
a, b_m = sort([a, b_m])
function code(a, b_m)
	return Float64(Float64(a * b_m) / Float64(Float64(-1.0 / b_m) / a))
end
b_m = abs(b);
a, b_m = num2cell(sort([a, b_m])){:}
function tmp = code(a, b_m)
	tmp = (a * b_m) / ((-1.0 / b_m) / a);
end
b_m = N[Abs[b], $MachinePrecision]
NOTE: a and b_m should be sorted in increasing order before calling this function.
code[a_, b$95$m_] := N[(N[(a * b$95$m), $MachinePrecision] / N[(N[(-1.0 / b$95$m), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
[a, b_m] = \mathsf{sort}([a, b_m])\\
\\
\frac{a \cdot b\_m}{\frac{\frac{-1}{b\_m}}{a}}
\end{array}
Derivation
  1. Initial program 82.3%

    \[-\left(\left(a \cdot a\right) \cdot b\right) \cdot b \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\left(a \cdot a\right) \cdot b\right) \cdot b}\right) \]
    3. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\left(a \cdot a\right) \cdot b\right)} \cdot b\right) \]
    4. associate-*l*N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(a \cdot a\right) \cdot \left(b \cdot b\right)}\right) \]
    5. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(a \cdot a\right)} \cdot \left(b \cdot b\right)\right) \]
    6. unswap-sqrN/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(a \cdot b\right) \cdot \left(a \cdot b\right)}\right) \]
    7. distribute-lft-neg-inN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right) \cdot \left(a \cdot b\right)} \]
    8. lower-*.f64N/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right) \cdot \left(a \cdot b\right)} \]
    9. distribute-lft-neg-inN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(a\right)\right) \cdot b\right)} \cdot \left(a \cdot b\right) \]
    10. lower-*.f64N/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(a\right)\right) \cdot b\right)} \cdot \left(a \cdot b\right) \]
    11. lower-neg.f64N/A

      \[\leadsto \left(\color{blue}{\left(-a\right)} \cdot b\right) \cdot \left(a \cdot b\right) \]
    12. *-commutativeN/A

      \[\leadsto \left(\left(-a\right) \cdot b\right) \cdot \color{blue}{\left(b \cdot a\right)} \]
    13. lower-*.f6499.6

      \[\leadsto \left(\left(-a\right) \cdot b\right) \cdot \color{blue}{\left(b \cdot a\right)} \]
  4. Applied rewrites99.6%

    \[\leadsto \color{blue}{\left(\left(-a\right) \cdot b\right) \cdot \left(b \cdot a\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \color{blue}{\left(\left(-a\right) \cdot b\right) \cdot \left(b \cdot a\right)} \]
    2. *-commutativeN/A

      \[\leadsto \color{blue}{\left(b \cdot a\right) \cdot \left(\left(-a\right) \cdot b\right)} \]
    3. lift-*.f64N/A

      \[\leadsto \left(b \cdot a\right) \cdot \color{blue}{\left(\left(-a\right) \cdot b\right)} \]
    4. *-commutativeN/A

      \[\leadsto \left(b \cdot a\right) \cdot \color{blue}{\left(b \cdot \left(-a\right)\right)} \]
    5. associate-*l*N/A

      \[\leadsto \color{blue}{\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(-a\right)} \]
    6. lift-*.f64N/A

      \[\leadsto \color{blue}{\left(\left(b \cdot a\right) \cdot b\right)} \cdot \left(-a\right) \]
    7. lift-neg.f64N/A

      \[\leadsto \left(\left(b \cdot a\right) \cdot b\right) \cdot \color{blue}{\left(\mathsf{neg}\left(a\right)\right)} \]
    8. neg-sub0N/A

      \[\leadsto \left(\left(b \cdot a\right) \cdot b\right) \cdot \color{blue}{\left(0 - a\right)} \]
    9. flip--N/A

      \[\leadsto \left(\left(b \cdot a\right) \cdot b\right) \cdot \color{blue}{\frac{0 \cdot 0 - a \cdot a}{0 + a}} \]
    10. +-lft-identityN/A

      \[\leadsto \left(\left(b \cdot a\right) \cdot b\right) \cdot \frac{0 \cdot 0 - a \cdot a}{\color{blue}{a}} \]
    11. associate-*r/N/A

      \[\leadsto \color{blue}{\frac{\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(0 \cdot 0 - a \cdot a\right)}{a}} \]
    12. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(0 \cdot 0 - a \cdot a\right)}{a}} \]
    13. lower-*.f64N/A

      \[\leadsto \frac{\color{blue}{\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(0 \cdot 0 - a \cdot a\right)}}{a} \]
    14. metadata-evalN/A

      \[\leadsto \frac{\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(\color{blue}{0} - a \cdot a\right)}{a} \]
    15. pow2N/A

      \[\leadsto \frac{\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(0 - \color{blue}{{a}^{2}}\right)}{a} \]
    16. neg-sub0N/A

      \[\leadsto \frac{\left(\left(b \cdot a\right) \cdot b\right) \cdot \color{blue}{\left(\mathsf{neg}\left({a}^{2}\right)\right)}}{a} \]
    17. pow2N/A

      \[\leadsto \frac{\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(\mathsf{neg}\left(\color{blue}{a \cdot a}\right)\right)}{a} \]
    18. distribute-lft-neg-inN/A

      \[\leadsto \frac{\left(\left(b \cdot a\right) \cdot b\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(a\right)\right) \cdot a\right)}}{a} \]
    19. lift-neg.f64N/A

      \[\leadsto \frac{\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(\color{blue}{\left(-a\right)} \cdot a\right)}{a} \]
    20. lower-*.f6479.8

      \[\leadsto \frac{\left(\left(b \cdot a\right) \cdot b\right) \cdot \color{blue}{\left(\left(-a\right) \cdot a\right)}}{a} \]
  6. Applied rewrites79.8%

    \[\leadsto \color{blue}{\frac{\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(\left(-a\right) \cdot a\right)}{a}} \]
  7. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(\left(-a\right) \cdot a\right)}{a}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(\left(-a\right) \cdot a\right)}}{a} \]
    3. lift-*.f64N/A

      \[\leadsto \frac{\left(\left(b \cdot a\right) \cdot b\right) \cdot \color{blue}{\left(\left(-a\right) \cdot a\right)}}{a} \]
    4. associate-*r*N/A

      \[\leadsto \frac{\color{blue}{\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(-a\right)\right) \cdot a}}{a} \]
    5. associate-/l*N/A

      \[\leadsto \color{blue}{\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(-a\right)\right) \cdot \frac{a}{a}} \]
    6. *-inversesN/A

      \[\leadsto \left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(-a\right)\right) \cdot \color{blue}{1} \]
    7. *-commutativeN/A

      \[\leadsto \color{blue}{1 \cdot \left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(-a\right)\right)} \]
    8. metadata-evalN/A

      \[\leadsto \color{blue}{\frac{1}{1}} \cdot \left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(-a\right)\right) \]
    9. associate-/r/N/A

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{\left(\left(b \cdot a\right) \cdot b\right) \cdot \left(-a\right)}}} \]
    10. lift-*.f64N/A

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{\left(\left(b \cdot a\right) \cdot b\right)} \cdot \left(-a\right)}} \]
    11. associate-*r*N/A

      \[\leadsto \frac{1}{\frac{1}{\color{blue}{\left(b \cdot a\right) \cdot \left(b \cdot \left(-a\right)\right)}}} \]
    12. lift-neg.f64N/A

      \[\leadsto \frac{1}{\frac{1}{\left(b \cdot a\right) \cdot \left(b \cdot \color{blue}{\left(\mathsf{neg}\left(a\right)\right)}\right)}} \]
    13. distribute-rgt-neg-outN/A

      \[\leadsto \frac{1}{\frac{1}{\left(b \cdot a\right) \cdot \color{blue}{\left(\mathsf{neg}\left(b \cdot a\right)\right)}}} \]
    14. lift-*.f64N/A

      \[\leadsto \frac{1}{\frac{1}{\left(b \cdot a\right) \cdot \left(\mathsf{neg}\left(\color{blue}{b \cdot a}\right)\right)}} \]
    15. associate-/r*N/A

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{1}{b \cdot a}}{\mathsf{neg}\left(b \cdot a\right)}}} \]
    16. unpow-1N/A

      \[\leadsto \frac{1}{\frac{\color{blue}{{\left(b \cdot a\right)}^{-1}}}{\mathsf{neg}\left(b \cdot a\right)}} \]
    17. lift-pow.f64N/A

      \[\leadsto \frac{1}{\frac{\color{blue}{{\left(b \cdot a\right)}^{-1}}}{\mathsf{neg}\left(b \cdot a\right)}} \]
    18. clear-numN/A

      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(b \cdot a\right)}{{\left(b \cdot a\right)}^{-1}}} \]
    19. distribute-frac-negN/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{b \cdot a}{{\left(b \cdot a\right)}^{-1}}\right)} \]
  8. Applied rewrites99.7%

    \[\leadsto \color{blue}{\frac{b \cdot a}{\frac{-1}{b \cdot a}}} \]
  9. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \frac{b \cdot a}{\color{blue}{\frac{-1}{b \cdot a}}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{b \cdot a}{\frac{-1}{\color{blue}{b \cdot a}}} \]
    3. associate-/r*N/A

      \[\leadsto \frac{b \cdot a}{\color{blue}{\frac{\frac{-1}{b}}{a}}} \]
    4. lower-/.f64N/A

      \[\leadsto \frac{b \cdot a}{\color{blue}{\frac{\frac{-1}{b}}{a}}} \]
    5. lower-/.f6499.8

      \[\leadsto \frac{b \cdot a}{\frac{\color{blue}{\frac{-1}{b}}}{a}} \]
  10. Applied rewrites99.8%

    \[\leadsto \frac{b \cdot a}{\color{blue}{\frac{\frac{-1}{b}}{a}}} \]
  11. Final simplification99.8%

    \[\leadsto \frac{a \cdot b}{\frac{\frac{-1}{b}}{a}} \]
  12. Add Preprocessing

Alternative 2: 99.7% accurate, 0.5× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ [a, b_m] = \mathsf{sort}([a, b_m])\\ \\ \frac{b\_m}{\frac{-1}{a}} \cdot \left(a \cdot b\_m\right) \end{array} \]
b_m = (fabs.f64 b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
(FPCore (a b_m) :precision binary64 (* (/ b_m (/ -1.0 a)) (* a b_m)))
b_m = fabs(b);
assert(a < b_m);
double code(double a, double b_m) {
	return (b_m / (-1.0 / a)) * (a * b_m);
}
b_m = abs(b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
real(8) function code(a, b_m)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    code = (b_m / ((-1.0d0) / a)) * (a * b_m)
end function
b_m = Math.abs(b);
assert a < b_m;
public static double code(double a, double b_m) {
	return (b_m / (-1.0 / a)) * (a * b_m);
}
b_m = math.fabs(b)
[a, b_m] = sort([a, b_m])
def code(a, b_m):
	return (b_m / (-1.0 / a)) * (a * b_m)
b_m = abs(b)
a, b_m = sort([a, b_m])
function code(a, b_m)
	return Float64(Float64(b_m / Float64(-1.0 / a)) * Float64(a * b_m))
end
b_m = abs(b);
a, b_m = num2cell(sort([a, b_m])){:}
function tmp = code(a, b_m)
	tmp = (b_m / (-1.0 / a)) * (a * b_m);
end
b_m = N[Abs[b], $MachinePrecision]
NOTE: a and b_m should be sorted in increasing order before calling this function.
code[a_, b$95$m_] := N[(N[(b$95$m / N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] * N[(a * b$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
[a, b_m] = \mathsf{sort}([a, b_m])\\
\\
\frac{b\_m}{\frac{-1}{a}} \cdot \left(a \cdot b\_m\right)
\end{array}
Derivation
  1. Initial program 82.3%

    \[-\left(\left(a \cdot a\right) \cdot b\right) \cdot b \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\left(a \cdot a\right) \cdot b\right) \cdot b}\right) \]
    3. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\left(a \cdot a\right) \cdot b\right)} \cdot b\right) \]
    4. associate-*l*N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(a \cdot a\right) \cdot \left(b \cdot b\right)}\right) \]
    5. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(a \cdot a\right)} \cdot \left(b \cdot b\right)\right) \]
    6. unswap-sqrN/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(a \cdot b\right) \cdot \left(a \cdot b\right)}\right) \]
    7. distribute-lft-neg-inN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right) \cdot \left(a \cdot b\right)} \]
    8. lower-*.f64N/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right) \cdot \left(a \cdot b\right)} \]
    9. distribute-lft-neg-inN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(a\right)\right) \cdot b\right)} \cdot \left(a \cdot b\right) \]
    10. lower-*.f64N/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(a\right)\right) \cdot b\right)} \cdot \left(a \cdot b\right) \]
    11. lower-neg.f64N/A

      \[\leadsto \left(\color{blue}{\left(-a\right)} \cdot b\right) \cdot \left(a \cdot b\right) \]
    12. *-commutativeN/A

      \[\leadsto \left(\left(-a\right) \cdot b\right) \cdot \color{blue}{\left(b \cdot a\right)} \]
    13. lower-*.f6499.6

      \[\leadsto \left(\left(-a\right) \cdot b\right) \cdot \color{blue}{\left(b \cdot a\right)} \]
  4. Applied rewrites99.6%

    \[\leadsto \color{blue}{\left(\left(-a\right) \cdot b\right) \cdot \left(b \cdot a\right)} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \color{blue}{\left(\left(-a\right) \cdot b\right)} \cdot \left(b \cdot a\right) \]
    2. lift-neg.f64N/A

      \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(a\right)\right)} \cdot b\right) \cdot \left(b \cdot a\right) \]
    3. distribute-lft-neg-outN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right)} \cdot \left(b \cdot a\right) \]
    4. *-commutativeN/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{b \cdot a}\right)\right) \cdot \left(b \cdot a\right) \]
    5. distribute-lft-neg-inN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(b\right)\right) \cdot a\right)} \cdot \left(b \cdot a\right) \]
    6. rem-square-sqrtN/A

      \[\leadsto \left(\left(\mathsf{neg}\left(b\right)\right) \cdot \color{blue}{\left(\sqrt{a} \cdot \sqrt{a}\right)}\right) \cdot \left(b \cdot a\right) \]
    7. lift-sqrt.f64N/A

      \[\leadsto \left(\left(\mathsf{neg}\left(b\right)\right) \cdot \left(\color{blue}{\sqrt{a}} \cdot \sqrt{a}\right)\right) \cdot \left(b \cdot a\right) \]
    8. lift-sqrt.f64N/A

      \[\leadsto \left(\left(\mathsf{neg}\left(b\right)\right) \cdot \left(\sqrt{a} \cdot \color{blue}{\sqrt{a}}\right)\right) \cdot \left(b \cdot a\right) \]
    9. associate-*r*N/A

      \[\leadsto \color{blue}{\left(\left(\left(\mathsf{neg}\left(b\right)\right) \cdot \sqrt{a}\right) \cdot \sqrt{a}\right)} \cdot \left(b \cdot a\right) \]
    10. distribute-lft-neg-inN/A

      \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(b \cdot \sqrt{a}\right)\right)} \cdot \sqrt{a}\right) \cdot \left(b \cdot a\right) \]
    11. *-commutativeN/A

      \[\leadsto \left(\left(\mathsf{neg}\left(\color{blue}{\sqrt{a} \cdot b}\right)\right) \cdot \sqrt{a}\right) \cdot \left(b \cdot a\right) \]
    12. lower-*.f64N/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\sqrt{a} \cdot b\right)\right) \cdot \sqrt{a}\right)} \cdot \left(b \cdot a\right) \]
    13. distribute-lft-neg-inN/A

      \[\leadsto \left(\color{blue}{\left(\left(\mathsf{neg}\left(\sqrt{a}\right)\right) \cdot b\right)} \cdot \sqrt{a}\right) \cdot \left(b \cdot a\right) \]
    14. lower-*.f64N/A

      \[\leadsto \left(\color{blue}{\left(\left(\mathsf{neg}\left(\sqrt{a}\right)\right) \cdot b\right)} \cdot \sqrt{a}\right) \cdot \left(b \cdot a\right) \]
    15. lower-neg.f6450.1

      \[\leadsto \left(\left(\color{blue}{\left(-\sqrt{a}\right)} \cdot b\right) \cdot \sqrt{a}\right) \cdot \left(b \cdot a\right) \]
  6. Applied rewrites50.1%

    \[\leadsto \color{blue}{\left(\left(\left(-\sqrt{a}\right) \cdot b\right) \cdot \sqrt{a}\right)} \cdot \left(b \cdot a\right) \]
  7. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \color{blue}{\left(\left(\left(-\sqrt{a}\right) \cdot b\right) \cdot \sqrt{a}\right)} \cdot \left(b \cdot a\right) \]
    2. lift-*.f64N/A

      \[\leadsto \left(\color{blue}{\left(\left(-\sqrt{a}\right) \cdot b\right)} \cdot \sqrt{a}\right) \cdot \left(b \cdot a\right) \]
    3. *-commutativeN/A

      \[\leadsto \left(\color{blue}{\left(b \cdot \left(-\sqrt{a}\right)\right)} \cdot \sqrt{a}\right) \cdot \left(b \cdot a\right) \]
    4. associate-*l*N/A

      \[\leadsto \color{blue}{\left(b \cdot \left(\left(-\sqrt{a}\right) \cdot \sqrt{a}\right)\right)} \cdot \left(b \cdot a\right) \]
    5. lift-neg.f64N/A

      \[\leadsto \left(b \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\sqrt{a}\right)\right)} \cdot \sqrt{a}\right)\right) \cdot \left(b \cdot a\right) \]
    6. distribute-lft-neg-outN/A

      \[\leadsto \left(b \cdot \color{blue}{\left(\mathsf{neg}\left(\sqrt{a} \cdot \sqrt{a}\right)\right)}\right) \cdot \left(b \cdot a\right) \]
    7. lift-sqrt.f64N/A

      \[\leadsto \left(b \cdot \left(\mathsf{neg}\left(\color{blue}{\sqrt{a}} \cdot \sqrt{a}\right)\right)\right) \cdot \left(b \cdot a\right) \]
    8. lift-sqrt.f64N/A

      \[\leadsto \left(b \cdot \left(\mathsf{neg}\left(\sqrt{a} \cdot \color{blue}{\sqrt{a}}\right)\right)\right) \cdot \left(b \cdot a\right) \]
    9. rem-square-sqrtN/A

      \[\leadsto \left(b \cdot \left(\mathsf{neg}\left(\color{blue}{a}\right)\right)\right) \cdot \left(b \cdot a\right) \]
    10. distribute-rgt-neg-outN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(b \cdot a\right)\right)} \cdot \left(b \cdot a\right) \]
    11. lift-*.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{b \cdot a}\right)\right) \cdot \left(b \cdot a\right) \]
    12. /-rgt-identityN/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{b \cdot a}{1}}\right)\right) \cdot \left(b \cdot a\right) \]
    13. lift-*.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\frac{\color{blue}{b \cdot a}}{1}\right)\right) \cdot \left(b \cdot a\right) \]
    14. associate-/l*N/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{b \cdot \frac{a}{1}}\right)\right) \cdot \left(b \cdot a\right) \]
    15. clear-numN/A

      \[\leadsto \left(\mathsf{neg}\left(b \cdot \color{blue}{\frac{1}{\frac{1}{a}}}\right)\right) \cdot \left(b \cdot a\right) \]
    16. div-invN/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{b}{\frac{1}{a}}}\right)\right) \cdot \left(b \cdot a\right) \]
    17. distribute-neg-frac2N/A

      \[\leadsto \color{blue}{\frac{b}{\mathsf{neg}\left(\frac{1}{a}\right)}} \cdot \left(b \cdot a\right) \]
    18. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{b}{\mathsf{neg}\left(\frac{1}{a}\right)}} \cdot \left(b \cdot a\right) \]
    19. distribute-neg-fracN/A

      \[\leadsto \frac{b}{\color{blue}{\frac{\mathsf{neg}\left(1\right)}{a}}} \cdot \left(b \cdot a\right) \]
    20. metadata-evalN/A

      \[\leadsto \frac{b}{\frac{\color{blue}{-1}}{a}} \cdot \left(b \cdot a\right) \]
    21. lower-/.f6499.7

      \[\leadsto \frac{b}{\color{blue}{\frac{-1}{a}}} \cdot \left(b \cdot a\right) \]
  8. Applied rewrites99.7%

    \[\leadsto \color{blue}{\frac{b}{\frac{-1}{a}}} \cdot \left(b \cdot a\right) \]
  9. Final simplification99.7%

    \[\leadsto \frac{b}{\frac{-1}{a}} \cdot \left(a \cdot b\right) \]
  10. Add Preprocessing

Alternative 3: 99.7% accurate, 1.0× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ [a, b_m] = \mathsf{sort}([a, b_m])\\ \\ \left(\left(-a\right) \cdot b\_m\right) \cdot \left(a \cdot b\_m\right) \end{array} \]
b_m = (fabs.f64 b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
(FPCore (a b_m) :precision binary64 (* (* (- a) b_m) (* a b_m)))
b_m = fabs(b);
assert(a < b_m);
double code(double a, double b_m) {
	return (-a * b_m) * (a * b_m);
}
b_m = abs(b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
real(8) function code(a, b_m)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    code = (-a * b_m) * (a * b_m)
end function
b_m = Math.abs(b);
assert a < b_m;
public static double code(double a, double b_m) {
	return (-a * b_m) * (a * b_m);
}
b_m = math.fabs(b)
[a, b_m] = sort([a, b_m])
def code(a, b_m):
	return (-a * b_m) * (a * b_m)
b_m = abs(b)
a, b_m = sort([a, b_m])
function code(a, b_m)
	return Float64(Float64(Float64(-a) * b_m) * Float64(a * b_m))
end
b_m = abs(b);
a, b_m = num2cell(sort([a, b_m])){:}
function tmp = code(a, b_m)
	tmp = (-a * b_m) * (a * b_m);
end
b_m = N[Abs[b], $MachinePrecision]
NOTE: a and b_m should be sorted in increasing order before calling this function.
code[a_, b$95$m_] := N[(N[((-a) * b$95$m), $MachinePrecision] * N[(a * b$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
[a, b_m] = \mathsf{sort}([a, b_m])\\
\\
\left(\left(-a\right) \cdot b\_m\right) \cdot \left(a \cdot b\_m\right)
\end{array}
Derivation
  1. Initial program 82.3%

    \[-\left(\left(a \cdot a\right) \cdot b\right) \cdot b \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\left(a \cdot a\right) \cdot b\right) \cdot b}\right) \]
    3. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\left(a \cdot a\right) \cdot b\right)} \cdot b\right) \]
    4. associate-*l*N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(a \cdot a\right) \cdot \left(b \cdot b\right)}\right) \]
    5. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(a \cdot a\right)} \cdot \left(b \cdot b\right)\right) \]
    6. unswap-sqrN/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(a \cdot b\right) \cdot \left(a \cdot b\right)}\right) \]
    7. distribute-lft-neg-inN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right) \cdot \left(a \cdot b\right)} \]
    8. lower-*.f64N/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(a \cdot b\right)\right) \cdot \left(a \cdot b\right)} \]
    9. distribute-lft-neg-inN/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(a\right)\right) \cdot b\right)} \cdot \left(a \cdot b\right) \]
    10. lower-*.f64N/A

      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(a\right)\right) \cdot b\right)} \cdot \left(a \cdot b\right) \]
    11. lower-neg.f64N/A

      \[\leadsto \left(\color{blue}{\left(-a\right)} \cdot b\right) \cdot \left(a \cdot b\right) \]
    12. *-commutativeN/A

      \[\leadsto \left(\left(-a\right) \cdot b\right) \cdot \color{blue}{\left(b \cdot a\right)} \]
    13. lower-*.f6499.6

      \[\leadsto \left(\left(-a\right) \cdot b\right) \cdot \color{blue}{\left(b \cdot a\right)} \]
  4. Applied rewrites99.6%

    \[\leadsto \color{blue}{\left(\left(-a\right) \cdot b\right) \cdot \left(b \cdot a\right)} \]
  5. Final simplification99.6%

    \[\leadsto \left(\left(-a\right) \cdot b\right) \cdot \left(a \cdot b\right) \]
  6. Add Preprocessing

Alternative 4: 82.3% accurate, 1.0× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ [a, b_m] = \mathsf{sort}([a, b_m])\\ \\ \left(-b\_m\right) \cdot \left(\left(a \cdot a\right) \cdot b\_m\right) \end{array} \]
b_m = (fabs.f64 b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
(FPCore (a b_m) :precision binary64 (* (- b_m) (* (* a a) b_m)))
b_m = fabs(b);
assert(a < b_m);
double code(double a, double b_m) {
	return -b_m * ((a * a) * b_m);
}
b_m = abs(b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
real(8) function code(a, b_m)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    code = -b_m * ((a * a) * b_m)
end function
b_m = Math.abs(b);
assert a < b_m;
public static double code(double a, double b_m) {
	return -b_m * ((a * a) * b_m);
}
b_m = math.fabs(b)
[a, b_m] = sort([a, b_m])
def code(a, b_m):
	return -b_m * ((a * a) * b_m)
b_m = abs(b)
a, b_m = sort([a, b_m])
function code(a, b_m)
	return Float64(Float64(-b_m) * Float64(Float64(a * a) * b_m))
end
b_m = abs(b);
a, b_m = num2cell(sort([a, b_m])){:}
function tmp = code(a, b_m)
	tmp = -b_m * ((a * a) * b_m);
end
b_m = N[Abs[b], $MachinePrecision]
NOTE: a and b_m should be sorted in increasing order before calling this function.
code[a_, b$95$m_] := N[((-b$95$m) * N[(N[(a * a), $MachinePrecision] * b$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
[a, b_m] = \mathsf{sort}([a, b_m])\\
\\
\left(-b\_m\right) \cdot \left(\left(a \cdot a\right) \cdot b\_m\right)
\end{array}
Derivation
  1. Initial program 82.3%

    \[-\left(\left(a \cdot a\right) \cdot b\right) \cdot b \]
  2. Add Preprocessing
  3. Final simplification82.3%

    \[\leadsto \left(-b\right) \cdot \left(\left(a \cdot a\right) \cdot b\right) \]
  4. Add Preprocessing

Alternative 5: 29.3% accurate, 1.1× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ [a, b_m] = \mathsf{sort}([a, b_m])\\ \\ \left(\left(a \cdot a\right) \cdot b\_m\right) \cdot b\_m \end{array} \]
b_m = (fabs.f64 b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
(FPCore (a b_m) :precision binary64 (* (* (* a a) b_m) b_m))
b_m = fabs(b);
assert(a < b_m);
double code(double a, double b_m) {
	return ((a * a) * b_m) * b_m;
}
b_m = abs(b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
real(8) function code(a, b_m)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    code = ((a * a) * b_m) * b_m
end function
b_m = Math.abs(b);
assert a < b_m;
public static double code(double a, double b_m) {
	return ((a * a) * b_m) * b_m;
}
b_m = math.fabs(b)
[a, b_m] = sort([a, b_m])
def code(a, b_m):
	return ((a * a) * b_m) * b_m
b_m = abs(b)
a, b_m = sort([a, b_m])
function code(a, b_m)
	return Float64(Float64(Float64(a * a) * b_m) * b_m)
end
b_m = abs(b);
a, b_m = num2cell(sort([a, b_m])){:}
function tmp = code(a, b_m)
	tmp = ((a * a) * b_m) * b_m;
end
b_m = N[Abs[b], $MachinePrecision]
NOTE: a and b_m should be sorted in increasing order before calling this function.
code[a_, b$95$m_] := N[(N[(N[(a * a), $MachinePrecision] * b$95$m), $MachinePrecision] * b$95$m), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
[a, b_m] = \mathsf{sort}([a, b_m])\\
\\
\left(\left(a \cdot a\right) \cdot b\_m\right) \cdot b\_m
\end{array}
Derivation
  1. Initial program 82.3%

    \[-\left(\left(a \cdot a\right) \cdot b\right) \cdot b \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)} \]
    2. +-lft-identityN/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(0 + \left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)}\right) \]
    3. flip3-+N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{{0}^{3} + {\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)}^{3}}{0 \cdot 0 + \left(\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right) \cdot \left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right) - 0 \cdot \left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)\right)}}\right) \]
    4. distribute-neg-fracN/A

      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left({0}^{3} + {\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)}^{3}\right)\right)}{0 \cdot 0 + \left(\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right) \cdot \left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right) - 0 \cdot \left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)\right)}} \]
  4. Applied rewrites30.7%

    \[\leadsto \color{blue}{\left(b \cdot \left(a \cdot a\right)\right) \cdot b} \]
  5. Final simplification30.7%

    \[\leadsto \left(\left(a \cdot a\right) \cdot b\right) \cdot b \]
  6. Add Preprocessing

Alternative 6: 29.1% accurate, 1.1× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ [a, b_m] = \mathsf{sort}([a, b_m])\\ \\ \left(a \cdot b\_m\right) \cdot \left(a \cdot b\_m\right) \end{array} \]
b_m = (fabs.f64 b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
(FPCore (a b_m) :precision binary64 (* (* a b_m) (* a b_m)))
b_m = fabs(b);
assert(a < b_m);
double code(double a, double b_m) {
	return (a * b_m) * (a * b_m);
}
b_m = abs(b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
real(8) function code(a, b_m)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    code = (a * b_m) * (a * b_m)
end function
b_m = Math.abs(b);
assert a < b_m;
public static double code(double a, double b_m) {
	return (a * b_m) * (a * b_m);
}
b_m = math.fabs(b)
[a, b_m] = sort([a, b_m])
def code(a, b_m):
	return (a * b_m) * (a * b_m)
b_m = abs(b)
a, b_m = sort([a, b_m])
function code(a, b_m)
	return Float64(Float64(a * b_m) * Float64(a * b_m))
end
b_m = abs(b);
a, b_m = num2cell(sort([a, b_m])){:}
function tmp = code(a, b_m)
	tmp = (a * b_m) * (a * b_m);
end
b_m = N[Abs[b], $MachinePrecision]
NOTE: a and b_m should be sorted in increasing order before calling this function.
code[a_, b$95$m_] := N[(N[(a * b$95$m), $MachinePrecision] * N[(a * b$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
[a, b_m] = \mathsf{sort}([a, b_m])\\
\\
\left(a \cdot b\_m\right) \cdot \left(a \cdot b\_m\right)
\end{array}
Derivation
  1. Initial program 82.3%

    \[-\left(\left(a \cdot a\right) \cdot b\right) \cdot b \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)} \]
    2. +-lft-identityN/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(0 + \left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)}\right) \]
    3. flip3-+N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{{0}^{3} + {\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)}^{3}}{0 \cdot 0 + \left(\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right) \cdot \left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right) - 0 \cdot \left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)\right)}}\right) \]
    4. distribute-neg-fracN/A

      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left({0}^{3} + {\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)}^{3}\right)\right)}{0 \cdot 0 + \left(\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right) \cdot \left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right) - 0 \cdot \left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)\right)}} \]
  4. Applied rewrites30.6%

    \[\leadsto \color{blue}{\left(b \cdot a\right) \cdot \left(b \cdot a\right)} \]
  5. Final simplification30.6%

    \[\leadsto \left(a \cdot b\right) \cdot \left(a \cdot b\right) \]
  6. Add Preprocessing

Alternative 7: 29.1% accurate, 1.1× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ [a, b_m] = \mathsf{sort}([a, b_m])\\ \\ \left(\left(b\_m \cdot b\_m\right) \cdot a\right) \cdot a \end{array} \]
b_m = (fabs.f64 b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
(FPCore (a b_m) :precision binary64 (* (* (* b_m b_m) a) a))
b_m = fabs(b);
assert(a < b_m);
double code(double a, double b_m) {
	return ((b_m * b_m) * a) * a;
}
b_m = abs(b)
NOTE: a and b_m should be sorted in increasing order before calling this function.
real(8) function code(a, b_m)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    code = ((b_m * b_m) * a) * a
end function
b_m = Math.abs(b);
assert a < b_m;
public static double code(double a, double b_m) {
	return ((b_m * b_m) * a) * a;
}
b_m = math.fabs(b)
[a, b_m] = sort([a, b_m])
def code(a, b_m):
	return ((b_m * b_m) * a) * a
b_m = abs(b)
a, b_m = sort([a, b_m])
function code(a, b_m)
	return Float64(Float64(Float64(b_m * b_m) * a) * a)
end
b_m = abs(b);
a, b_m = num2cell(sort([a, b_m])){:}
function tmp = code(a, b_m)
	tmp = ((b_m * b_m) * a) * a;
end
b_m = N[Abs[b], $MachinePrecision]
NOTE: a and b_m should be sorted in increasing order before calling this function.
code[a_, b$95$m_] := N[(N[(N[(b$95$m * b$95$m), $MachinePrecision] * a), $MachinePrecision] * a), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
[a, b_m] = \mathsf{sort}([a, b_m])\\
\\
\left(\left(b\_m \cdot b\_m\right) \cdot a\right) \cdot a
\end{array}
Derivation
  1. Initial program 82.3%

    \[-\left(\left(a \cdot a\right) \cdot b\right) \cdot b \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-neg.f64N/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)} \]
    2. +-lft-identityN/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\left(0 + \left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)}\right) \]
    3. flip3-+N/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{\frac{{0}^{3} + {\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)}^{3}}{0 \cdot 0 + \left(\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right) \cdot \left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right) - 0 \cdot \left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)\right)}}\right) \]
    4. distribute-neg-fracN/A

      \[\leadsto \color{blue}{\frac{\mathsf{neg}\left(\left({0}^{3} + {\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)}^{3}\right)\right)}{0 \cdot 0 + \left(\left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right) \cdot \left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right) - 0 \cdot \left(\left(\left(a \cdot a\right) \cdot b\right) \cdot b\right)\right)}} \]
  4. Applied rewrites30.6%

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

    \[\leadsto \color{blue}{{a}^{2} \cdot {b}^{2}} \]
  6. Step-by-step derivation
    1. unpow2N/A

      \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot {b}^{2} \]
    2. associate-*l*N/A

      \[\leadsto \color{blue}{a \cdot \left(a \cdot {b}^{2}\right)} \]
    3. remove-double-negN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a\right)\right)\right)\right)} \cdot \left(a \cdot {b}^{2}\right) \]
    4. mul-1-negN/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{-1 \cdot a}\right)\right) \cdot \left(a \cdot {b}^{2}\right) \]
    5. neg-mul-1N/A

      \[\leadsto \color{blue}{\left(-1 \cdot \left(-1 \cdot a\right)\right)} \cdot \left(a \cdot {b}^{2}\right) \]
    6. rem-square-sqrtN/A

      \[\leadsto \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \left(-1 \cdot a\right)\right) \cdot \left(a \cdot {b}^{2}\right) \]
    7. associate-*r*N/A

      \[\leadsto \color{blue}{\left(\sqrt{-1} \cdot \left(\sqrt{-1} \cdot \left(-1 \cdot a\right)\right)\right)} \cdot \left(a \cdot {b}^{2}\right) \]
    8. mul-1-negN/A

      \[\leadsto \left(\sqrt{-1} \cdot \left(\sqrt{-1} \cdot \color{blue}{\left(\mathsf{neg}\left(a\right)\right)}\right)\right) \cdot \left(a \cdot {b}^{2}\right) \]
    9. distribute-rgt-neg-inN/A

      \[\leadsto \left(\sqrt{-1} \cdot \color{blue}{\left(\mathsf{neg}\left(\sqrt{-1} \cdot a\right)\right)}\right) \cdot \left(a \cdot {b}^{2}\right) \]
    10. *-commutativeN/A

      \[\leadsto \left(\sqrt{-1} \cdot \left(\mathsf{neg}\left(\color{blue}{a \cdot \sqrt{-1}}\right)\right)\right) \cdot \left(a \cdot {b}^{2}\right) \]
    11. lower-*.f64N/A

      \[\leadsto \color{blue}{\left(\sqrt{-1} \cdot \left(\mathsf{neg}\left(a \cdot \sqrt{-1}\right)\right)\right) \cdot \left(a \cdot {b}^{2}\right)} \]
    12. *-commutativeN/A

      \[\leadsto \left(\sqrt{-1} \cdot \left(\mathsf{neg}\left(\color{blue}{\sqrt{-1} \cdot a}\right)\right)\right) \cdot \left(a \cdot {b}^{2}\right) \]
    13. distribute-rgt-neg-inN/A

      \[\leadsto \left(\sqrt{-1} \cdot \color{blue}{\left(\sqrt{-1} \cdot \left(\mathsf{neg}\left(a\right)\right)\right)}\right) \cdot \left(a \cdot {b}^{2}\right) \]
    14. mul-1-negN/A

      \[\leadsto \left(\sqrt{-1} \cdot \left(\sqrt{-1} \cdot \color{blue}{\left(-1 \cdot a\right)}\right)\right) \cdot \left(a \cdot {b}^{2}\right) \]
    15. associate-*r*N/A

      \[\leadsto \color{blue}{\left(\left(\sqrt{-1} \cdot \sqrt{-1}\right) \cdot \left(-1 \cdot a\right)\right)} \cdot \left(a \cdot {b}^{2}\right) \]
    16. rem-square-sqrtN/A

      \[\leadsto \left(\color{blue}{-1} \cdot \left(-1 \cdot a\right)\right) \cdot \left(a \cdot {b}^{2}\right) \]
    17. neg-mul-1N/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(-1 \cdot a\right)\right)} \cdot \left(a \cdot {b}^{2}\right) \]
    18. mul-1-negN/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(a\right)\right)}\right)\right) \cdot \left(a \cdot {b}^{2}\right) \]
    19. remove-double-negN/A

      \[\leadsto \color{blue}{a} \cdot \left(a \cdot {b}^{2}\right) \]
    20. remove-double-negN/A

      \[\leadsto a \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(a\right)\right)\right)\right)} \cdot {b}^{2}\right) \]
    21. mul-1-negN/A

      \[\leadsto a \cdot \left(\left(\mathsf{neg}\left(\color{blue}{-1 \cdot a}\right)\right) \cdot {b}^{2}\right) \]
    22. neg-mul-1N/A

      \[\leadsto a \cdot \left(\color{blue}{\left(-1 \cdot \left(-1 \cdot a\right)\right)} \cdot {b}^{2}\right) \]
  7. Applied rewrites30.6%

    \[\leadsto \color{blue}{a \cdot \left(a \cdot \left(b \cdot b\right)\right)} \]
  8. Final simplification30.6%

    \[\leadsto \left(\left(b \cdot b\right) \cdot a\right) \cdot a \]
  9. Add Preprocessing

Reproduce

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