Bouland and Aaronson, Equation (25)

Percentage Accurate: 73.8% → 100.0%
Time: 8.2s
Alternatives: 14
Speedup: 1.2×

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(1 - 3 \cdot 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) (- 1.0 (* 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) * (1.0 - (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) * (1.0d0 - (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) * (1.0 - (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) * (1.0 - (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(1.0 - 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) * (1.0 - (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[(1.0 - N[(3.0 * a), $MachinePrecision]), $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(1 - 3 \cdot 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 14 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: 73.8% 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(1 - 3 \cdot 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) (- 1.0 (* 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) * (1.0 - (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) * (1.0d0 - (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) * (1.0 - (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) * (1.0 - (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(1.0 - 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) * (1.0 - (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[(1.0 - N[(3.0 * a), $MachinePrecision]), $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(1 - 3 \cdot a\right)\right)\right) - 1
\end{array}

Alternative 1: 100.0% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right) \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(2, b \cdot \left(\left(a \cdot a\right) \cdot b\right), {b}^{4} + {a}^{4}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, a + 1, \left(b \cdot b\right) \cdot \left(1 + a \cdot -3\right)\right) + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + a \cdot \left(a + 4\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<=
      (+
       (pow (+ (* a a) (* b b)) 2.0)
       (* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0))))))
      INFINITY)
   (+
    (fma 2.0 (* b (* (* a a) b)) (+ (pow b 4.0) (pow a 4.0)))
    (+ (* 4.0 (fma (* a a) (+ a 1.0) (* (* b b) (+ 1.0 (* a -3.0))))) -1.0))
   (* (* a a) (+ (fma 2.0 (* b b) 4.0) (* a (+ a 4.0))))))
double code(double a, double b) {
	double tmp;
	if ((pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))))) <= ((double) INFINITY)) {
		tmp = fma(2.0, (b * ((a * a) * b)), (pow(b, 4.0) + pow(a, 4.0))) + ((4.0 * fma((a * a), (a + 1.0), ((b * b) * (1.0 + (a * -3.0))))) + -1.0);
	} else {
		tmp = (a * a) * (fma(2.0, (b * b), 4.0) + (a * (a + 4.0)));
	}
	return tmp;
}
function code(a, b)
	tmp = 0.0
	if (Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(a + 1.0)) + Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0)))))) <= Inf)
		tmp = Float64(fma(2.0, Float64(b * Float64(Float64(a * a) * b)), Float64((b ^ 4.0) + (a ^ 4.0))) + Float64(Float64(4.0 * fma(Float64(a * a), Float64(a + 1.0), Float64(Float64(b * b) * Float64(1.0 + Float64(a * -3.0))))) + -1.0));
	else
		tmp = Float64(Float64(a * a) * Float64(fma(2.0, Float64(b * b), 4.0) + Float64(a * Float64(a + 4.0))));
	end
	return tmp
end
code[a_, b_] := If[LessEqual[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[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(2.0 * N[(b * N[(N[(a * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] + N[(N[Power[b, 4.0], $MachinePrecision] + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(4.0 * N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 + N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * N[(N[(2.0 * N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision] + N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + a \cdot \left(a + 4\right)\right)\\


\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 1 (*.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+99.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def99.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified99.8%

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

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

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

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

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

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

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

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

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

    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 1 (*.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(1 - 3 \cdot 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(1 - 3 \cdot 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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified7.7%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot {a}^{3} + \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right)} \]
    8. Step-by-step derivation
      1. +-commutative36.9%

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

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

        \[\leadsto \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \cdot 4 \]
      4. associate-*r*36.9%

        \[\leadsto \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + \color{blue}{a \cdot \left(\left(a \cdot a\right) \cdot 4\right)} \]
      5. associate-+l+36.9%

        \[\leadsto \color{blue}{\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + \left({a}^{4} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right)} \]
      6. unpow236.9%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \color{blue}{\left(a \cdot a\right)} + \left({a}^{4} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right) \]
      7. metadata-eval36.9%

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left(\color{blue}{{a}^{3} \cdot a} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right) \]
      9. associate-*r*36.9%

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left({a}^{3} \cdot a + \color{blue}{{a}^{3}} \cdot 4\right) \]
      11. distribute-lft-in100.0%

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

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left(a + 4\right) \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \]
      14. associate-*r*100.0%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \color{blue}{\left(\left(a + 4\right) \cdot a\right) \cdot \left(a \cdot a\right)} \]
      15. distribute-rgt-out100.0%

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(\left(2 \cdot {b}^{2} + 4\right) + \left(a + 4\right) \cdot a\right)} \]
    9. Simplified100.0%

      \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + \left(a + 4\right) \cdot a\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification100.0%

    \[\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(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right) \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(2, b \cdot \left(\left(a \cdot a\right) \cdot b\right), {b}^{4} + {a}^{4}\right) + \left(4 \cdot \mathsf{fma}\left(a \cdot a, a + 1, \left(b \cdot b\right) \cdot \left(1 + a \cdot -3\right)\right) + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + a \cdot \left(a + 4\right)\right)\\ \end{array} \]

Alternative 2: 99.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right) \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(4, \mathsf{fma}\left(a, a \cdot \left(a + 1\right), \left(b \cdot b\right) \cdot \left(1 + a \cdot -3\right)\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + a \cdot \left(a + 4\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<=
      (+
       (pow (+ (* a a) (* b b)) 2.0)
       (* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0))))))
      INFINITY)
   (+
    (fma
     4.0
     (fma a (* a (+ a 1.0)) (* (* b b) (+ 1.0 (* a -3.0))))
     (pow (fma a a (* b b)) 2.0))
    -1.0)
   (* (* a a) (+ (fma 2.0 (* b b) 4.0) (* a (+ a 4.0))))))
double code(double a, double b) {
	double tmp;
	if ((pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))))) <= ((double) INFINITY)) {
		tmp = fma(4.0, fma(a, (a * (a + 1.0)), ((b * b) * (1.0 + (a * -3.0)))), pow(fma(a, a, (b * b)), 2.0)) + -1.0;
	} else {
		tmp = (a * a) * (fma(2.0, (b * b), 4.0) + (a * (a + 4.0)));
	}
	return tmp;
}
function code(a, b)
	tmp = 0.0
	if (Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(a + 1.0)) + Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0)))))) <= Inf)
		tmp = Float64(fma(4.0, fma(a, Float64(a * Float64(a + 1.0)), Float64(Float64(b * b) * Float64(1.0 + Float64(a * -3.0)))), (fma(a, a, Float64(b * b)) ^ 2.0)) + -1.0);
	else
		tmp = Float64(Float64(a * a) * Float64(fma(2.0, Float64(b * b), 4.0) + Float64(a * Float64(a + 4.0))));
	end
	return tmp
end
code[a_, b_] := If[LessEqual[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[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(4.0 * N[(a * N[(a * N[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 + N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(a * a + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * N[(N[(2.0 * N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision] + N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + a \cdot \left(a + 4\right)\right)\\


\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 1 (*.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. sub-neg99.8%

        \[\leadsto \color{blue}{\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(1 - 3 \cdot a\right)\right)\right) + \left(-1\right)} \]
    3. Simplified99.8%

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

    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 1 (*.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(1 - 3 \cdot 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(1 - 3 \cdot 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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified7.7%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot {a}^{3} + \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right)} \]
    8. Step-by-step derivation
      1. +-commutative36.9%

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

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

        \[\leadsto \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \cdot 4 \]
      4. associate-*r*36.9%

        \[\leadsto \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + \color{blue}{a \cdot \left(\left(a \cdot a\right) \cdot 4\right)} \]
      5. associate-+l+36.9%

        \[\leadsto \color{blue}{\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + \left({a}^{4} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right)} \]
      6. unpow236.9%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \color{blue}{\left(a \cdot a\right)} + \left({a}^{4} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right) \]
      7. metadata-eval36.9%

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left(\color{blue}{{a}^{3} \cdot a} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right) \]
      9. associate-*r*36.9%

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left({a}^{3} \cdot a + \color{blue}{{a}^{3}} \cdot 4\right) \]
      11. distribute-lft-in100.0%

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

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left(a + 4\right) \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \]
      14. associate-*r*100.0%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \color{blue}{\left(\left(a + 4\right) \cdot a\right) \cdot \left(a \cdot a\right)} \]
      15. distribute-rgt-out100.0%

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(\left(2 \cdot {b}^{2} + 4\right) + \left(a + 4\right) \cdot a\right)} \]
    9. Simplified100.0%

      \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + \left(a + 4\right) \cdot a\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

    \[\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(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right) \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(4, \mathsf{fma}\left(a, a \cdot \left(a + 1\right), \left(b \cdot b\right) \cdot \left(1 + a \cdot -3\right)\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + a \cdot \left(a + 4\right)\right)\\ \end{array} \]

Alternative 3: 99.9% 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(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right)\\ \mathbf{if}\;t_0 \leq \infty:\\ \;\;\;\;t_0 + -1\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + a \cdot \left(a + 4\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (let* ((t_0
         (+
          (pow (+ (* a a) (* b b)) 2.0)
          (* 4.0 (+ (* (* a a) (+ a 1.0)) (* (* b b) (- 1.0 (* a 3.0))))))))
   (if (<= t_0 INFINITY)
     (+ t_0 -1.0)
     (* (* a a) (+ (fma 2.0 (* b b) 4.0) (* a (+ a 4.0)))))))
double code(double a, double b) {
	double t_0 = pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (a + 1.0)) + ((b * b) * (1.0 - (a * 3.0)))));
	double tmp;
	if (t_0 <= ((double) INFINITY)) {
		tmp = t_0 + -1.0;
	} else {
		tmp = (a * a) * (fma(2.0, (b * b), 4.0) + (a * (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(a + 1.0)) + Float64(Float64(b * b) * Float64(1.0 - Float64(a * 3.0))))))
	tmp = 0.0
	if (t_0 <= Inf)
		tmp = Float64(t_0 + -1.0);
	else
		tmp = Float64(Float64(a * a) * Float64(fma(2.0, Float64(b * b), 4.0) + Float64(a * Float64(a + 4.0))));
	end
	return 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[(a + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], N[(t$95$0 + -1.0), $MachinePrecision], N[(N[(a * a), $MachinePrecision] * N[(N[(2.0 * N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision] + N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right)\\
\mathbf{if}\;t_0 \leq \infty:\\
\;\;\;\;t_0 + -1\\

\mathbf{else}:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + a \cdot \left(a + 4\right)\right)\\


\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 1 (*.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(1 - 3 \cdot a\right)\right)\right) - 1 \]

    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 1 (*.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(1 - 3 \cdot 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(1 - 3 \cdot 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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified7.7%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot {a}^{3} + \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right)} \]
    8. Step-by-step derivation
      1. +-commutative36.9%

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

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

        \[\leadsto \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \cdot 4 \]
      4. associate-*r*36.9%

        \[\leadsto \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + \color{blue}{a \cdot \left(\left(a \cdot a\right) \cdot 4\right)} \]
      5. associate-+l+36.9%

        \[\leadsto \color{blue}{\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + \left({a}^{4} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right)} \]
      6. unpow236.9%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \color{blue}{\left(a \cdot a\right)} + \left({a}^{4} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right) \]
      7. metadata-eval36.9%

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left(\color{blue}{{a}^{3} \cdot a} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right) \]
      9. associate-*r*36.9%

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left({a}^{3} \cdot a + \color{blue}{{a}^{3}} \cdot 4\right) \]
      11. distribute-lft-in100.0%

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

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left(a + 4\right) \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \]
      14. associate-*r*100.0%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \color{blue}{\left(\left(a + 4\right) \cdot a\right) \cdot \left(a \cdot a\right)} \]
      15. distribute-rgt-out100.0%

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(\left(2 \cdot {b}^{2} + 4\right) + \left(a + 4\right) \cdot a\right)} \]
    9. Simplified100.0%

      \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + \left(a + 4\right) \cdot a\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

    \[\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(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 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(a + 1\right) + \left(b \cdot b\right) \cdot \left(1 - a \cdot 3\right)\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + a \cdot \left(a + 4\right)\right)\\ \end{array} \]

