ab-angle->ABCF D

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

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

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

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

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

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

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

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

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

      \[\leadsto -\left(a \cdot \left(b \cdot b\right)\right) \cdot {a}^{\color{blue}{\left(\frac{2}{2}\right)}} \]
    9. sqr-powN/A

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

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

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

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

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

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

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

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

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

      \[\leadsto -\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot {a}^{\color{blue}{\frac{1}{2}}}\right) \cdot {a}^{\left(\frac{\frac{2}{2}}{2}\right)} \]
    19. unpow1/2N/A

      \[\leadsto -\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \color{blue}{\sqrt{a}}\right) \cdot {a}^{\left(\frac{\frac{2}{2}}{2}\right)} \]
    20. lower-sqrt.f64N/A

      \[\leadsto -\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \color{blue}{\sqrt{a}}\right) \cdot {a}^{\left(\frac{\frac{2}{2}}{2}\right)} \]
    21. metadata-evalN/A

      \[\leadsto -\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \sqrt{a}\right) \cdot {a}^{\left(\frac{\color{blue}{1}}{2}\right)} \]
    22. metadata-evalN/A

      \[\leadsto -\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \sqrt{a}\right) \cdot {a}^{\color{blue}{\frac{1}{2}}} \]
    23. unpow1/2N/A

      \[\leadsto -\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \sqrt{a}\right) \cdot \color{blue}{\sqrt{a}} \]
    24. lower-sqrt.f6443.6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(b \cdot a\right)\right) \cdot \sqrt{\color{blue}{b \cdot \left(\left(b \cdot a\right) \cdot a\right)}} \]
  6. Applied rewrites47.5%

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

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

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

Alternative 2: 97.6% accurate, 0.5× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ a_m = \left|a\right| \\ [a_m, b_m] = \mathsf{sort}([a_m, b_m])\\ \\ \begin{array}{l} \mathbf{if}\;a\_m \leq 6 \cdot 10^{-199}:\\ \;\;\;\;\left(\left(\left(-a\_m\right) \cdot b\_m\right) \cdot b\_m\right) \cdot a\_m\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(a\_m \cdot b\_m\right) \cdot a\_m}{\frac{-1}{b\_m}}\\ \end{array} \end{array} \]
b_m = (fabs.f64 b)
a_m = (fabs.f64 a)
NOTE: a_m and b_m should be sorted in increasing order before calling this function.
(FPCore (a_m b_m)
 :precision binary64
 (if (<= a_m 6e-199)
   (* (* (* (- a_m) b_m) b_m) a_m)
   (/ (* (* a_m b_m) a_m) (/ -1.0 b_m))))
b_m = fabs(b);
a_m = fabs(a);
assert(a_m < b_m);
double code(double a_m, double b_m) {
	double tmp;
	if (a_m <= 6e-199) {
		tmp = ((-a_m * b_m) * b_m) * a_m;
	} else {
		tmp = ((a_m * b_m) * a_m) / (-1.0 / b_m);
	}
	return tmp;
}
b_m = abs(b)
a_m = abs(a)
NOTE: a_m and b_m should be sorted in increasing order before calling this function.
real(8) function code(a_m, b_m)
    real(8), intent (in) :: a_m
    real(8), intent (in) :: b_m
    real(8) :: tmp
    if (a_m <= 6d-199) then
        tmp = ((-a_m * b_m) * b_m) * a_m
    else
        tmp = ((a_m * b_m) * a_m) / ((-1.0d0) / b_m)
    end if
    code = tmp
end function
b_m = Math.abs(b);
a_m = Math.abs(a);
assert a_m < b_m;
public static double code(double a_m, double b_m) {
	double tmp;
	if (a_m <= 6e-199) {
		tmp = ((-a_m * b_m) * b_m) * a_m;
	} else {
		tmp = ((a_m * b_m) * a_m) / (-1.0 / b_m);
	}
	return tmp;
}
b_m = math.fabs(b)
a_m = math.fabs(a)
[a_m, b_m] = sort([a_m, b_m])
def code(a_m, b_m):
	tmp = 0
	if a_m <= 6e-199:
		tmp = ((-a_m * b_m) * b_m) * a_m
	else:
		tmp = ((a_m * b_m) * a_m) / (-1.0 / b_m)
	return tmp
