Bouland and Aaronson, Equation (24)

Percentage Accurate: 74.3% → 98.5%
Time: 7.6s
Alternatives: 9
Speedup: 6.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 74.3% accurate, 1.0× speedup?

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

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

Alternative 1: 98.5% accurate, 1.1× speedup?

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

\\
\left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) + {a}^{4}\right) + -1
\end{array}
Derivation
  1. Initial program 75.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(3 + a\right)\right)\right) - 1 \]
  2. Step-by-step derivation
    1. sub-neg75.6%

      \[\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(3 + a\right)\right)\right) + \left(-1\right)} \]
    2. sqr-pow75.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(\left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b\right)} + {a}^{4}\right) + -1 \]
  13. Final simplification98.7%

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

Alternative 2: 93.8% accurate, 1.1× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -8.6e20 or 3.8000000000000001e59 < a

    1. Initial program 43.0%

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

        \[\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(3 + a\right)\right)\right) + \left(-1\right)} \]
      2. sqr-pow43.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{a}^{4}} + -1 \]
    5. Step-by-step derivation
      1. metadata-eval97.8%

        \[\leadsto {a}^{\color{blue}{\left(2 \cdot 2\right)}} + -1 \]
      2. pow-sqr97.7%

        \[\leadsto \color{blue}{{a}^{2} \cdot {a}^{2}} + -1 \]
      3. pow-prod-down97.7%

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

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + -1 \]
      5. difference-of-sqr--197.7%

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

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

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

    if -8.6e20 < a < 3.8000000000000001e59

    1. Initial program 99.8%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. 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(3 + a\right)\right)\right) + \left(-1\right)} \]
      2. sqr-pow99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 93.3% accurate, 1.2× speedup?

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

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

\mathbf{elif}\;a \leq 1.05 \cdot 10^{+61}:\\
\;\;\;\;-1 + {b}^{4}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.21999999999999996e24 or 1.0500000000000001e61 < a

    1. Initial program 43.0%

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

        \[\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(3 + a\right)\right)\right) + \left(-1\right)} \]
      2. sqr-pow43.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{a}^{4}} + -1 \]
    5. Step-by-step derivation
      1. metadata-eval97.8%

        \[\leadsto {a}^{\color{blue}{\left(2 \cdot 2\right)}} + -1 \]
      2. pow-sqr97.7%

        \[\leadsto \color{blue}{{a}^{2} \cdot {a}^{2}} + -1 \]
      3. pow-prod-down97.7%

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

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + -1 \]
      5. difference-of-sqr--197.7%

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

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

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

    if -1.21999999999999996e24 < a < 1.0500000000000001e61

    1. Initial program 99.8%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. 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(3 + a\right)\right)\right) + \left(-1\right)} \]
      2. sqr-pow99.8%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.22 \cdot 10^{+24}:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;a \leq 1.05 \cdot 10^{+61}:\\ \;\;\;\;-1 + {b}^{4}\\ \mathbf{else}:\\ \;\;\;\;{a}^{4}\\ \end{array} \]