Alternative 4: 98.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -8200000000000 \lor \neg \left(a \leq 0.46\right):\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + a \cdot \left(a + 4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left({b}^{4} + \left(b \cdot b\right) \cdot \left(4 + a \cdot -12\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (or (<= a -8200000000000.0) (not (<= a 0.46)))
   (* (* a a) (+ (fma 2.0 (* b b) 4.0) (* a (+ a 4.0))))
   (+ -1.0 (+ (pow b 4.0) (* (* b b) (+ 4.0 (* a -12.0)))))))
double code(double a, double b) {
	double tmp;
	if ((a <= -8200000000000.0) || !(a <= 0.46)) {
		tmp = (a * a) * (fma(2.0, (b * b), 4.0) + (a * (a + 4.0)));
	} else {
		tmp = -1.0 + (pow(b, 4.0) + ((b * b) * (4.0 + (a * -12.0))));
	}
	return tmp;
}
function code(a, b)
	tmp = 0.0
	if ((a <= -8200000000000.0) || !(a <= 0.46))
		tmp = Float64(Float64(a * a) * Float64(fma(2.0, Float64(b * b), 4.0) + Float64(a * Float64(a + 4.0))));
	else
		tmp = Float64(-1.0 + Float64((b ^ 4.0) + Float64(Float64(b * b) * Float64(4.0 + Float64(a * -12.0)))));
	end
	return tmp
end
code[a_, b_] := If[Or[LessEqual[a, -8200000000000.0], N[Not[LessEqual[a, 0.46]], $MachinePrecision]], N[(N[(a * a), $MachinePrecision] * N[(N[(2.0 * N[(b * b), $MachinePrecision] + 4.0), $MachinePrecision] + N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[(N[Power[b, 4.0], $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(4.0 + N[(a * -12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -8200000000000 \lor \neg \left(a \leq 0.46\right):\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + a \cdot \left(a + 4\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -8.2e12 or 0.46000000000000002 < a

    1. Initial program 43.3%

      \[\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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+43.3%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def43.3%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified47.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \cdot 4 \]
      4. associate-*r*61.4%

        \[\leadsto \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + \color{blue}{a \cdot \left(\left(a \cdot a\right) \cdot 4\right)} \]
      5. associate-+l+61.4%

        \[\leadsto \color{blue}{\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + \left({a}^{4} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right)} \]
      6. unpow261.4%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \color{blue}{\left(a \cdot a\right)} + \left({a}^{4} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right) \]
      7. metadata-eval61.4%

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left(\color{blue}{{a}^{3} \cdot a} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right) \]
      9. associate-*r*61.3%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left({a}^{3} \cdot a + \color{blue}{\left(a \cdot \left(a \cdot a\right)\right) \cdot 4}\right) \]
      10. cube-mult61.3%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left({a}^{3} \cdot a + \color{blue}{{a}^{3}} \cdot 4\right) \]
      11. distribute-lft-in97.0%

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

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left(a + 4\right) \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \]
      14. associate-*r*97.0%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \color{blue}{\left(\left(a + 4\right) \cdot a\right) \cdot \left(a \cdot a\right)} \]
      15. distribute-rgt-out97.0%

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(\left(2 \cdot {b}^{2} + 4\right) + \left(a + 4\right) \cdot a\right)} \]
    9. Simplified97.0%

      \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + \left(a + 4\right) \cdot a\right)} \]

    if -8.2e12 < a < 0.46000000000000002

    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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. sub-neg99.9%

        \[\leadsto \color{blue}{\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(1 - 3 \cdot a\right)\right)\right) + \left(-1\right)} \]
    3. Simplified99.9%

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

      \[\leadsto \color{blue}{\left(-12 \cdot \left(a \cdot {b}^{2}\right) + \left({b}^{4} + 4 \cdot {b}^{2}\right)\right)} + -1 \]
    5. Step-by-step derivation
      1. +-commutative88.6%

        \[\leadsto \color{blue}{\left(\left({b}^{4} + 4 \cdot {b}^{2}\right) + -12 \cdot \left(a \cdot {b}^{2}\right)\right)} + -1 \]
      2. associate-+l+88.6%

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

        \[\leadsto \left({b}^{4} + \left(\color{blue}{{b}^{2} \cdot 4} + -12 \cdot \left(a \cdot {b}^{2}\right)\right)\right) + -1 \]
      4. associate-*r*88.6%

        \[\leadsto \left({b}^{4} + \left({b}^{2} \cdot 4 + \color{blue}{\left(-12 \cdot a\right) \cdot {b}^{2}}\right)\right) + -1 \]
      5. *-commutative88.6%

        \[\leadsto \left({b}^{4} + \left({b}^{2} \cdot 4 + \color{blue}{{b}^{2} \cdot \left(-12 \cdot a\right)}\right)\right) + -1 \]
      6. distribute-lft-out98.5%

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

        \[\leadsto \left({b}^{4} + \color{blue}{\left(b \cdot b\right)} \cdot \left(4 + -12 \cdot a\right)\right) + -1 \]
    6. Simplified98.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -8200000000000 \lor \neg \left(a \leq 0.46\right):\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + a \cdot \left(a + 4\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + \left({b}^{4} + \left(b \cdot b\right) \cdot \left(4 + a \cdot -12\right)\right)\\ \end{array} \]

Alternative 5: 94.6% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.7 \cdot 10^{+17}:\\
\;\;\;\;{a}^{4}\\