b_m = abs(b)
a_m = abs(a)
a_m, b_m = sort([a_m, b_m])
function code(a_m, b_m)
	tmp = 0.0
	if (a_m <= 6e-199)
		tmp = Float64(Float64(Float64(Float64(-a_m) * b_m) * b_m) * a_m);
	else
		tmp = Float64(Float64(Float64(a_m * b_m) * a_m) / Float64(-1.0 / b_m));
	end
	return tmp
end
b_m = abs(b);
a_m = abs(a);
a_m, b_m = num2cell(sort([a_m, b_m])){:}
function tmp_2 = code(a_m, b_m)
	tmp = 0.0;
	if (a_m <= 6e-199)
		tmp = ((-a_m * b_m) * b_m) * a_m;
	else
		tmp = ((a_m * b_m) * a_m) / (-1.0 / b_m);
	end
	tmp_2 = tmp;
end
b_m = N[Abs[b], $MachinePrecision]
a_m = N[Abs[a], $MachinePrecision]
NOTE: a_m and b_m should be sorted in increasing order before calling this function.
code[a$95$m_, b$95$m_] := If[LessEqual[a$95$m, 6e-199], N[(N[(N[((-a$95$m) * b$95$m), $MachinePrecision] * b$95$m), $MachinePrecision] * a$95$m), $MachinePrecision], N[(N[(N[(a$95$m * b$95$m), $MachinePrecision] * a$95$m), $MachinePrecision] / N[(-1.0 / b$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
a_m = \left|a\right|
\\
[a_m, b_m] = \mathsf{sort}([a_m, b_m])\\
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 6 \cdot 10^{-199}:\\
\;\;\;\;\left(\left(\left(-a\_m\right) \cdot b\_m\right) \cdot b\_m\right) \cdot a\_m\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(a\_m \cdot b\_m\right) \cdot a\_m}{\frac{-1}{b\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 5.99999999999999966e-199

    1. Initial program 82.7%

      \[-\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. associate-*l*N/A

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(b \cdot a\right)} \cdot b\right) \cdot \left(\mathsf{neg}\left(a\right)\right) \]
      14. lower-neg.f6494.7

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

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

    if 5.99999999999999966e-199 < a

    1. Initial program 88.7%

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

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

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

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

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

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

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

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

        \[\leadsto -\left(a \cdot \left(b \cdot b\right)\right) \cdot {a}^{\color{blue}{\left(\frac{2}{2}\right)}} \]
      9. sqr-powN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto -\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot {a}^{\color{blue}{\frac{1}{2}}}\right) \cdot {a}^{\left(\frac{\frac{2}{2}}{2}\right)} \]
      19. unpow1/2N/A

        \[\leadsto -\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \color{blue}{\sqrt{a}}\right) \cdot {a}^{\left(\frac{\frac{2}{2}}{2}\right)} \]
      20. lower-sqrt.f64N/A

        \[\leadsto -\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \color{blue}{\sqrt{a}}\right) \cdot {a}^{\left(\frac{\frac{2}{2}}{2}\right)} \]
      21. metadata-evalN/A

        \[\leadsto -\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \sqrt{a}\right) \cdot {a}^{\left(\frac{\color{blue}{1}}{2}\right)} \]
      22. metadata-evalN/A

        \[\leadsto -\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \sqrt{a}\right) \cdot {a}^{\color{blue}{\frac{1}{2}}} \]
      23. unpow1/2N/A

        \[\leadsto -\left(\left(\left(b \cdot a\right) \cdot b\right) \cdot \sqrt{a}\right) \cdot \color{blue}{\sqrt{a}} \]
      24. lower-sqrt.f6493.2

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{neg}\left(b \cdot a\right)\right) \cdot \sqrt{\color{blue}{b \cdot \left(\left(b \cdot a\right) \cdot a\right)}} \]
    6. Applied rewrites47.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(-b\right) \cdot a\right) \cdot \left(a \cdot \color{blue}{b}\right) \]
      18. remove-double-divN/A

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(b \cdot a\right) \cdot a}{\frac{-1}{b}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification95.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 6 \cdot 10^{-199}:\\ \;\;\;\;\left(\left(\left(-a\right) \cdot b\right) \cdot b\right) \cdot a\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(a \cdot b\right) \cdot a}{\frac{-1}{b}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 97.7% accurate, 0.7× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ a_m = \left|a\right| \\ [a_m, b_m] = \mathsf{sort}([a_m, b_m])\\ \\ \begin{array}{l} t_0 := \left(-a\_m\right) \cdot b\_m\\ \mathbf{if}\;a\_m \leq 1.6 \cdot 10^{-199}:\\ \;\;\;\;\left(t\_0 \cdot b\_m\right) \cdot a\_m\\ \mathbf{else}:\\ \;\;\;\;\left(t\_0 \cdot a\_m\right) \cdot b\_m\\ \end{array} \end{array} \]
b_m = (fabs.f64 b)
a_m = (fabs.f64 a)
NOTE: a_m and b_m should be sorted in increasing order before calling this function.
(FPCore (a_m b_m)
 :precision binary64
 (let* ((t_0 (* (- a_m) b_m)))
   (if (<= a_m 1.6e-199) (* (* t_0 b_m) a_m) (* (* t_0 a_m) b_m))))
