Bouland and Aaronson, Equation (24)

Percentage Accurate: 74.1% → 98.2%
Time: 7.7s
Alternatives: 4
Speedup: 0.5×

Specification

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

\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1
\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 4 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: 74.1% accurate, 1.0× speedup?

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

\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1
\end{array}

Alternative 1: 98.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\\ \mathbf{if}\;t_0 \leq \infty:\\ \;\;\;\;t_0 + -1\\ \mathbf{else}:\\ \;\;\;\;{a}^{4}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (let* ((t_0
         (+
          (pow (+ (* a a) (* b b)) 2.0)
          (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ a 3.0)))))))
   (if (<= t_0 INFINITY) (+ t_0 -1.0) (pow a 4.0))))
double code(double a, double b) {
	double t_0 = pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))));
	double tmp;
	if (t_0 <= ((double) INFINITY)) {
		tmp = t_0 + -1.0;
	} else {
		tmp = pow(a, 4.0);
	}
	return tmp;
}
public static double code(double a, double b) {
	double t_0 = Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))));
	double tmp;
	if (t_0 <= Double.POSITIVE_INFINITY) {
		tmp = t_0 + -1.0;
	} else {
		tmp = Math.pow(a, 4.0);
	}
	return tmp;
}
def code(a, b):
	t_0 = math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))))
	tmp = 0
	if t_0 <= math.inf:
		tmp = t_0 + -1.0
	else:
		tmp = math.pow(a, 4.0)
	return tmp
function code(a, b)
	t_0 = Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 - a)) + Float64(Float64(b * b) * Float64(a + 3.0)))))
	tmp = 0.0
	if (t_0 <= Inf)
		tmp = Float64(t_0 + -1.0);
	else
		tmp = a ^ 4.0;
	end
	return tmp
end
function tmp_2 = code(a, b)
	t_0 = (((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))));
	tmp = 0.0;
	if (t_0 <= Inf)
		tmp = t_0 + -1.0;
	else
		tmp = a ^ 4.0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := Block[{t$95$0 = N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 + -1.0), $MachinePrecision], N[Power[a, 4.0], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\\
\mathbf{if}\;t_0 \leq \infty:\\
\;\;\;\;t_0 + -1\\

\mathbf{else}:\\
\;\;\;\;{a}^{4}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a))))) < +inf.0

    1. Initial program 99.8%

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

    if +inf.0 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) 2) (*.f64 4 (+.f64 (*.f64 (*.f64 a a) (-.f64 1 a)) (*.f64 (*.f64 b b) (+.f64 3 a)))))

    1. Initial program 0.0%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+0.0%

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

        \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}}^{2} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right) - 1\right) \]
      3. distribute-rgt-in0.0%

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\color{blue}{\left(\left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) \cdot 4 + \left(\left(b \cdot b\right) \cdot \left(3 + a\right)\right) \cdot 4\right)} - 1\right) \]
      4. sqr-neg0.0%

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\left(\left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) \cdot 4 + \left(\color{blue}{\left(\left(-b\right) \cdot \left(-b\right)\right)} \cdot \left(3 + a\right)\right) \cdot 4\right) - 1\right) \]
      5. distribute-rgt-in0.0%

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \color{blue}{\mathsf{fma}\left(a \cdot a, 1 - a, \left(\left(-b\right) \cdot \left(-b\right)\right) \cdot \left(3 + a\right)\right)} - 1\right) \]
      7. sqr-neg5.1%

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

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

      \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in a around inf 98.4%

      \[\leadsto \color{blue}{{a}^{4}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) \leq \infty:\\ \;\;\;\;\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;{a}^{4}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 68.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -0.0003 \lor \neg \left(a \leq 5.5 \cdot 10^{-5}\right):\\ \;\;\;\;{a}^{4}\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) + -1\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (or (<= a -0.0003) (not (<= a 5.5e-5)))
   (pow a 4.0)
   (+ (* 4.0 (* (* a a) (- 1.0 a))) -1.0)))