\mathbf{elif}\;a \leq 0.8:\\
\;\;\;\;{b}^{4} + \left(-1 + \left(b \cdot b\right) \cdot 4\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -2.7e17

    1. Initial program 27.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+27.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def27.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified36.7%

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

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

    if -2.7e17 < a < 0.80000000000000004

    1. Initial program 99.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+99.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def99.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified99.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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in a around 0 88.9%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-12 \cdot \left(a \cdot {b}^{2}\right) + \left({b}^{4} + 4 \cdot {b}^{2}\right)\right) - 1} \]
    8. Step-by-step derivation
      1. +-commutative87.5%

        \[\leadsto \color{blue}{\left(\left({b}^{4} + 4 \cdot {b}^{2}\right) + -12 \cdot \left(a \cdot {b}^{2}\right)\right)} - 1 \]
      2. associate-+l+87.5%

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

        \[\leadsto \color{blue}{{b}^{4} + \left(\left(4 \cdot {b}^{2} + -12 \cdot \left(a \cdot {b}^{2}\right)\right) - 1\right)} \]
      4. associate-*r*87.5%

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

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

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

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(4 \cdot -3\right)} \cdot a\right) - 1\right) \]
      8. associate-*r*97.3%

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

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(-3 \cdot a\right) \cdot 4}\right) - 1\right) \]
      10. *-commutative97.3%

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(a \cdot -3\right)} \cdot 4\right) - 1\right) \]
      11. associate-*l*97.3%

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{a \cdot \left(-3 \cdot 4\right)}\right) - 1\right) \]
      12. metadata-eval97.3%

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

      \[\leadsto \color{blue}{{b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + a \cdot -12\right) - 1\right)} \]
    10. Taylor expanded in a around 0 97.9%

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

    if 0.80000000000000004 < a

    1. Initial program 58.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+58.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def58.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified58.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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in b around 0 91.4%

      \[\leadsto \color{blue}{\left({a}^{4} + 4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right)\right) - 1} \]
    5. Step-by-step derivation
      1. associate--l+91.4%

        \[\leadsto \color{blue}{{a}^{4} + \left(4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right) - 1\right)} \]
      2. associate-*r*91.4%

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

        \[\leadsto {a}^{4} + \left(\left(4 \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(1 + a\right) - 1\right) \]
    6. Simplified91.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -2.7 \cdot 10^{+17}:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;a \leq 0.8:\\ \;\;\;\;{b}^{4} + \left(-1 + \left(b \cdot b\right) \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;{a}^{4} + \left(-1 + \left(a + 1\right) \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right)\\ \end{array} \]

Alternative 6: 94.5% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.4 \cdot 10^{+20}:\\
\;\;\;\;{a}^{4}\\

\mathbf{elif}\;a \leq 0.85:\\
\;\;\;\;{b}^{4} + \left(-1 + \left(b \cdot b\right) \cdot 4\right)\\

\mathbf{else}:\\
\;\;\;\;{a}^{3} \cdot \left(a + 4\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -5.4e20

    1. Initial program 27.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+27.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def27.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified36.7%

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

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

    if -5.4e20 < a < 0.849999999999999978

    1. Initial program 99.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+99.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def99.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified99.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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in a around 0 88.9%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-12 \cdot \left(a \cdot {b}^{2}\right) + \left({b}^{4} + 4 \cdot {b}^{2}\right)\right) - 1} \]
    8. Step-by-step derivation
      1. +-commutative87.5%

        \[\leadsto \color{blue}{\left(\left({b}^{4} + 4 \cdot {b}^{2}\right) + -12 \cdot \left(a \cdot {b}^{2}\right)\right)} - 1 \]
      2. associate-+l+87.5%

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

        \[\leadsto \color{blue}{{b}^{4} + \left(\left(4 \cdot {b}^{2} + -12 \cdot \left(a \cdot {b}^{2}\right)\right) - 1\right)} \]
      4. associate-*r*87.5%

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

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

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

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(4 \cdot -3\right)} \cdot a\right) - 1\right) \]
      8. associate-*r*97.3%

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

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(-3 \cdot a\right) \cdot 4}\right) - 1\right) \]
      10. *-commutative97.3%

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(a \cdot -3\right)} \cdot 4\right) - 1\right) \]
      11. associate-*l*97.3%

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{a \cdot \left(-3 \cdot 4\right)}\right) - 1\right) \]
      12. metadata-eval97.3%

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

      \[\leadsto \color{blue}{{b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + a \cdot -12\right) - 1\right)} \]
    10. Taylor expanded in a around 0 97.9%

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

    if 0.849999999999999978 < a

    1. Initial program 58.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+58.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def58.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified58.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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in a around inf 90.0%

      \[\leadsto \color{blue}{4 \cdot {a}^{3} + {a}^{4}} \]
    5. Step-by-step derivation
      1. *-commutative90.0%

        \[\leadsto \color{blue}{{a}^{3} \cdot 4} + {a}^{4} \]
      2. metadata-eval90.0%

        \[\leadsto {a}^{3} \cdot 4 + {a}^{\color{blue}{\left(3 + 1\right)}} \]
      3. pow-plus89.9%

        \[\leadsto {a}^{3} \cdot 4 + \color{blue}{{a}^{3} \cdot a} \]
      4. distribute-lft-out90.0%

        \[\leadsto \color{blue}{{a}^{3} \cdot \left(4 + a\right)} \]
    6. Simplified90.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -5.4 \cdot 10^{+20}:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;a \leq 0.85:\\ \;\;\;\;{b}^{4} + \left(-1 + \left(b \cdot b\right) \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;{a}^{3} \cdot \left(a + 4\right)\\ \end{array} \]

Alternative 7: 81.5% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+50}:\\ \;\;\;\;-1 + a \cdot \left(a \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= (* b b) 2e+50) (+ -1.0 (* a (* a 4.0))) (pow b 4.0)))
double code(double a, double b) {
	double tmp;
	if ((b * b) <= 2e+50) {
		tmp = -1.0 + (a * (a * 4.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 * b) <= 2d+50) then
        tmp = (-1.0d0) + (a * (a * 4.0d0))
    else
        tmp = b ** 4.0d0
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if ((b * b) <= 2e+50) {
		tmp = -1.0 + (a * (a * 4.0));
	} else {
		tmp = Math.pow(b, 4.0);
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if (b * b) <= 2e+50:
		tmp = -1.0 + (a * (a * 4.0))
	else:
		tmp = math.pow(b, 4.0)
	return tmp
function code(a, b)
	tmp = 0.0
	if (Float64(b * b) <= 2e+50)
		tmp = Float64(-1.0 + Float64(a * Float64(a * 4.0)));
	else
		tmp = b ^ 4.0;
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if ((b * b) <= 2e+50)
		tmp = -1.0 + (a * (a * 4.0));
	else
		tmp = b ^ 4.0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 2e+50], N[(-1.0 + N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[b, 4.0], $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 b b) < 2.0000000000000002e50

    1. Initial program 84.6%

      \[\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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+84.6%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def84.6%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified84.6%

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

      \[\leadsto \color{blue}{\left({a}^{4} + 4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right)\right) - 1} \]
    5. Step-by-step derivation
      1. associate--l+83.4%

        \[\leadsto \color{blue}{{a}^{4} + \left(4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right) - 1\right)} \]
      2. associate-*r*83.4%

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

        \[\leadsto {a}^{4} + \left(\left(4 \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(1 + a\right) - 1\right) \]
    6. Simplified83.4%

      \[\leadsto \color{blue}{{a}^{4} + \left(\left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 + a\right) - 1\right)} \]
    7. Taylor expanded in a around 0 78.7%

      \[\leadsto \color{blue}{4 \cdot {a}^{2} - 1} \]
    8. Step-by-step derivation
      1. fma-neg78.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(4, {a}^{2}, -1\right)} \]
      2. unpow278.7%

        \[\leadsto \mathsf{fma}\left(4, \color{blue}{a \cdot a}, -1\right) \]
      3. metadata-eval78.7%

        \[\leadsto \mathsf{fma}\left(4, a \cdot a, \color{blue}{-1}\right) \]
    9. Simplified78.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(4, a \cdot a, -1\right)} \]
    10. Step-by-step derivation
      1. fma-udef78.7%

        \[\leadsto \color{blue}{4 \cdot \left(a \cdot a\right) + -1} \]
      2. *-commutative78.7%

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot 4} + -1 \]
      3. associate-*l*78.7%

        \[\leadsto \color{blue}{a \cdot \left(a \cdot 4\right)} + -1 \]
    11. Applied egg-rr78.7%

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

    if 2.0000000000000002e50 < (*.f64 b b)

    1. Initial program 62.6%

      \[\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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+62.6%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def62.6%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified66.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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in b around inf 95.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+50}:\\ \;\;\;\;-1 + a \cdot \left(a \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]

Alternative 8: 68.1% accurate, 7.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(a \cdot a\right) \cdot \left(a \cdot \left(a + 4\right)\right)\\ \mathbf{if}\;a \leq -4:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq -1.5 \cdot 10^{-226}:\\ \;\;\;\;-1\\ \mathbf{elif}\;a \leq -4.5 \cdot 10^{-266}:\\ \;\;\;\;a \cdot \left(\left(b \cdot b\right) \cdot -12\right)\\ \mathbf{elif}\;a \leq 0.0045:\\ \;\;\;\;-1 + a \cdot \left(a \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (let* ((t_0 (* (* a a) (* a (+ a 4.0)))))
   (if (<= a -4.0)
     t_0
     (if (<= a -1.5e-226)
       -1.0
       (if (<= a -4.5e-266)
         (* a (* (* b b) -12.0))
         (if (<= a 0.0045) (+ -1.0 (* a (* a 4.0))) t_0))))))