b_m = fabs(b);
a_m = fabs(a);
assert(a_m < b_m);
double code(double a_m, double b_m) {
	double t_0 = -a_m * b_m;
	double tmp;
	if (a_m <= 1.6e-199) {
		tmp = (t_0 * b_m) * a_m;
	} else {
		tmp = (t_0 * a_m) * b_m;
	}
	return tmp;
}
b_m = abs(b)
a_m = abs(a)
NOTE: a_m and b_m should be sorted in increasing order before calling this function.
real(8) function code(a_m, b_m)
    real(8), intent (in) :: a_m
    real(8), intent (in) :: b_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -a_m * b_m
    if (a_m <= 1.6d-199) then
        tmp = (t_0 * b_m) * a_m
    else
        tmp = (t_0 * a_m) * b_m
    end if
    code = tmp
end function
b_m = Math.abs(b);
a_m = Math.abs(a);
assert a_m < b_m;
public static double code(double a_m, double b_m) {
	double t_0 = -a_m * b_m;
	double tmp;
	if (a_m <= 1.6e-199) {
		tmp = (t_0 * b_m) * a_m;
	} else {
		tmp = (t_0 * a_m) * b_m;
	}
	return tmp;
}
b_m = math.fabs(b)
a_m = math.fabs(a)
[a_m, b_m] = sort([a_m, b_m])
def code(a_m, b_m):
	t_0 = -a_m * b_m
	tmp = 0
	if a_m <= 1.6e-199:
		tmp = (t_0 * b_m) * a_m
	else:
		tmp = (t_0 * a_m) * b_m
	return tmp
b_m = abs(b)
a_m = abs(a)
a_m, b_m = sort([a_m, b_m])
function code(a_m, b_m)
	t_0 = Float64(Float64(-a_m) * b_m)
	tmp = 0.0
	if (a_m <= 1.6e-199)
		tmp = Float64(Float64(t_0 * b_m) * a_m);
	else
		tmp = Float64(Float64(t_0 * a_m) * b_m);
	end
	return tmp
end
b_m = abs(b);
a_m = abs(a);
a_m, b_m = num2cell(sort([a_m, b_m])){:}
function tmp_2 = code(a_m, b_m)
	t_0 = -a_m * b_m;
	tmp = 0.0;
	if (a_m <= 1.6e-199)
		tmp = (t_0 * b_m) * a_m;
	else
		tmp = (t_0 * a_m) * b_m;
	end
	tmp_2 = tmp;