double code(double a, double b) {
	double tmp;
	if ((a <= -0.0003) || !(a <= 5.5e-5)) {
		tmp = pow(a, 4.0);
	} else {
		tmp = (4.0 * ((a * a) * (1.0 - a))) + -1.0;
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if ((a <= (-0.0003d0)) .or. (.not. (a <= 5.5d-5))) then
        tmp = a ** 4.0d0
    else
        tmp = (4.0d0 * ((a * a) * (1.0d0 - a))) + (-1.0d0)
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if ((a <= -0.0003) || !(a <= 5.5e-5)) {
		tmp = Math.pow(a, 4.0);
	} else {
		tmp = (4.0 * ((a * a) * (1.0 - a))) + -1.0;
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if (a <= -0.0003) or not (a <= 5.5e-5):
		tmp = math.pow(a, 4.0)
	else:
		tmp = (4.0 * ((a * a) * (1.0 - a))) + -1.0
	return tmp
function code(a, b)
	tmp = 0.0
	if ((a <= -0.0003) || !(a <= 5.5e-5))
		tmp = a ^ 4.0;
	else
		tmp = Float64(Float64(4.0 * Float64(Float64(a * a) * Float64(1.0 - a))) + -1.0);
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if ((a <= -0.0003) || ~((a <= 5.5e-5)))
		tmp = a ^ 4.0;
	else
		tmp = (4.0 * ((a * a) * (1.0 - a))) + -1.0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[Or[LessEqual[a, -0.0003], N[Not[LessEqual[a, 5.5e-5]], $MachinePrecision]], N[Power[a, 4.0], $MachinePrecision], N[(N[(4.0 * N[(N[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.0003 \lor \neg \left(a \leq 5.5 \cdot 10^{-5}\right):\\
\;\;\;\;{a}^{4}\\

\mathbf{else}:\\
\;\;\;\;4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) + -1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.99999999999999974e-4 or 5.5000000000000002e-5 < a

    1. Initial program 53.0%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+53.0%

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

        \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}}^{2} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right) - 1\right) \]
      3. distribute-rgt-in53.0%

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\color{blue}{\left(\left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) \cdot 4 + \left(\left(b \cdot b\right) \cdot \left(3 + a\right)\right) \cdot 4\right)} - 1\right) \]
      4. sqr-neg53.0%

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\left(\left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) \cdot 4 + \left(\color{blue}{\left(\left(-b\right) \cdot \left(-b\right)\right)} \cdot \left(3 + a\right)\right) \cdot 4\right) - 1\right) \]
      5. distribute-rgt-in53.0%

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \color{blue}{\mathsf{fma}\left(a \cdot a, 1 - a, \left(\left(-b\right) \cdot \left(-b\right)\right) \cdot \left(3 + a\right)\right)} - 1\right) \]
      7. sqr-neg55.4%

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

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

      \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in a around inf 87.2%

      \[\leadsto \color{blue}{{a}^{4}} \]

    if -2.99999999999999974e-4 < a < 5.5000000000000002e-5

    1. Initial program 99.9%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+99.9%

        \[\leadsto \color{blue}{{\left(a \cdot a + b \cdot b\right)}^{2} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right) - 1\right)} \]
      2. fma-def99.9%

        \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}}^{2} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right) - 1\right) \]
      3. distribute-rgt-in99.9%

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\color{blue}{\left(\left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) \cdot 4 + \left(\left(b \cdot b\right) \cdot \left(3 + a\right)\right) \cdot 4\right)} - 1\right) \]
      4. sqr-neg99.9%

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\left(\left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) \cdot 4 + \left(\color{blue}{\left(\left(-b\right) \cdot \left(-b\right)\right)} \cdot \left(3 + a\right)\right) \cdot 4\right) - 1\right) \]
      5. distribute-rgt-in99.9%

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\color{blue}{4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(\left(-b\right) \cdot \left(-b\right)\right) \cdot \left(3 + a\right)\right)} - 1\right) \]
      6. fma-def99.9%

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \color{blue}{\mathsf{fma}\left(a \cdot a, 1 - a, \left(\left(-b\right) \cdot \left(-b\right)\right) \cdot \left(3 + a\right)\right)} - 1\right) \]
      7. sqr-neg99.9%

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \color{blue}{\left(b \cdot b\right)} \cdot \left(3 + a\right)\right) - 1\right) \]
      8. +-commutative99.9%

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

      \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-def99.9%

        \[\leadsto {\color{blue}{\left(a \cdot a + b \cdot b\right)}}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      2. add-cube-cbrt99.8%

        \[\leadsto \color{blue}{\left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      3. associate-*l*99.8%

        \[\leadsto \color{blue}{\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right)} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      4. unpow299.8%

        \[\leadsto \sqrt[3]{\color{blue}{\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right)}} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      5. cbrt-prod99.9%

        \[\leadsto \color{blue}{\left(\sqrt[3]{a \cdot a + b \cdot b} \cdot \sqrt[3]{a \cdot a + b \cdot b}\right)} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      6. fma-def99.9%

        \[\leadsto \left(\sqrt[3]{\color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)}} \cdot \sqrt[3]{a \cdot a + b \cdot b}\right) \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      7. fma-def99.9%

        \[\leadsto \left(\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \sqrt[3]{\color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)}}\right) \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      8. pow299.9%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{2}} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      9. add-sqr-sqrt99.9%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}}}\right)}^{2} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      10. pow299.9%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{2}}}\right)}^{2} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      11. fma-def99.9%

        \[\leadsto {\left(\sqrt[3]{{\left(\sqrt{\color{blue}{a \cdot a + b \cdot b}}\right)}^{2}}\right)}^{2} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      12. hypot-def99.9%

        \[\leadsto {\left(\sqrt[3]{{\color{blue}{\left(\mathsf{hypot}\left(a, b\right)\right)}}^{2}}\right)}^{2} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    6. Applied egg-rr96.3%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} \cdot \sqrt[3]{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{4}}} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    7. Step-by-step derivation
      1. *-commutative96.3%

        \[\leadsto \color{blue}{\sqrt[3]{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{4}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2}} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      2. metadata-eval96.3%

        \[\leadsto \sqrt[3]{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{\color{blue}{\left(2 \cdot 2\right)}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      3. pow-sqr96.3%

        \[\leadsto \sqrt[3]{\color{blue}{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2} \cdot {\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      4. unpow296.3%

        \[\leadsto \sqrt[3]{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2} \cdot \color{blue}{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      5. unpow296.3%

        \[\leadsto \sqrt[3]{\color{blue}{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot \left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      6. pow-sqr96.3%

        \[\leadsto \sqrt[3]{\color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}} \cdot \left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      7. metadata-eval96.3%

        \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\color{blue}{4}} \cdot \left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      8. pow-sqr96.3%

        \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} \cdot \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      9. metadata-eval96.3%

        \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\color{blue}{4}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      10. pow-sqr96.3%

        \[\leadsto \sqrt[3]{\color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 4\right)}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      11. metadata-eval96.3%

        \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\color{blue}{8}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    8. Simplified96.3%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{8}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2}} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    9. Taylor expanded in a around 0 96.2%

      \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{8}} \cdot {\color{blue}{\left({\left({b}^{2}\right)}^{0.3333333333333333}\right)}}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    10. Step-by-step derivation
      1. unpow1/396.3%

        \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{8}} \cdot {\color{blue}{\left(\sqrt[3]{{b}^{2}}\right)}}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    11. Simplified96.3%

      \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{8}} \cdot {\color{blue}{\left(\sqrt[3]{{b}^{2}}\right)}}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    12. Taylor expanded in b around 0 54.8%

      \[\leadsto \color{blue}{4 \cdot \left({a}^{2} \cdot \left(1 - a\right)\right) - 1} \]
    13. Step-by-step derivation
      1. pow254.8%

        \[\leadsto 4 \cdot \left(\color{blue}{\left(a \cdot a\right)} \cdot \left(1 - a\right)\right) - 1 \]
    14. Applied egg-rr54.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -0.0003 \lor \neg \left(a \leq 5.5 \cdot 10^{-5}\right):\\ \;\;\;\;{a}^{4}\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) + -1\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 60.5% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 0.012:\\ \;\;\;\;4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= b 0.012) (+ (* 4.0 (* (* a a) (- 1.0 a))) -1.0) (pow b 4.0)))
double code(double a, double b) {
	double tmp;
	if (b <= 0.012) {
		tmp = (4.0 * ((a * a) * (1.0 - a))) + -1.0;
	} else {
		tmp = pow(b, 4.0);
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (b <= 0.012d0) then
        tmp = (4.0d0 * ((a * a) * (1.0d0 - a))) + (-1.0d0)
    else
        tmp = b ** 4.0d0
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if (b <= 0.012) {
		tmp = (4.0 * ((a * a) * (1.0 - a))) + -1.0;
	} else {
		tmp = Math.pow(b, 4.0);
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if b <= 0.012:
		tmp = (4.0 * ((a * a) * (1.0 - a))) + -1.0
	else:
		tmp = math.pow(b, 4.0)
	return tmp
function code(a, b)
	tmp = 0.0
	if (b <= 0.012)
		tmp = Float64(Float64(4.0 * Float64(Float64(a * a) * Float64(1.0 - a))) + -1.0);
	else
		tmp = b ^ 4.0;
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (b <= 0.012)
		tmp = (4.0 * ((a * a) * (1.0 - a))) + -1.0;
	else
		tmp = b ^ 4.0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[b, 0.012], N[(N[(4.0 * N[(N[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.012:\\
\;\;\;\;4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) + -1\\

\mathbf{else}:\\
\;\;\;\;{b}^{4}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 0.012

    1. Initial program 83.7%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+83.7%

        \[\leadsto \color{blue}{{\left(a \cdot a + b \cdot b\right)}^{2} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right) - 1\right)} \]
      2. fma-def83.7%

        \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}}^{2} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right) - 1\right) \]
      3. distribute-rgt-in83.7%

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\color{blue}{\left(\left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) \cdot 4 + \left(\left(b \cdot b\right) \cdot \left(3 + a\right)\right) \cdot 4\right)} - 1\right) \]
      4. sqr-neg83.7%

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\left(\left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) \cdot 4 + \left(\color{blue}{\left(\left(-b\right) \cdot \left(-b\right)\right)} \cdot \left(3 + a\right)\right) \cdot 4\right) - 1\right) \]
      5. distribute-rgt-in83.7%

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \color{blue}{\mathsf{fma}\left(a \cdot a, 1 - a, \left(\left(-b\right) \cdot \left(-b\right)\right) \cdot \left(3 + a\right)\right)} - 1\right) \]
      7. sqr-neg85.3%

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

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

      \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-def85.3%

        \[\leadsto {\color{blue}{\left(a \cdot a + b \cdot b\right)}}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      2. add-cube-cbrt85.2%

        \[\leadsto \color{blue}{\left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      3. associate-*l*85.2%

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

        \[\leadsto \sqrt[3]{\color{blue}{\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right)}} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      5. cbrt-prod85.2%

        \[\leadsto \color{blue}{\left(\sqrt[3]{a \cdot a + b \cdot b} \cdot \sqrt[3]{a \cdot a + b \cdot b}\right)} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      6. fma-def85.2%

        \[\leadsto \left(\sqrt[3]{\color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)}} \cdot \sqrt[3]{a \cdot a + b \cdot b}\right) \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      7. fma-def85.2%

        \[\leadsto \left(\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \sqrt[3]{\color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)}}\right) \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      8. pow285.2%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{2}} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      9. add-sqr-sqrt85.2%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}}}\right)}^{2} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      10. pow285.2%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{2}}}\right)}^{2} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      11. fma-def85.2%

        \[\leadsto {\left(\sqrt[3]{{\left(\sqrt{\color{blue}{a \cdot a + b \cdot b}}\right)}^{2}}\right)}^{2} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      12. hypot-def85.2%

        \[\leadsto {\left(\sqrt[3]{{\color{blue}{\left(\mathsf{hypot}\left(a, b\right)\right)}}^{2}}\right)}^{2} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    6. Applied egg-rr79.5%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} \cdot \sqrt[3]{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{4}}} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    7. Step-by-step derivation
      1. *-commutative79.5%

        \[\leadsto \color{blue}{\sqrt[3]{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{4}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2}} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      2. metadata-eval79.5%

        \[\leadsto \sqrt[3]{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{\color{blue}{\left(2 \cdot 2\right)}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      3. pow-sqr79.5%

        \[\leadsto \sqrt[3]{\color{blue}{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2} \cdot {\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      4. unpow279.5%

        \[\leadsto \sqrt[3]{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2} \cdot \color{blue}{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      5. unpow279.5%

        \[\leadsto \sqrt[3]{\color{blue}{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot \left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      6. pow-sqr79.5%

        \[\leadsto \sqrt[3]{\color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}} \cdot \left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      7. metadata-eval79.5%

        \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\color{blue}{4}} \cdot \left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      8. pow-sqr79.5%

        \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} \cdot \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      9. metadata-eval79.5%

        \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\color{blue}{4}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      10. pow-sqr79.5%

        \[\leadsto \sqrt[3]{\color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 4\right)}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
      11. metadata-eval79.5%

        \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\color{blue}{8}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    8. Simplified79.5%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{8}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2}} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    9. Taylor expanded in a around 0 70.1%

      \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{8}} \cdot {\color{blue}{\left({\left({b}^{2}\right)}^{0.3333333333333333}\right)}}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    10. Step-by-step derivation
      1. unpow1/370.2%

        \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{8}} \cdot {\color{blue}{\left(\sqrt[3]{{b}^{2}}\right)}}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    11. Simplified70.2%

      \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{8}} \cdot {\color{blue}{\left(\sqrt[3]{{b}^{2}}\right)}}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    12. Taylor expanded in b around 0 55.3%

      \[\leadsto \color{blue}{4 \cdot \left({a}^{2} \cdot \left(1 - a\right)\right) - 1} \]
    13. Step-by-step derivation
      1. pow255.3%

        \[\leadsto 4 \cdot \left(\color{blue}{\left(a \cdot a\right)} \cdot \left(1 - a\right)\right) - 1 \]
    14. Applied egg-rr55.3%

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

    if 0.012 < b

    1. Initial program 56.2%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+56.2%

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

        \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}}^{2} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right) - 1\right) \]
      3. distribute-rgt-in56.2%

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\left(\left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) \cdot 4 + \left(\color{blue}{\left(\left(-b\right) \cdot \left(-b\right)\right)} \cdot \left(3 + a\right)\right) \cdot 4\right) - 1\right) \]
      5. distribute-rgt-in56.2%

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \color{blue}{\mathsf{fma}\left(a \cdot a, 1 - a, \left(\left(-b\right) \cdot \left(-b\right)\right) \cdot \left(3 + a\right)\right)} - 1\right) \]
      7. sqr-neg56.2%

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

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

      \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in b around inf 86.7%

      \[\leadsto \color{blue}{{b}^{4}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification63.1%

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

Alternative 4: 42.6% accurate, 11.6× speedup?

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

\\
4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) + -1
\end{array}
Derivation
  1. Initial program 76.8%

    \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
  2. Step-by-step derivation
    1. associate--l+76.8%

      \[\leadsto \color{blue}{{\left(a \cdot a + b \cdot b\right)}^{2} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right) - 1\right)} \]
    2. fma-def76.8%

      \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}}^{2} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right) - 1\right) \]
    3. distribute-rgt-in76.8%

      \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\color{blue}{\left(\left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) \cdot 4 + \left(\left(b \cdot b\right) \cdot \left(3 + a\right)\right) \cdot 4\right)} - 1\right) \]
    4. sqr-neg76.8%

      \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\left(\left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) \cdot 4 + \left(\color{blue}{\left(\left(-b\right) \cdot \left(-b\right)\right)} \cdot \left(3 + a\right)\right) \cdot 4\right) - 1\right) \]
    5. distribute-rgt-in76.8%

      \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\color{blue}{4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(\left(-b\right) \cdot \left(-b\right)\right) \cdot \left(3 + a\right)\right)} - 1\right) \]
    6. fma-def78.0%

      \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \color{blue}{\mathsf{fma}\left(a \cdot a, 1 - a, \left(\left(-b\right) \cdot \left(-b\right)\right) \cdot \left(3 + a\right)\right)} - 1\right) \]
    7. sqr-neg78.0%

      \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \color{blue}{\left(b \cdot b\right)} \cdot \left(3 + a\right)\right) - 1\right) \]
    8. +-commutative78.0%

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

    \[\leadsto \color{blue}{{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. fma-def78.0%

      \[\leadsto {\color{blue}{\left(a \cdot a + b \cdot b\right)}}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    2. add-cube-cbrt77.8%

      \[\leadsto \color{blue}{\left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    3. associate-*l*77.8%

      \[\leadsto \color{blue}{\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right)} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    4. unpow277.8%

      \[\leadsto \sqrt[3]{\color{blue}{\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right)}} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    5. cbrt-prod77.9%

      \[\leadsto \color{blue}{\left(\sqrt[3]{a \cdot a + b \cdot b} \cdot \sqrt[3]{a \cdot a + b \cdot b}\right)} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    6. fma-def77.9%

      \[\leadsto \left(\sqrt[3]{\color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)}} \cdot \sqrt[3]{a \cdot a + b \cdot b}\right) \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    7. fma-def77.9%

      \[\leadsto \left(\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \sqrt[3]{\color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)}}\right) \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    8. pow277.9%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{2}} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    9. add-sqr-sqrt77.9%

      \[\leadsto {\left(\sqrt[3]{\color{blue}{\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}}}\right)}^{2} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    10. pow277.9%

      \[\leadsto {\left(\sqrt[3]{\color{blue}{{\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{2}}}\right)}^{2} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    11. fma-def77.9%

      \[\leadsto {\left(\sqrt[3]{{\left(\sqrt{\color{blue}{a \cdot a + b \cdot b}}\right)}^{2}}\right)}^{2} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    12. hypot-def77.9%

      \[\leadsto {\left(\sqrt[3]{{\color{blue}{\left(\mathsf{hypot}\left(a, b\right)\right)}}^{2}}\right)}^{2} \cdot \left(\sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}} \cdot \sqrt[3]{{\left(a \cdot a + b \cdot b\right)}^{2}}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
  6. Applied egg-rr71.9%

    \[\leadsto \color{blue}{{\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} \cdot \sqrt[3]{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{4}}} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
  7. Step-by-step derivation
    1. *-commutative71.9%

      \[\leadsto \color{blue}{\sqrt[3]{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{4}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2}} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    2. metadata-eval71.9%

      \[\leadsto \sqrt[3]{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{\color{blue}{\left(2 \cdot 2\right)}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    3. pow-sqr71.9%

      \[\leadsto \sqrt[3]{\color{blue}{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2} \cdot {\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    4. unpow271.9%

      \[\leadsto \sqrt[3]{{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}^{2} \cdot \color{blue}{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    5. unpow271.9%

      \[\leadsto \sqrt[3]{\color{blue}{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot \left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    6. pow-sqr71.9%

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}} \cdot \left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    7. metadata-eval71.9%

      \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\color{blue}{4}} \cdot \left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    8. pow-sqr71.9%

      \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} \cdot \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    9. metadata-eval71.9%

      \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\color{blue}{4}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    10. pow-sqr71.9%

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 4\right)}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
    11. metadata-eval71.9%

      \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\color{blue}{8}}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
  8. Simplified71.9%

    \[\leadsto \color{blue}{\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{8}} \cdot {\left(\sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)}^{2}} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
  9. Taylor expanded in a around 0 64.6%

    \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{8}} \cdot {\color{blue}{\left({\left({b}^{2}\right)}^{0.3333333333333333}\right)}}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
  10. Step-by-step derivation
    1. unpow1/364.7%

      \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{8}} \cdot {\color{blue}{\left(\sqrt[3]{{b}^{2}}\right)}}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
  11. Simplified64.7%

    \[\leadsto \sqrt[3]{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{8}} \cdot {\color{blue}{\left(\sqrt[3]{{b}^{2}}\right)}}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right) - 1\right) \]
  12. Taylor expanded in b around 0 46.4%

    \[\leadsto \color{blue}{4 \cdot \left({a}^{2} \cdot \left(1 - a\right)\right) - 1} \]
  13. Step-by-step derivation
    1. pow246.4%

      \[\leadsto 4 \cdot \left(\color{blue}{\left(a \cdot a\right)} \cdot \left(1 - a\right)\right) - 1 \]
  14. Applied egg-rr46.4%

    \[\leadsto 4 \cdot \left(\color{blue}{\left(a \cdot a\right)} \cdot \left(1 - a\right)\right) - 1 \]
  15. Final simplification46.4%

    \[\leadsto 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right) + -1 \]
  16. Add Preprocessing

Reproduce

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