double code(double a, double b) {
	double t_0 = (a * a) * (a * (a + 4.0));
	double tmp;
	if (a <= -4.0) {
		tmp = t_0;
	} else if (a <= -1.5e-226) {
		tmp = -1.0;
	} else if (a <= -4.5e-266) {
		tmp = a * ((b * b) * -12.0);
	} else if (a <= 0.0045) {
		tmp = -1.0 + (a * (a * 4.0));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (a * a) * (a * (a + 4.0d0))
    if (a <= (-4.0d0)) then
        tmp = t_0
    else if (a <= (-1.5d-226)) then
        tmp = -1.0d0
    else if (a <= (-4.5d-266)) then
        tmp = a * ((b * b) * (-12.0d0))
    else if (a <= 0.0045d0) then
        tmp = (-1.0d0) + (a * (a * 4.0d0))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double t_0 = (a * a) * (a * (a + 4.0));
	double tmp;
	if (a <= -4.0) {
		tmp = t_0;
	} else if (a <= -1.5e-226) {
		tmp = -1.0;
	} else if (a <= -4.5e-266) {
		tmp = a * ((b * b) * -12.0);
	} else if (a <= 0.0045) {
		tmp = -1.0 + (a * (a * 4.0));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, b):
	t_0 = (a * a) * (a * (a + 4.0))
	tmp = 0
	if a <= -4.0:
		tmp = t_0
	elif a <= -1.5e-226:
		tmp = -1.0
	elif a <= -4.5e-266:
		tmp = a * ((b * b) * -12.0)
	elif a <= 0.0045:
		tmp = -1.0 + (a * (a * 4.0))
	else:
		tmp = t_0
	return tmp
function code(a, b)
	t_0 = Float64(Float64(a * a) * Float64(a * Float64(a + 4.0)))
	tmp = 0.0
	if (a <= -4.0)
		tmp = t_0;
	elseif (a <= -1.5e-226)
		tmp = -1.0;
	elseif (a <= -4.5e-266)
		tmp = Float64(a * Float64(Float64(b * b) * -12.0));
	elseif (a <= 0.0045)
		tmp = Float64(-1.0 + Float64(a * Float64(a * 4.0)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, b)
	t_0 = (a * a) * (a * (a + 4.0));
	tmp = 0.0;
	if (a <= -4.0)
		tmp = t_0;
	elseif (a <= -1.5e-226)
		tmp = -1.0;
	elseif (a <= -4.5e-266)
		tmp = a * ((b * b) * -12.0);
	elseif (a <= 0.0045)
		tmp = -1.0 + (a * (a * 4.0));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := Block[{t$95$0 = N[(N[(a * a), $MachinePrecision] * N[(a * N[(a + 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -4.0], t$95$0, If[LessEqual[a, -1.5e-226], -1.0, If[LessEqual[a, -4.5e-266], N[(a * N[(N[(b * b), $MachinePrecision] * -12.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 0.0045], N[(-1.0 + N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

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

\mathbf{elif}\;a \leq -1.5 \cdot 10^{-226}:\\
\;\;\;\;-1\\

\mathbf{elif}\;a \leq -4.5 \cdot 10^{-266}:\\
\;\;\;\;a \cdot \left(\left(b \cdot b\right) \cdot -12\right)\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -4 or 0.00449999999999999966 < a

    1. Initial program 44.3%

      \[\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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+44.3%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def44.3%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified48.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot {a}^{3} + \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right)} \]
    8. Step-by-step derivation
      1. +-commutative60.5%

        \[\leadsto \color{blue}{\left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + 4 \cdot {a}^{3}} \]
      2. *-commutative60.5%

        \[\leadsto \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + \color{blue}{{a}^{3} \cdot 4} \]
      3. cube-mult60.5%

        \[\leadsto \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \cdot 4 \]
      4. associate-*r*60.5%

        \[\leadsto \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + \color{blue}{a \cdot \left(\left(a \cdot a\right) \cdot 4\right)} \]
      5. associate-+l+60.5%

        \[\leadsto \color{blue}{\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + \left({a}^{4} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right)} \]
      6. unpow260.5%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \color{blue}{\left(a \cdot a\right)} + \left({a}^{4} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right) \]
      7. metadata-eval60.5%

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left(\color{blue}{{a}^{3} \cdot a} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right) \]
      9. associate-*r*60.4%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left({a}^{3} \cdot a + \color{blue}{\left(a \cdot \left(a \cdot a\right)\right) \cdot 4}\right) \]
      10. cube-mult60.4%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left({a}^{3} \cdot a + \color{blue}{{a}^{3}} \cdot 4\right) \]
      11. distribute-lft-in95.5%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \color{blue}{{a}^{3} \cdot \left(a + 4\right)} \]
      12. *-commutative95.5%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \color{blue}{\left(a + 4\right) \cdot {a}^{3}} \]
      13. cube-mult95.5%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left(a + 4\right) \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \]
      14. associate-*r*95.4%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \color{blue}{\left(\left(a + 4\right) \cdot a\right) \cdot \left(a \cdot a\right)} \]
      15. distribute-rgt-out95.4%

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(\left(2 \cdot {b}^{2} + 4\right) + \left(a + 4\right) \cdot a\right)} \]
    9. Simplified95.4%

      \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + \left(a + 4\right) \cdot a\right)} \]
    10. Taylor expanded in a around inf 88.8%

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

        \[\leadsto \left(a \cdot a\right) \cdot \left(4 \cdot a + \color{blue}{a \cdot a}\right) \]
      2. distribute-rgt-in89.6%

        \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(a \cdot \left(4 + a\right)\right)} \]
    12. Simplified89.6%

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

    if -4 < a < -1.49999999999999998e-226

    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(1 - 3 \cdot 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(1 - 3 \cdot 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(1 - 3 \cdot a\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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in b around 0 52.9%

      \[\leadsto \color{blue}{\left({a}^{4} + 4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right)\right) - 1} \]
    5. Step-by-step derivation
      1. associate--l+52.9%

        \[\leadsto \color{blue}{{a}^{4} + \left(4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right) - 1\right)} \]
      2. associate-*r*52.9%

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

        \[\leadsto {a}^{4} + \left(\left(4 \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(1 + a\right) - 1\right) \]
    6. Simplified52.9%

      \[\leadsto \color{blue}{{a}^{4} + \left(\left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 + a\right) - 1\right)} \]
    7. Taylor expanded in a around 0 51.5%

      \[\leadsto \color{blue}{-1} \]

    if -1.49999999999999998e-226 < a < -4.5000000000000003e-266

    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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+99.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def99.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified99.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-12 \cdot \left(a \cdot {b}^{2}\right) + \left({b}^{4} + 4 \cdot {b}^{2}\right)\right) - 1} \]
    8. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{\left(\left({b}^{4} + 4 \cdot {b}^{2}\right) + -12 \cdot \left(a \cdot {b}^{2}\right)\right)} - 1 \]
      2. associate-+l+100.0%

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

        \[\leadsto \color{blue}{{b}^{4} + \left(\left(4 \cdot {b}^{2} + -12 \cdot \left(a \cdot {b}^{2}\right)\right) - 1\right)} \]
      4. associate-*r*100.0%

        \[\leadsto {b}^{4} + \left(\left(4 \cdot {b}^{2} + \color{blue}{\left(-12 \cdot a\right) \cdot {b}^{2}}\right) - 1\right) \]
      5. distribute-rgt-out100.0%

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

        \[\leadsto {b}^{4} + \left(\color{blue}{\left(b \cdot b\right)} \cdot \left(4 + -12 \cdot a\right) - 1\right) \]
      7. metadata-eval100.0%

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(4 \cdot -3\right)} \cdot a\right) - 1\right) \]
      8. associate-*r*100.0%

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

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

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(a \cdot -3\right)} \cdot 4\right) - 1\right) \]
      11. associate-*l*100.0%

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

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + a \cdot \color{blue}{-12}\right) - 1\right) \]
    9. Simplified100.0%

      \[\leadsto \color{blue}{{b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + a \cdot -12\right) - 1\right)} \]
    10. Taylor expanded in a around inf 47.8%

      \[\leadsto \color{blue}{-12 \cdot \left(a \cdot {b}^{2}\right)} \]
    11. Step-by-step derivation
      1. *-commutative47.8%

        \[\leadsto \color{blue}{\left(a \cdot {b}^{2}\right) \cdot -12} \]
      2. associate-*l*47.8%

        \[\leadsto \color{blue}{a \cdot \left({b}^{2} \cdot -12\right)} \]
      3. *-commutative47.8%

        \[\leadsto a \cdot \color{blue}{\left(-12 \cdot {b}^{2}\right)} \]
      4. unpow247.8%

        \[\leadsto a \cdot \left(-12 \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
    12. Simplified47.8%

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

    if -4.5000000000000003e-266 < a < 0.00449999999999999966

    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(1 - 3 \cdot 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(1 - 3 \cdot 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(1 - 3 \cdot a\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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in b around 0 59.4%

      \[\leadsto \color{blue}{\left({a}^{4} + 4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right)\right) - 1} \]
    5. Step-by-step derivation
      1. associate--l+59.4%

        \[\leadsto \color{blue}{{a}^{4} + \left(4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right) - 1\right)} \]
      2. associate-*r*59.4%

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

        \[\leadsto {a}^{4} + \left(\left(4 \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(1 + a\right) - 1\right) \]
    6. Simplified59.4%

      \[\leadsto \color{blue}{{a}^{4} + \left(\left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 + a\right) - 1\right)} \]
    7. Taylor expanded in a around 0 58.8%

      \[\leadsto \color{blue}{4 \cdot {a}^{2} - 1} \]
    8. Step-by-step derivation
      1. fma-neg58.8%

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

        \[\leadsto \mathsf{fma}\left(4, \color{blue}{a \cdot a}, -1\right) \]
      3. metadata-eval58.8%

        \[\leadsto \mathsf{fma}\left(4, a \cdot a, \color{blue}{-1}\right) \]
    9. Simplified58.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(4, a \cdot a, -1\right)} \]
    10. Step-by-step derivation
      1. fma-udef58.8%

        \[\leadsto \color{blue}{4 \cdot \left(a \cdot a\right) + -1} \]
      2. *-commutative58.8%

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot 4} + -1 \]
      3. associate-*l*58.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -4:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot \left(a + 4\right)\right)\\ \mathbf{elif}\;a \leq -1.5 \cdot 10^{-226}:\\ \;\;\;\;-1\\ \mathbf{elif}\;a \leq -4.5 \cdot 10^{-266}:\\ \;\;\;\;a \cdot \left(\left(b \cdot b\right) \cdot -12\right)\\ \mathbf{elif}\;a \leq 0.0045:\\ \;\;\;\;-1 + a \cdot \left(a \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot \left(a + 4\right)\right)\\ \end{array} \]