end
b_m = N[Abs[b], $MachinePrecision]
a_m = N[Abs[a], $MachinePrecision]
NOTE: a_m and b_m should be sorted in increasing order before calling this function.
code[a$95$m_, b$95$m_] := Block[{t$95$0 = N[((-a$95$m) * b$95$m), $MachinePrecision]}, If[LessEqual[a$95$m, 1.6e-199], N[(N[(t$95$0 * b$95$m), $MachinePrecision] * a$95$m), $MachinePrecision], N[(N[(t$95$0 * a$95$m), $MachinePrecision] * b$95$m), $MachinePrecision]]]
\begin{array}{l}
b_m = \left|b\right|
\\
a_m = \left|a\right|
\\
[a_m, b_m] = \mathsf{sort}([a_m, b_m])\\
\\
\begin{array}{l}
t_0 := \left(-a\_m\right) \cdot b\_m\\
\mathbf{if}\;a\_m \leq 1.6 \cdot 10^{-199}:\\
\;\;\;\;\left(t\_0 \cdot b\_m\right) \cdot a\_m\\

\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot a\_m\right) \cdot b\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 1.6e-199

    1. Initial program 82.7%

      \[-\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. associate-*l*N/A

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(b \cdot a\right)} \cdot b\right) \cdot \left(\mathsf{neg}\left(a\right)\right) \]
      14. lower-neg.f6494.7

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

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

    if 1.6e-199 < a

    1. Initial program 88.7%

      \[-\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. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(\left(\mathsf{neg}\left(a\right)\right) \cdot b\right)} \cdot a\right) \cdot b \]
      13. lower-neg.f6497.8

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

      \[\leadsto \color{blue}{\left(\left(\left(-a\right) \cdot b\right) \cdot a\right) \cdot b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification95.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 1.6 \cdot 10^{-199}:\\ \;\;\;\;\left(\left(\left(-a\right) \cdot b\right) \cdot b\right) \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(-a\right) \cdot b\right) \cdot a\right) \cdot b\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 96.6% accurate, 0.7× speedup?

\[\begin{array}{l} b_m = \left|b\right| \\ a_m = \left|a\right| \\ [a_m, b_m] = \mathsf{sort}([a_m, b_m])\\ \\ \begin{array}{l} \mathbf{if}\;a\_m \leq 7.4 \cdot 10^{-155}:\\ \;\;\;\;\left(\left(\left(-a\_m\right) \cdot b\_m\right) \cdot b\_m\right) \cdot a\_m\\ \mathbf{else}:\\ \;\;\;\;\left(-b\_m\right) \cdot \left(\left(a\_m \cdot a\_m\right) \cdot b\_m\right)\\ \end{array} \end{array} \]
b_m = (fabs.f64 b)
a_m = (fabs.f64 a)
NOTE: a_m and b_m should be sorted in increasing order before calling this function.
(FPCore (a_m b_m)
 :precision binary64
 (if (<= a_m 7.4e-155)
   (* (* (* (- a_m) b_m) b_m) a_m)
   (* (- b_m) (* (* a_m a_m) b_m))))
b_m = fabs(b);
a_m = fabs(a);
assert(a_m < b_m);
double code(double a_m, double b_m) {
	double tmp;
	if (a_m <= 7.4e-155) {
		tmp = ((-a_m * b_m) * b_m) * a_m;
	} else {
		tmp = -b_m * ((a_m * a_m) * b_m);
	}
	return tmp;
}
b_m = abs(b)
a_m = abs(a)
NOTE: a_m and b_m should be sorted in increasing order before calling this function.
real(8) function code(a_m, b_m)
    real(8), intent (in) :: a_m
    real(8), intent (in) :: b_m
    real(8) :: tmp
    if (a_m <= 7.4d-155) then
        tmp = ((-a_m * b_m) * b_m) * a_m
    else
        tmp = -b_m * ((a_m * a_m) * b_m)
    end if
    code = tmp