Alternative 4: 78.9% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \cdot b \leq 7.3 \cdot 10^{+115}:\\
\;\;\;\;{a}^{4} + -1\\

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


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

    1. Initial program 81.9%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. sub-neg81.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(3 + a\right)\right)\right) + \left(-1\right)} \]
      2. sqr-pow81.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{a}^{4}} + -1 \]

    if 7.29999999999999968e115 < (*.f64 b b)

    1. Initial program 65.9%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. sub-neg65.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(3 + a\right)\right)\right) + \left(-1\right)} \]
      2. sqr-pow65.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 78.9% accurate, 6.1× speedup?

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

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

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


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

    1. Initial program 81.9%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. sub-neg81.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(3 + a\right)\right)\right) + \left(-1\right)} \]
      2. sqr-pow81.9%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{a}^{4}} + -1 \]
    5. Step-by-step derivation
      1. metadata-eval89.4%

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

        \[\leadsto \color{blue}{{a}^{2} \cdot {a}^{2}} + -1 \]
      3. pow-prod-down89.3%

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

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + -1 \]
      5. difference-of-sqr--189.4%

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

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

    if 3.49999999999999997e116 < (*.f64 b b)

    1. Initial program 65.9%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. sub-neg65.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(3 + a\right)\right)\right) + \left(-1\right)} \]
      2. sqr-pow65.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 68.8% accurate, 9.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.65 \cdot 10^{-5} \lor \neg \left(a \leq 5.1\right):\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(-1 + a \cdot a\right)\\

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


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

    1. Initial program 50.7%

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

        \[\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(3 + a\right)\right)\right) + \left(-1\right)} \]
      2. sqr-pow50.7%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{a}^{4}} + -1 \]
    5. Step-by-step derivation
      1. metadata-eval88.1%

        \[\leadsto {a}^{\color{blue}{\left(2 \cdot 2\right)}} + -1 \]
      2. pow-sqr88.0%

        \[\leadsto \color{blue}{{a}^{2} \cdot {a}^{2}} + -1 \]
      3. pow-prod-down88.0%

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

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + -1 \]
      5. difference-of-sqr--188.0%

        \[\leadsto \color{blue}{\left(a \cdot a + 1\right) \cdot \left(a \cdot a - 1\right)} \]
    6. Applied egg-rr88.0%

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

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

        \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot \left(a \cdot a - 1\right) \]
    9. Simplified88.0%

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

    if -1.6500000000000001e-5 < a < 5.0999999999999996

    1. Initial program 99.8%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. 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(3 + a\right)\right)\right) + \left(-1\right)} \]
      2. sqr-pow99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 68.8% accurate, 11.6× speedup?

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

\\
\left(a \cdot a + 1\right) \cdot \left(-1 + a \cdot a\right)
\end{array}
Derivation
  1. Initial program 75.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(3 + a\right)\right)\right) - 1 \]
  2. Step-by-step derivation
    1. sub-neg75.6%

      \[\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(3 + a\right)\right)\right) + \left(-1\right)} \]
    2. sqr-pow75.7%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{a}^{4}} + -1 \]
  5. Step-by-step derivation
    1. metadata-eval69.7%

      \[\leadsto {a}^{\color{blue}{\left(2 \cdot 2\right)}} + -1 \]
    2. pow-sqr69.7%

      \[\leadsto \color{blue}{{a}^{2} \cdot {a}^{2}} + -1 \]
    3. pow-prod-down69.6%

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

      \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + -1 \]
    5. difference-of-sqr--169.7%

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

    \[\leadsto \color{blue}{\left(a \cdot a + 1\right) \cdot \left(a \cdot a - 1\right)} \]
  7. Final simplification69.7%

    \[\leadsto \left(a \cdot a + 1\right) \cdot \left(-1 + a \cdot a\right) \]

Alternative 8: 50.9% accurate, 18.3× speedup?

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

\\
-1 + 4 \cdot \left(a \cdot a\right)
\end{array}
Derivation
  1. Initial program 75.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(3 + a\right)\right)\right) - 1 \]
  2. Step-by-step derivation
    1. sub-neg75.6%

      \[\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(3 + a\right)\right)\right) + \left(-1\right)} \]
    2. sqr-pow75.7%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left({\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + 4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) + -1} \]
  4. Taylor expanded in b around 0 54.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. unpow254.5%

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

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

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

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

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

    \[\leadsto \color{blue}{4 \cdot \left(a \cdot a\right)} + -1 \]
  10. Final simplification51.5%

    \[\leadsto -1 + 4 \cdot \left(a \cdot a\right) \]

Alternative 9: 25.1% accurate, 128.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 75.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(3 + a\right)\right)\right) - 1 \]
  2. Step-by-step derivation
    1. sub-neg75.6%

      \[\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(3 + a\right)\right)\right) + \left(-1\right)} \]
    2. sqr-pow75.7%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{a}^{4}} + -1 \]
  5. Taylor expanded in a around 0 26.7%

    \[\leadsto \color{blue}{-1} \]
  6. Final simplification26.7%

    \[\leadsto -1 \]

Reproduce

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