Alternative 9: 52.4% accurate, 8.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot \left(a \cdot 4\right)\\ t_1 := a \cdot \left(\left(b \cdot b\right) \cdot -12\right)\\ \mathbf{if}\;a \leq -6.5 \cdot 10^{+153}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq -7.6 \cdot 10^{-50}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -7 \cdot 10^{-227}:\\ \;\;\;\;-1\\ \mathbf{elif}\;a \leq -3.4 \cdot 10^{-266}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 0.0045:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (let* ((t_0 (* a (* a 4.0))) (t_1 (* a (* (* b b) -12.0))))
   (if (<= a -6.5e+153)
     t_0
     (if (<= a -7.6e-50)
       t_1
       (if (<= a -7e-227)
         -1.0
         (if (<= a -3.4e-266) t_1 (if (<= a 0.0045) -1.0 t_0)))))))
double code(double a, double b) {
	double t_0 = a * (a * 4.0);
	double t_1 = a * ((b * b) * -12.0);
	double tmp;
	if (a <= -6.5e+153) {
		tmp = t_0;
	} else if (a <= -7.6e-50) {
		tmp = t_1;
	} else if (a <= -7e-227) {
		tmp = -1.0;
	} else if (a <= -3.4e-266) {
		tmp = t_1;
	} else if (a <= 0.0045) {
		tmp = -1.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = a * (a * 4.0d0)
    t_1 = a * ((b * b) * (-12.0d0))
    if (a <= (-6.5d+153)) then
        tmp = t_0
    else if (a <= (-7.6d-50)) then
        tmp = t_1
    else if (a <= (-7d-227)) then
        tmp = -1.0d0
    else if (a <= (-3.4d-266)) then
        tmp = t_1
    else if (a <= 0.0045d0) then
        tmp = -1.0d0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double t_0 = a * (a * 4.0);
	double t_1 = a * ((b * b) * -12.0);
	double tmp;
	if (a <= -6.5e+153) {
		tmp = t_0;
	} else if (a <= -7.6e-50) {
		tmp = t_1;
	} else if (a <= -7e-227) {
		tmp = -1.0;
	} else if (a <= -3.4e-266) {
		tmp = t_1;
	} else if (a <= 0.0045) {
		tmp = -1.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, b):
	t_0 = a * (a * 4.0)
	t_1 = a * ((b * b) * -12.0)
	tmp = 0
	if a <= -6.5e+153:
		tmp = t_0
	elif a <= -7.6e-50:
		tmp = t_1
	elif a <= -7e-227:
		tmp = -1.0
	elif a <= -3.4e-266:
		tmp = t_1
	elif a <= 0.0045:
		tmp = -1.0
	else:
		tmp = t_0
	return tmp
function code(a, b)
	t_0 = Float64(a * Float64(a * 4.0))
	t_1 = Float64(a * Float64(Float64(b * b) * -12.0))
	tmp = 0.0
	if (a <= -6.5e+153)
		tmp = t_0;
	elseif (a <= -7.6e-50)
		tmp = t_1;
	elseif (a <= -7e-227)
		tmp = -1.0;
	elseif (a <= -3.4e-266)
		tmp = t_1;
	elseif (a <= 0.0045)
		tmp = -1.0;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, b)
	t_0 = a * (a * 4.0);
	t_1 = a * ((b * b) * -12.0);
	tmp = 0.0;
	if (a <= -6.5e+153)
		tmp = t_0;
	elseif (a <= -7.6e-50)
		tmp = t_1;
	elseif (a <= -7e-227)
		tmp = -1.0;
	elseif (a <= -3.4e-266)
		tmp = t_1;
	elseif (a <= 0.0045)
		tmp = -1.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a * N[(N[(b * b), $MachinePrecision] * -12.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -6.5e+153], t$95$0, If[LessEqual[a, -7.6e-50], t$95$1, If[LessEqual[a, -7e-227], -1.0, If[LessEqual[a, -3.4e-266], t$95$1, If[LessEqual[a, 0.0045], -1.0, t$95$0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot 4\right)\\
t_1 := a \cdot \left(\left(b \cdot b\right) \cdot -12\right)\\
\mathbf{if}\;a \leq -6.5 \cdot 10^{+153}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;a \leq -7.6 \cdot 10^{-50}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq -7 \cdot 10^{-227}:\\
\;\;\;\;-1\\

\mathbf{elif}\;a \leq -3.4 \cdot 10^{-266}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq 0.0045:\\
\;\;\;\;-1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -6.49999999999999972e153 or 0.00449999999999999966 < a

    1. Initial program 37.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+37.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def37.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified37.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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in b around 0 56.5%

      \[\leadsto \color{blue}{\left({a}^{4} + 4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right)\right) - 1} \]
    5. Step-by-step derivation
      1. associate--l+56.5%

        \[\leadsto \color{blue}{{a}^{4} + \left(4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right) - 1\right)} \]
      2. associate-*r*56.5%

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

        \[\leadsto {a}^{4} + \left(\left(4 \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(1 + a\right) - 1\right) \]
    6. Simplified56.5%

      \[\leadsto \color{blue}{{a}^{4} + \left(\left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 + a\right) - 1\right)} \]
    7. Taylor expanded in a around 0 75.7%

      \[\leadsto \color{blue}{4 \cdot {a}^{2} - 1} \]
    8. Step-by-step derivation
      1. fma-neg75.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(4, {a}^{2}, -1\right)} \]
      2. unpow275.7%

        \[\leadsto \mathsf{fma}\left(4, \color{blue}{a \cdot a}, -1\right) \]
      3. metadata-eval75.7%

        \[\leadsto \mathsf{fma}\left(4, a \cdot a, \color{blue}{-1}\right) \]
    9. Simplified75.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(4, a \cdot a, -1\right)} \]
    10. Taylor expanded in a around inf 75.8%

      \[\leadsto \color{blue}{4 \cdot {a}^{2}} \]
    11. Step-by-step derivation
      1. *-commutative75.8%

        \[\leadsto \color{blue}{{a}^{2} \cdot 4} \]
      2. unpow275.8%

        \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot 4 \]
      3. associate-*r*75.8%

        \[\leadsto \color{blue}{a \cdot \left(a \cdot 4\right)} \]
    12. Simplified75.8%

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

    if -6.49999999999999972e153 < a < -7.5999999999999998e-50 or -7.0000000000000002e-227 < a < -3.39999999999999995e-266

    1. Initial program 81.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+81.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def81.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified91.7%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-12 \cdot \left(a \cdot {b}^{2}\right) + \left({b}^{4} + 4 \cdot {b}^{2}\right)\right) - 1} \]
    8. Step-by-step derivation
      1. +-commutative63.3%

        \[\leadsto \color{blue}{\left(\left({b}^{4} + 4 \cdot {b}^{2}\right) + -12 \cdot \left(a \cdot {b}^{2}\right)\right)} - 1 \]
      2. associate-+l+63.3%

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

        \[\leadsto \color{blue}{{b}^{4} + \left(\left(4 \cdot {b}^{2} + -12 \cdot \left(a \cdot {b}^{2}\right)\right) - 1\right)} \]
      4. associate-*r*63.3%

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

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

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

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(4 \cdot -3\right)} \cdot a\right) - 1\right) \]
      8. associate-*r*63.3%

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

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(-3 \cdot a\right) \cdot 4}\right) - 1\right) \]
      10. *-commutative63.3%

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(a \cdot -3\right)} \cdot 4\right) - 1\right) \]
      11. associate-*l*63.3%

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{a \cdot \left(-3 \cdot 4\right)}\right) - 1\right) \]
      12. metadata-eval63.3%

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

      \[\leadsto \color{blue}{{b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + a \cdot -12\right) - 1\right)} \]
    10. Taylor expanded in a around inf 36.4%

      \[\leadsto \color{blue}{-12 \cdot \left(a \cdot {b}^{2}\right)} \]
    11. Step-by-step derivation
      1. *-commutative36.4%

        \[\leadsto \color{blue}{\left(a \cdot {b}^{2}\right) \cdot -12} \]
      2. associate-*l*36.4%

        \[\leadsto \color{blue}{a \cdot \left({b}^{2} \cdot -12\right)} \]
      3. *-commutative36.4%

        \[\leadsto a \cdot \color{blue}{\left(-12 \cdot {b}^{2}\right)} \]
      4. unpow236.4%

        \[\leadsto a \cdot \left(-12 \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
    12. Simplified36.4%

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

    if -7.5999999999999998e-50 < a < -7.0000000000000002e-227 or -3.39999999999999995e-266 < a < 0.00449999999999999966

    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(1 - 3 \cdot 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(1 - 3 \cdot 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(1 - 3 \cdot a\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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in b around 0 59.2%

      \[\leadsto \color{blue}{\left({a}^{4} + 4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right)\right) - 1} \]
    5. Step-by-step derivation
      1. associate--l+59.2%

        \[\leadsto \color{blue}{{a}^{4} + \left(4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right) - 1\right)} \]
      2. associate-*r*59.2%

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

        \[\leadsto {a}^{4} + \left(\left(4 \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(1 + a\right) - 1\right) \]
    6. Simplified59.2%

      \[\leadsto \color{blue}{{a}^{4} + \left(\left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 + a\right) - 1\right)} \]
    7. Taylor expanded in a around 0 58.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -6.5 \cdot 10^{+153}:\\ \;\;\;\;a \cdot \left(a \cdot 4\right)\\ \mathbf{elif}\;a \leq -7.6 \cdot 10^{-50}:\\ \;\;\;\;a \cdot \left(\left(b \cdot b\right) \cdot -12\right)\\ \mathbf{elif}\;a \leq -7 \cdot 10^{-227}:\\ \;\;\;\;-1\\ \mathbf{elif}\;a \leq -3.4 \cdot 10^{-266}:\\ \;\;\;\;a \cdot \left(\left(b \cdot b\right) \cdot -12\right)\\ \mathbf{elif}\;a \leq 0.0045:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(a \cdot 4\right)\\ \end{array} \]

Alternative 10: 52.3% accurate, 8.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot \left(a \cdot 4\right)\\ \mathbf{if}\;a \leq -6.6 \cdot 10^{+153}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq -7.6 \cdot 10^{-50}:\\ \;\;\;\;b \cdot \left(-12 \cdot \left(a \cdot b\right)\right)\\ \mathbf{elif}\;a \leq -1.45 \cdot 10^{-226}:\\ \;\;\;\;-1\\ \mathbf{elif}\;a \leq -2.6 \cdot 10^{-266}:\\ \;\;\;\;a \cdot \left(\left(b \cdot b\right) \cdot -12\right)\\ \mathbf{elif}\;a \leq 0.0045:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (let* ((t_0 (* a (* a 4.0))))
   (if (<= a -6.6e+153)
     t_0
     (if (<= a -7.6e-50)
       (* b (* -12.0 (* a b)))
       (if (<= a -1.45e-226)
         -1.0
         (if (<= a -2.6e-266)
           (* a (* (* b b) -12.0))
           (if (<= a 0.0045) -1.0 t_0)))))))
double code(double a, double b) {
	double t_0 = a * (a * 4.0);
	double tmp;
	if (a <= -6.6e+153) {
		tmp = t_0;
	} else if (a <= -7.6e-50) {
		tmp = b * (-12.0 * (a * b));
	} else if (a <= -1.45e-226) {
		tmp = -1.0;
	} else if (a <= -2.6e-266) {
		tmp = a * ((b * b) * -12.0);
	} else if (a <= 0.0045) {
		tmp = -1.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: t_0
    real(8) :: tmp
    t_0 = a * (a * 4.0d0)
    if (a <= (-6.6d+153)) then
        tmp = t_0
    else if (a <= (-7.6d-50)) then
        tmp = b * ((-12.0d0) * (a * b))
    else if (a <= (-1.45d-226)) then
        tmp = -1.0d0
    else if (a <= (-2.6d-266)) then
        tmp = a * ((b * b) * (-12.0d0))
    else if (a <= 0.0045d0) then
        tmp = -1.0d0
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double t_0 = a * (a * 4.0);
	double tmp;
	if (a <= -6.6e+153) {
		tmp = t_0;
	} else if (a <= -7.6e-50) {
		tmp = b * (-12.0 * (a * b));
	} else if (a <= -1.45e-226) {
		tmp = -1.0;
	} else if (a <= -2.6e-266) {
		tmp = a * ((b * b) * -12.0);
	} else if (a <= 0.0045) {
		tmp = -1.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, b):
	t_0 = a * (a * 4.0)
	tmp = 0
	if a <= -6.6e+153:
		tmp = t_0
	elif a <= -7.6e-50:
		tmp = b * (-12.0 * (a * b))
	elif a <= -1.45e-226:
		tmp = -1.0
	elif a <= -2.6e-266:
		tmp = a * ((b * b) * -12.0)
	elif a <= 0.0045:
		tmp = -1.0
	else:
		tmp = t_0
	return tmp
function code(a, b)
	t_0 = Float64(a * Float64(a * 4.0))
	tmp = 0.0
	if (a <= -6.6e+153)
		tmp = t_0;
	elseif (a <= -7.6e-50)
		tmp = Float64(b * Float64(-12.0 * Float64(a * b)));
	elseif (a <= -1.45e-226)
		tmp = -1.0;
	elseif (a <= -2.6e-266)
		tmp = Float64(a * Float64(Float64(b * b) * -12.0));
	elseif (a <= 0.0045)
		tmp = -1.0;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, b)
	t_0 = a * (a * 4.0);
	tmp = 0.0;
	if (a <= -6.6e+153)
		tmp = t_0;
	elseif (a <= -7.6e-50)
		tmp = b * (-12.0 * (a * b));
	elseif (a <= -1.45e-226)
		tmp = -1.0;
	elseif (a <= -2.6e-266)
		tmp = a * ((b * b) * -12.0);
	elseif (a <= 0.0045)
		tmp = -1.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -6.6e+153], t$95$0, If[LessEqual[a, -7.6e-50], N[(b * N[(-12.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -1.45e-226], -1.0, If[LessEqual[a, -2.6e-266], N[(a * N[(N[(b * b), $MachinePrecision] * -12.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 0.0045], -1.0, t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot 4\right)\\
\mathbf{if}\;a \leq -6.6 \cdot 10^{+153}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;a \leq -7.6 \cdot 10^{-50}:\\
\;\;\;\;b \cdot \left(-12 \cdot \left(a \cdot b\right)\right)\\

\mathbf{elif}\;a \leq -1.45 \cdot 10^{-226}:\\
\;\;\;\;-1\\

\mathbf{elif}\;a \leq -2.6 \cdot 10^{-266}:\\
\;\;\;\;a \cdot \left(\left(b \cdot b\right) \cdot -12\right)\\

\mathbf{elif}\;a \leq 0.0045:\\
\;\;\;\;-1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -6.59999999999999989e153 or 0.00449999999999999966 < a

    1. Initial program 37.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+37.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def37.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified37.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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in b around 0 56.5%

      \[\leadsto \color{blue}{\left({a}^{4} + 4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right)\right) - 1} \]
    5. Step-by-step derivation
      1. associate--l+56.5%

        \[\leadsto \color{blue}{{a}^{4} + \left(4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right) - 1\right)} \]
      2. associate-*r*56.5%

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

        \[\leadsto {a}^{4} + \left(\left(4 \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(1 + a\right) - 1\right) \]
    6. Simplified56.5%

      \[\leadsto \color{blue}{{a}^{4} + \left(\left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 + a\right) - 1\right)} \]
    7. Taylor expanded in a around 0 75.7%

      \[\leadsto \color{blue}{4 \cdot {a}^{2} - 1} \]
    8. Step-by-step derivation
      1. fma-neg75.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(4, {a}^{2}, -1\right)} \]
      2. unpow275.7%

        \[\leadsto \mathsf{fma}\left(4, \color{blue}{a \cdot a}, -1\right) \]
      3. metadata-eval75.7%

        \[\leadsto \mathsf{fma}\left(4, a \cdot a, \color{blue}{-1}\right) \]
    9. Simplified75.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(4, a \cdot a, -1\right)} \]
    10. Taylor expanded in a around inf 75.8%

      \[\leadsto \color{blue}{4 \cdot {a}^{2}} \]
    11. Step-by-step derivation
      1. *-commutative75.8%

        \[\leadsto \color{blue}{{a}^{2} \cdot 4} \]
      2. unpow275.8%

        \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot 4 \]
      3. associate-*r*75.8%

        \[\leadsto \color{blue}{a \cdot \left(a \cdot 4\right)} \]
    12. Simplified75.8%

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

    if -6.59999999999999989e153 < a < -7.5999999999999998e-50

    1. Initial program 75.3%

      \[\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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+75.3%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def75.3%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified88.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\left({b}^{4} + 4 \cdot {b}^{2}\right) + -12 \cdot \left(a \cdot {b}^{2}\right)\right)} - 1 \]
      2. associate-+l+50.4%

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

        \[\leadsto \color{blue}{{b}^{4} + \left(\left(4 \cdot {b}^{2} + -12 \cdot \left(a \cdot {b}^{2}\right)\right) - 1\right)} \]
      4. associate-*r*50.4%

        \[\leadsto {b}^{4} + \left(\left(4 \cdot {b}^{2} + \color{blue}{\left(-12 \cdot a\right) \cdot {b}^{2}}\right) - 1\right) \]
      5. distribute-rgt-out50.4%

        \[\leadsto {b}^{4} + \left(\color{blue}{{b}^{2} \cdot \left(4 + -12 \cdot a\right)} - 1\right) \]
      6. unpow250.4%

        \[\leadsto {b}^{4} + \left(\color{blue}{\left(b \cdot b\right)} \cdot \left(4 + -12 \cdot a\right) - 1\right) \]
      7. metadata-eval50.4%

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(4 \cdot -3\right)} \cdot a\right) - 1\right) \]
      8. associate-*r*50.4%

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

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(-3 \cdot a\right) \cdot 4}\right) - 1\right) \]
      10. *-commutative50.4%

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(a \cdot -3\right)} \cdot 4\right) - 1\right) \]
      11. associate-*l*50.4%

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{a \cdot \left(-3 \cdot 4\right)}\right) - 1\right) \]
      12. metadata-eval50.4%

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + a \cdot \color{blue}{-12}\right) - 1\right) \]
    9. Simplified50.4%

      \[\leadsto \color{blue}{{b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + a \cdot -12\right) - 1\right)} \]
    10. Taylor expanded in a around inf 32.4%

      \[\leadsto \color{blue}{-12 \cdot \left(a \cdot {b}^{2}\right)} \]
    11. Step-by-step derivation
      1. associate-*r*32.4%

        \[\leadsto \color{blue}{\left(-12 \cdot a\right) \cdot {b}^{2}} \]
      2. *-commutative32.4%

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

        \[\leadsto \left(a \cdot -12\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
      4. associate-*r*32.4%

        \[\leadsto \color{blue}{\left(\left(a \cdot -12\right) \cdot b\right) \cdot b} \]
    12. Simplified32.4%

      \[\leadsto \color{blue}{\left(\left(a \cdot -12\right) \cdot b\right) \cdot b} \]
    13. Taylor expanded in a around 0 32.4%

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

    if -7.5999999999999998e-50 < a < -1.45000000000000001e-226 or -2.6e-266 < a < 0.00449999999999999966

    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(1 - 3 \cdot 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(1 - 3 \cdot 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(1 - 3 \cdot a\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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in b around 0 59.2%

      \[\leadsto \color{blue}{\left({a}^{4} + 4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right)\right) - 1} \]
    5. Step-by-step derivation
      1. associate--l+59.2%

        \[\leadsto \color{blue}{{a}^{4} + \left(4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right) - 1\right)} \]
      2. associate-*r*59.2%

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

        \[\leadsto {a}^{4} + \left(\left(4 \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(1 + a\right) - 1\right) \]
    6. Simplified59.2%

      \[\leadsto \color{blue}{{a}^{4} + \left(\left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 + a\right) - 1\right)} \]
    7. Taylor expanded in a around 0 58.5%

      \[\leadsto \color{blue}{-1} \]

    if -1.45000000000000001e-226 < a < -2.6e-266

    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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+99.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def99.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified99.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-12 \cdot \left(a \cdot {b}^{2}\right) + \left({b}^{4} + 4 \cdot {b}^{2}\right)\right) - 1} \]
    8. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \color{blue}{\left(\left({b}^{4} + 4 \cdot {b}^{2}\right) + -12 \cdot \left(a \cdot {b}^{2}\right)\right)} - 1 \]
      2. associate-+l+100.0%

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

        \[\leadsto \color{blue}{{b}^{4} + \left(\left(4 \cdot {b}^{2} + -12 \cdot \left(a \cdot {b}^{2}\right)\right) - 1\right)} \]
      4. associate-*r*100.0%

        \[\leadsto {b}^{4} + \left(\left(4 \cdot {b}^{2} + \color{blue}{\left(-12 \cdot a\right) \cdot {b}^{2}}\right) - 1\right) \]
      5. distribute-rgt-out100.0%

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

        \[\leadsto {b}^{4} + \left(\color{blue}{\left(b \cdot b\right)} \cdot \left(4 + -12 \cdot a\right) - 1\right) \]
      7. metadata-eval100.0%

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(4 \cdot -3\right)} \cdot a\right) - 1\right) \]
      8. associate-*r*100.0%

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

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

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(a \cdot -3\right)} \cdot 4\right) - 1\right) \]
      11. associate-*l*100.0%

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

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + a \cdot \color{blue}{-12}\right) - 1\right) \]
    9. Simplified100.0%

      \[\leadsto \color{blue}{{b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + a \cdot -12\right) - 1\right)} \]
    10. Taylor expanded in a around inf 47.8%

      \[\leadsto \color{blue}{-12 \cdot \left(a \cdot {b}^{2}\right)} \]
    11. Step-by-step derivation
      1. *-commutative47.8%

        \[\leadsto \color{blue}{\left(a \cdot {b}^{2}\right) \cdot -12} \]
      2. associate-*l*47.8%

        \[\leadsto \color{blue}{a \cdot \left({b}^{2} \cdot -12\right)} \]
      3. *-commutative47.8%

        \[\leadsto a \cdot \color{blue}{\left(-12 \cdot {b}^{2}\right)} \]
      4. unpow247.8%

        \[\leadsto a \cdot \left(-12 \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
    12. Simplified47.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -6.6 \cdot 10^{+153}:\\ \;\;\;\;a \cdot \left(a \cdot 4\right)\\ \mathbf{elif}\;a \leq -7.6 \cdot 10^{-50}:\\ \;\;\;\;b \cdot \left(-12 \cdot \left(a \cdot b\right)\right)\\ \mathbf{elif}\;a \leq -1.45 \cdot 10^{-226}:\\ \;\;\;\;-1\\ \mathbf{elif}\;a \leq -2.6 \cdot 10^{-266}:\\ \;\;\;\;a \cdot \left(\left(b \cdot b\right) \cdot -12\right)\\ \mathbf{elif}\;a \leq 0.0045:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(a \cdot 4\right)\\ \end{array} \]

Alternative 11: 66.5% accurate, 10.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 b b) < 5.00000000000000024e-5

    1. Initial program 86.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+86.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def86.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified86.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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in b around 0 86.3%

      \[\leadsto \color{blue}{\left({a}^{4} + 4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right)\right) - 1} \]
    5. Step-by-step derivation
      1. associate--l+86.3%

        \[\leadsto \color{blue}{{a}^{4} + \left(4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right) - 1\right)} \]
      2. associate-*r*86.3%

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

        \[\leadsto {a}^{4} + \left(\left(4 \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(1 + a\right) - 1\right) \]
    6. Simplified86.3%

      \[\leadsto \color{blue}{{a}^{4} + \left(\left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 + a\right) - 1\right)} \]
    7. Taylor expanded in a around 0 79.1%

      \[\leadsto \color{blue}{4 \cdot {a}^{2} - 1} \]
    8. Step-by-step derivation
      1. fma-neg79.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(4, {a}^{2}, -1\right)} \]
      2. unpow279.1%

        \[\leadsto \mathsf{fma}\left(4, \color{blue}{a \cdot a}, -1\right) \]
      3. metadata-eval79.1%

        \[\leadsto \mathsf{fma}\left(4, a \cdot a, \color{blue}{-1}\right) \]
    9. Simplified79.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(4, a \cdot a, -1\right)} \]
    10. Step-by-step derivation
      1. fma-udef79.1%

        \[\leadsto \color{blue}{4 \cdot \left(a \cdot a\right) + -1} \]
      2. *-commutative79.1%

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot 4} + -1 \]
      3. associate-*l*79.1%

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

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

    if 5.00000000000000024e-5 < (*.f64 b b)

    1. Initial program 62.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+62.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def62.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified66.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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in a around 0 54.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot {a}^{3} + \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right)} \]
    8. Step-by-step derivation
      1. +-commutative43.0%

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

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

        \[\leadsto \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \cdot 4 \]
      4. associate-*r*43.0%

        \[\leadsto \left(\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + {a}^{4}\right) + \color{blue}{a \cdot \left(\left(a \cdot a\right) \cdot 4\right)} \]
      5. associate-+l+43.0%

        \[\leadsto \color{blue}{\left(2 \cdot {b}^{2} + 4\right) \cdot {a}^{2} + \left({a}^{4} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right)} \]
      6. unpow243.0%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \color{blue}{\left(a \cdot a\right)} + \left({a}^{4} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right) \]
      7. metadata-eval43.0%

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left(\color{blue}{{a}^{3} \cdot a} + a \cdot \left(\left(a \cdot a\right) \cdot 4\right)\right) \]
      9. associate-*r*43.0%

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

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left({a}^{3} \cdot a + \color{blue}{{a}^{3}} \cdot 4\right) \]
      11. distribute-lft-in61.6%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \color{blue}{{a}^{3} \cdot \left(a + 4\right)} \]
      12. *-commutative61.6%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \color{blue}{\left(a + 4\right) \cdot {a}^{3}} \]
      13. cube-mult61.6%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \left(a + 4\right) \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} \]
      14. associate-*r*61.6%

        \[\leadsto \left(2 \cdot {b}^{2} + 4\right) \cdot \left(a \cdot a\right) + \color{blue}{\left(\left(a + 4\right) \cdot a\right) \cdot \left(a \cdot a\right)} \]
      15. distribute-rgt-out61.6%

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(\left(2 \cdot {b}^{2} + 4\right) + \left(a + 4\right) \cdot a\right)} \]
    9. Simplified61.6%

      \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(\mathsf{fma}\left(2, b \cdot b, 4\right) + \left(a + 4\right) \cdot a\right)} \]
    10. Taylor expanded in b around inf 60.8%

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

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

        \[\leadsto 2 \cdot \left(\left(a \cdot a\right) \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
      3. associate-*r*60.8%

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

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

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

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

Alternative 12: 50.6% accurate, 14.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -2.4 \lor \neg \left(a \leq 0.0045\right):\\ \;\;\;\;a \cdot \left(a \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (or (<= a -2.4) (not (<= a 0.0045))) (* a (* a 4.0)) -1.0))
double code(double a, double b) {
	double tmp;
	if ((a <= -2.4) || !(a <= 0.0045)) {
		tmp = a * (a * 4.0);
	} else {
		tmp = -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 <= (-2.4d0)) .or. (.not. (a <= 0.0045d0))) then
        tmp = a * (a * 4.0d0)
    else
        tmp = -1.0d0
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double tmp;
	if ((a <= -2.4) || !(a <= 0.0045)) {
		tmp = a * (a * 4.0);
	} else {
		tmp = -1.0;
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if (a <= -2.4) or not (a <= 0.0045):
		tmp = a * (a * 4.0)
	else:
		tmp = -1.0
	return tmp
function code(a, b)
	tmp = 0.0
	if ((a <= -2.4) || !(a <= 0.0045))
		tmp = Float64(a * Float64(a * 4.0));
	else
		tmp = -1.0;
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if ((a <= -2.4) || ~((a <= 0.0045)))
		tmp = a * (a * 4.0);
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[Or[LessEqual[a, -2.4], N[Not[LessEqual[a, 0.0045]], $MachinePrecision]], N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision], -1.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \lor \neg \left(a \leq 0.0045\right):\\
\;\;\;\;a \cdot \left(a \cdot 4\right)\\

\mathbf{else}:\\
\;\;\;\;-1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.39999999999999991 or 0.00449999999999999966 < a

    1. Initial program 44.3%

      \[\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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+44.3%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def44.3%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified48.6%

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

      \[\leadsto \color{blue}{\left({a}^{4} + 4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right)\right) - 1} \]
    5. Step-by-step derivation
      1. associate--l+55.3%

        \[\leadsto \color{blue}{{a}^{4} + \left(4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right) - 1\right)} \]
      2. associate-*r*55.3%

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

        \[\leadsto {a}^{4} + \left(\left(4 \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(1 + a\right) - 1\right) \]
    6. Simplified55.3%

      \[\leadsto \color{blue}{{a}^{4} + \left(\left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 + a\right) - 1\right)} \]
    7. Taylor expanded in a around 0 59.1%

      \[\leadsto \color{blue}{4 \cdot {a}^{2} - 1} \]
    8. Step-by-step derivation
      1. fma-neg59.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(4, {a}^{2}, -1\right)} \]
      2. unpow259.1%

        \[\leadsto \mathsf{fma}\left(4, \color{blue}{a \cdot a}, -1\right) \]
      3. metadata-eval59.1%

        \[\leadsto \mathsf{fma}\left(4, a \cdot a, \color{blue}{-1}\right) \]
    9. Simplified59.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(4, a \cdot a, -1\right)} \]
    10. Taylor expanded in a around inf 59.2%

      \[\leadsto \color{blue}{4 \cdot {a}^{2}} \]
    11. Step-by-step derivation
      1. *-commutative59.2%

        \[\leadsto \color{blue}{{a}^{2} \cdot 4} \]
      2. unpow259.2%

        \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot 4 \]
      3. associate-*r*59.2%

        \[\leadsto \color{blue}{a \cdot \left(a \cdot 4\right)} \]
    12. Simplified59.2%

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

    if -2.39999999999999991 < a < 0.00449999999999999966

    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(1 - 3 \cdot 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(1 - 3 \cdot 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(1 - 3 \cdot a\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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in b around 0 52.8%

      \[\leadsto \color{blue}{\left({a}^{4} + 4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right)\right) - 1} \]
    5. Step-by-step derivation
      1. associate--l+52.8%

        \[\leadsto \color{blue}{{a}^{4} + \left(4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right) - 1\right)} \]
      2. associate-*r*52.8%

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

        \[\leadsto {a}^{4} + \left(\left(4 \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(1 + a\right) - 1\right) \]
    6. Simplified52.8%

      \[\leadsto \color{blue}{{a}^{4} + \left(\left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 + a\right) - 1\right)} \]
    7. Taylor expanded in a around 0 51.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -2.4 \lor \neg \left(a \leq 0.0045\right):\\ \;\;\;\;a \cdot \left(a \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]

Alternative 13: 53.1% accurate, 14.3× speedup?

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

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

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


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

    1. Initial program 76.5%

      \[\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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+76.5%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def76.5%

        \[\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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified78.8%

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

      \[\leadsto \color{blue}{\left({a}^{4} + 4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right)\right) - 1} \]
    5. Step-by-step derivation
      1. associate--l+60.1%

        \[\leadsto \color{blue}{{a}^{4} + \left(4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right) - 1\right)} \]
      2. associate-*r*60.1%

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

        \[\leadsto {a}^{4} + \left(\left(4 \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(1 + a\right) - 1\right) \]
    6. Simplified60.1%

      \[\leadsto \color{blue}{{a}^{4} + \left(\left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 + a\right) - 1\right)} \]
    7. Taylor expanded in a around 0 58.7%

      \[\leadsto \color{blue}{4 \cdot {a}^{2} - 1} \]
    8. Step-by-step derivation
      1. fma-neg58.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(4, {a}^{2}, -1\right)} \]
      2. unpow258.7%

        \[\leadsto \mathsf{fma}\left(4, \color{blue}{a \cdot a}, -1\right) \]
      3. metadata-eval58.7%

        \[\leadsto \mathsf{fma}\left(4, a \cdot a, \color{blue}{-1}\right) \]
    9. Simplified58.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(4, a \cdot a, -1\right)} \]
    10. Step-by-step derivation
      1. fma-udef58.7%

        \[\leadsto \color{blue}{4 \cdot \left(a \cdot a\right) + -1} \]
      2. *-commutative58.7%

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot 4} + -1 \]
      3. associate-*l*58.7%

        \[\leadsto \color{blue}{a \cdot \left(a \cdot 4\right)} + -1 \]
    11. Applied egg-rr58.7%

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

    if 9.19999999999999951e117 < b

    1. Initial program 63.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(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. associate--l+63.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(1 - 3 \cdot a\right)\right) - 1\right)} \]
      2. fma-def63.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(1 - 3 \cdot a\right)\right) - 1\right) \]
    3. Simplified63.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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
    4. Taylor expanded in a around 0 44.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\left({b}^{4} + 4 \cdot {b}^{2}\right) + -12 \cdot \left(a \cdot {b}^{2}\right)\right)} - 1 \]
      2. associate-+l+65.8%

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

        \[\leadsto \color{blue}{{b}^{4} + \left(\left(4 \cdot {b}^{2} + -12 \cdot \left(a \cdot {b}^{2}\right)\right) - 1\right)} \]
      4. associate-*r*65.8%

        \[\leadsto {b}^{4} + \left(\left(4 \cdot {b}^{2} + \color{blue}{\left(-12 \cdot a\right) \cdot {b}^{2}}\right) - 1\right) \]
      5. distribute-rgt-out84.2%

        \[\leadsto {b}^{4} + \left(\color{blue}{{b}^{2} \cdot \left(4 + -12 \cdot a\right)} - 1\right) \]
      6. unpow284.2%

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

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(4 \cdot -3\right)} \cdot a\right) - 1\right) \]
      8. associate-*r*84.2%

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

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

        \[\leadsto {b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + \color{blue}{\left(a \cdot -3\right)} \cdot 4\right) - 1\right) \]
      11. associate-*l*84.2%

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

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

      \[\leadsto \color{blue}{{b}^{4} + \left(\left(b \cdot b\right) \cdot \left(4 + a \cdot -12\right) - 1\right)} \]
    10. Taylor expanded in a around inf 55.4%

      \[\leadsto \color{blue}{-12 \cdot \left(a \cdot {b}^{2}\right)} \]
    11. Step-by-step derivation
      1. *-commutative55.4%

        \[\leadsto \color{blue}{\left(a \cdot {b}^{2}\right) \cdot -12} \]
      2. associate-*l*55.4%

        \[\leadsto \color{blue}{a \cdot \left({b}^{2} \cdot -12\right)} \]
      3. *-commutative55.4%

        \[\leadsto a \cdot \color{blue}{\left(-12 \cdot {b}^{2}\right)} \]
      4. unpow255.4%

        \[\leadsto a \cdot \left(-12 \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
    12. Simplified55.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 9.2 \cdot 10^{+117}:\\ \;\;\;\;-1 + a \cdot \left(a \cdot 4\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(\left(b \cdot b\right) \cdot -12\right)\\ \end{array} \]

Alternative 14: 24.6% accurate, 130.0× speedup?

\[\begin{array}{l} \\ -1 \end{array} \]
(FPCore (a b) :precision binary64 -1.0)
double code(double a, double b) {
	return -1.0;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = -1.0d0
end function
public static double code(double a, double b) {
	return -1.0;
}
def code(a, b):
	return -1.0
function code(a, b)
	return -1.0
end
function tmp = code(a, b)
	tmp = -1.0;
end
code[a_, b_] := -1.0
\begin{array}{l}

\\
-1
\end{array}
Derivation
  1. Initial program 74.5%

    \[\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(1 - 3 \cdot a\right)\right)\right) - 1 \]
  2. Step-by-step derivation
    1. associate--l+74.5%

      \[\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(1 - 3 \cdot a\right)\right) - 1\right)} \]
    2. fma-def74.5%

      \[\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(1 - 3 \cdot a\right)\right) - 1\right) \]
  3. Simplified76.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, a + 1, \left(b \cdot b\right) \cdot \left(1 + -3 \cdot a\right)\right) - 1\right)} \]
  4. Taylor expanded in b around 0 53.9%

    \[\leadsto \color{blue}{\left({a}^{4} + 4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right)\right) - 1} \]
  5. Step-by-step derivation
    1. associate--l+53.9%

      \[\leadsto \color{blue}{{a}^{4} + \left(4 \cdot \left({a}^{2} \cdot \left(1 + a\right)\right) - 1\right)} \]
    2. associate-*r*53.9%

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

      \[\leadsto {a}^{4} + \left(\left(4 \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(1 + a\right) - 1\right) \]
  6. Simplified53.9%

    \[\leadsto \color{blue}{{a}^{4} + \left(\left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 + a\right) - 1\right)} \]
  7. Taylor expanded in a around 0 28.4%

    \[\leadsto \color{blue}{-1} \]
  8. Final simplification28.4%

    \[\leadsto -1 \]

Reproduce

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