end function
b_m = Math.abs(b);
a_m = Math.abs(a);
assert a_m < b_m;
public static double code(double a_m, double b_m) {
	double tmp;
	if (a_m <= 7.4e-155) {
		tmp = ((-a_m * b_m) * b_m) * a_m;
	} else {
		tmp = -b_m * ((a_m * a_m) * b_m);
	}
	return tmp;
}
b_m = math.fabs(b)
a_m = math.fabs(a)
[a_m, b_m] = sort([a_m, b_m])
def code(a_m, b_m):
	tmp = 0
	if a_m <= 7.4e-155:
		tmp = ((-a_m * b_m) * b_m) * a_m
	else:
		tmp = -b_m * ((a_m * a_m) * b_m)
	return tmp
b_m = abs(b)
a_m = abs(a)
a_m, b_m = sort([a_m, b_m])
function code(a_m, b_m)
	tmp = 0.0
	if (a_m <= 7.4e-155)
		tmp = Float64(Float64(Float64(Float64(-a_m) * b_m) * b_m) * a_m);
	else
		tmp = Float64(Float64(-b_m) * Float64(Float64(a_m * a_m) * b_m));
	end
	return tmp
end
b_m = abs(b);
a_m = abs(a);
a_m, b_m = num2cell(sort([a_m, b_m])){:}
function tmp_2 = code(a_m, b_m)
	tmp = 0.0;
	if (a_m <= 7.4e-155)
		tmp = ((-a_m * b_m) * b_m) * a_m;
	else
		tmp = -b_m * ((a_m * a_m) * b_m);
	end
	tmp_2 = tmp;
end
b_m = N[Abs[b], $MachinePrecision]
a_m = N[Abs[a], $MachinePrecision]
NOTE: a_m and b_m should be sorted in increasing order before calling this function.
code[a$95$m_, b$95$m_] := If[LessEqual[a$95$m, 7.4e-155], N[(N[(N[((-a$95$m) * b$95$m), $MachinePrecision] * b$95$m), $MachinePrecision] * a$95$m), $MachinePrecision], N[((-b$95$m) * N[(N[(a$95$m * a$95$m), $MachinePrecision] * b$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
b_m = \left|b\right|
\\
a_m = \left|a\right|
\\
[a_m, b_m] = \mathsf{sort}([a_m, b_m])\\
\\
\begin{array}{l}
\mathbf{if}\;a\_m \leq 7.4 \cdot 10^{-155}:\\
\;\;\;\;\left(\left(\left(-a\_m\right) \cdot b\_m\right) \cdot b\_m\right) \cdot a\_m\\

\mathbf{else}:\\
\;\;\;\;\left(-b\_m\right) \cdot \left(\left(a\_m \cdot a\_m\right) \cdot b\_m\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 7.4000000000000001e-155

    1. Initial program 82.0%

      \[-\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. associate-*l*N/A

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{\left(b \cdot a\right)} \cdot b\right) \cdot \left(\mathsf{neg}\left(a\right)\right) \]
      14. lower-neg.f6493.9

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

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

    if 7.4000000000000001e-155 < a

    1. Initial program 90.8%

      \[-\left(\left(a \cdot a\right) \cdot b\right) \cdot b \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification92.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 7.4 \cdot 10^{-155}:\\ \;\;\;\;\left(\left(\left(-a\right) \cdot b\right) \cdot b\right) \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(-b\right) \cdot \left(\left(a \cdot a\right) \cdot b\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 82.1% accurate, 1.0× speedup?

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

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

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

Alternative 6: 28.3% accurate, 1.1× speedup?

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

    \[-\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 rewrites34.2%

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

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

Alternative 7: 28.1% accurate, 1.1× speedup?

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

    \[-\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 rewrites34.1%

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

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

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

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

      \[\leadsto \color{blue}{\left({a}^{2} \cdot b\right) \cdot b} \]
    4. unpow2N/A

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

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

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

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

      \[\leadsto \left(\color{blue}{\left(b \cdot a\right)} \cdot a\right) \cdot b \]
    9. lower-*.f6434.2

      \[\leadsto \left(\color{blue}{\left(b \cdot a\right)} \cdot a\right) \cdot b \]
  7. Applied rewrites34.2%

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

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

Reproduce

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