Bouland and Aaronson, Equation (24)

Percentage Accurate: 73.1% → 98.3%
Time: 8.7s
Alternatives: 12
Speedup: 8.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 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.1% accurate, 1.0× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4}\\


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

    1. Initial program 99.9%

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

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

      \[\leadsto \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(4, \mathsf{fma}\left(b \cdot b, a + 3, a \cdot a\right) - {a}^{3}, -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 3 a)))))

    1. Initial program 0.0%

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def3.4%

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

        \[\leadsto \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 \color{blue}{\left(a + 3\right)}\right)\right) + \left(-1\right) \]
      5. metadata-eval3.4%

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified3.4%

      \[\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 98.4%

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

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

Alternative 2: 98.3% accurate, 0.5× speedup?

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

\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4}\\


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

    1. Initial program 99.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 \]

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

    1. Initial program 0.0%

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def3.4%

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

        \[\leadsto \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 \color{blue}{\left(a + 3\right)}\right)\right) + \left(-1\right) \]
      5. metadata-eval3.4%

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified3.4%

      \[\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 98.4%

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

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

Alternative 3: 94.1% accurate, 1.1× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4}\\


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

    1. Initial program 64.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(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. sub-neg64.5%

        \[\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. fma-def64.5%

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def64.5%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified64.5%

      \[\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 96.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-*r*96.1%

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

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

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

    if -0.0028500000000000001 < a < 4.49999999999999998e55

    1. Initial program 99.9%

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def99.9%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified99.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 0 84.7%

      \[\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+84.7%

        \[\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*84.7%

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

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

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

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

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

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

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

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

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

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

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

    if 4.49999999999999998e55 < a

    1. Initial program 22.2%

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

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def25.9%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified25.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 100.0%

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

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

Alternative 4: 93.9% accurate, 1.1× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4}\\


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

    1. Initial program 64.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(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. sub-neg64.5%

        \[\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. fma-def64.5%

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def64.5%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified64.5%

      \[\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 96.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-*r*96.1%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{a}^{8} - {\left(\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)}^{2}}{{a}^{4} - \color{blue}{\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)}} + -1 \]
    8. Applied egg-rr8.5%

      \[\leadsto \color{blue}{\frac{{a}^{8} - {\left(\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)}^{2}}{{a}^{4} - \left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)}} + -1 \]
    9. Step-by-step derivation
      1. associate-*r*8.5%

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

        \[\leadsto \frac{{a}^{8} - {\left(\left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)\right)}^{2}}{{a}^{4} - \left(1 - a\right) \cdot \color{blue}{\left(\left(4 \cdot a\right) \cdot a\right)}} + -1 \]
    10. Simplified8.5%

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

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

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

        \[\leadsto \frac{{a}^{8} - \color{blue}{\left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(\left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)\right)\right)}}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
      4. *-commutative8.5%

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

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

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

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

        \[\leadsto \frac{{a}^{8} - \left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \color{blue}{\left(4 \cdot \left({a}^{\left(\frac{4}{2}\right)} \cdot \left(1 - a\right)\right)\right)}\right)}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
      9. metadata-eval8.5%

        \[\leadsto \frac{{a}^{8} - \left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(4 \cdot \left({a}^{\color{blue}{2}} \cdot \left(1 - a\right)\right)\right)\right)}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
      10. pow28.5%

        \[\leadsto \frac{{a}^{8} - \left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(4 \cdot \left(\color{blue}{\left(a \cdot a\right)} \cdot \left(1 - a\right)\right)\right)\right)}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
    12. Applied egg-rr8.5%

      \[\leadsto \frac{{a}^{8} - \color{blue}{\left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right)\right)\right)}}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
    13. Taylor expanded in a around inf 94.6%

      \[\leadsto \color{blue}{\left(-4 \cdot {a}^{3} + {a}^{4}\right)} + -1 \]
    14. Step-by-step derivation
      1. *-commutative94.6%

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

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

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

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

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

    if -0.0189999999999999995 < a < 9.4999999999999999e54

    1. Initial program 99.9%

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def99.9%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified99.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 0 84.7%

      \[\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+84.7%

        \[\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*84.7%

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

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

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

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

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

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

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

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

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

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

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

    if 9.4999999999999999e54 < a

    1. Initial program 22.2%

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

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def25.9%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified25.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 100.0%

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

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

Alternative 5: 93.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -0.019:\\ \;\;\;\;-1 + {a}^{3} \cdot \left(a + -4\right)\\ \mathbf{elif}\;a \leq 5.1 \cdot 10^{+54}:\\ \;\;\;\;-1 + b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 12\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + {a}^{4}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= a -0.019)
   (+ -1.0 (* (pow a 3.0) (+ a -4.0)))
   (if (<= a 5.1e+54)
     (+ -1.0 (* b (* b (fma b b 12.0))))
     (+ -1.0 (pow a 4.0)))))
double code(double a, double b) {
	double tmp;
	if (a <= -0.019) {
		tmp = -1.0 + (pow(a, 3.0) * (a + -4.0));
	} else if (a <= 5.1e+54) {
		tmp = -1.0 + (b * (b * fma(b, b, 12.0)));
	} else {
		tmp = -1.0 + pow(a, 4.0);
	}
	return tmp;
}
function code(a, b)
	tmp = 0.0
	if (a <= -0.019)
		tmp = Float64(-1.0 + Float64((a ^ 3.0) * Float64(a + -4.0)));
	elseif (a <= 5.1e+54)
		tmp = Float64(-1.0 + Float64(b * Float64(b * fma(b, b, 12.0))));
	else
		tmp = Float64(-1.0 + (a ^ 4.0));
	end
	return tmp
end
code[a_, b_] := If[LessEqual[a, -0.019], N[(-1.0 + N[(N[Power[a, 3.0], $MachinePrecision] * N[(a + -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.1e+54], N[(-1.0 + N[(b * N[(b * N[(b * b + 12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;a \leq 5.1 \cdot 10^{+54}:\\
\;\;\;\;-1 + b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 12\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4}\\


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

    1. Initial program 64.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(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. sub-neg64.5%

        \[\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. fma-def64.5%

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def64.5%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified64.5%

      \[\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 96.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-*r*96.1%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{a}^{8} - {\left(\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)}^{2}}{{a}^{4} - \color{blue}{\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)}} + -1 \]
    8. Applied egg-rr8.5%

      \[\leadsto \color{blue}{\frac{{a}^{8} - {\left(\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)}^{2}}{{a}^{4} - \left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)}} + -1 \]
    9. Step-by-step derivation
      1. associate-*r*8.5%

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

        \[\leadsto \frac{{a}^{8} - {\left(\left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)\right)}^{2}}{{a}^{4} - \left(1 - a\right) \cdot \color{blue}{\left(\left(4 \cdot a\right) \cdot a\right)}} + -1 \]
    10. Simplified8.5%

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

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

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

        \[\leadsto \frac{{a}^{8} - \color{blue}{\left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(\left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)\right)\right)}}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
      4. *-commutative8.5%

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

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

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

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

        \[\leadsto \frac{{a}^{8} - \left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \color{blue}{\left(4 \cdot \left({a}^{\left(\frac{4}{2}\right)} \cdot \left(1 - a\right)\right)\right)}\right)}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
      9. metadata-eval8.5%

        \[\leadsto \frac{{a}^{8} - \left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(4 \cdot \left({a}^{\color{blue}{2}} \cdot \left(1 - a\right)\right)\right)\right)}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
      10. pow28.5%

        \[\leadsto \frac{{a}^{8} - \left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(4 \cdot \left(\color{blue}{\left(a \cdot a\right)} \cdot \left(1 - a\right)\right)\right)\right)}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
    12. Applied egg-rr8.5%

      \[\leadsto \frac{{a}^{8} - \color{blue}{\left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right)\right)\right)}}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
    13. Taylor expanded in a around inf 94.6%

      \[\leadsto \color{blue}{\left(-4 \cdot {a}^{3} + {a}^{4}\right)} + -1 \]
    14. Step-by-step derivation
      1. *-commutative94.6%

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

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

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

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

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

    if -0.0189999999999999995 < a < 5.10000000000000009e54

    1. Initial program 99.9%

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def99.9%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified99.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 0 84.7%

      \[\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+84.7%

        \[\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*84.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(12 \cdot \left(b \cdot b\right) + {b}^{\color{blue}{\left(2 \cdot 2\right)}}\right) + -1 \]
      3. pow-sqr95.7%

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

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

        \[\leadsto \left(12 \cdot \left(b \cdot b\right) + \left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b\right)}\right) + -1 \]
      6. distribute-rgt-in95.7%

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(12 + b \cdot b\right)} + -1 \]
      7. associate-*l*95.7%

        \[\leadsto \color{blue}{b \cdot \left(b \cdot \left(12 + b \cdot b\right)\right)} + -1 \]
      8. +-commutative95.7%

        \[\leadsto b \cdot \left(b \cdot \color{blue}{\left(b \cdot b + 12\right)}\right) + -1 \]
      9. fma-def95.7%

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

      \[\leadsto \color{blue}{b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 12\right)\right)} + -1 \]

    if 5.10000000000000009e54 < a

    1. Initial program 22.2%

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

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def25.9%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified25.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 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -0.019:\\ \;\;\;\;-1 + {a}^{3} \cdot \left(a + -4\right)\\ \mathbf{elif}\;a \leq 5.1 \cdot 10^{+54}:\\ \;\;\;\;-1 + b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 12\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1 + {a}^{4}\\ \end{array} \]

Alternative 6: 93.9% accurate, 1.2× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;-1 + {a}^{4}\\


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

    1. Initial program 64.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(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. sub-neg64.5%

        \[\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. fma-def64.5%

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def64.5%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified64.5%

      \[\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 96.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-*r*96.1%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{a}^{8} - {\left(\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)}^{2}}{{a}^{4} - \color{blue}{\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)}} + -1 \]
    8. Applied egg-rr8.5%

      \[\leadsto \color{blue}{\frac{{a}^{8} - {\left(\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)}^{2}}{{a}^{4} - \left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)}} + -1 \]
    9. Step-by-step derivation
      1. associate-*r*8.5%

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

        \[\leadsto \frac{{a}^{8} - {\left(\left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)\right)}^{2}}{{a}^{4} - \left(1 - a\right) \cdot \color{blue}{\left(\left(4 \cdot a\right) \cdot a\right)}} + -1 \]
    10. Simplified8.5%

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

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

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

        \[\leadsto \frac{{a}^{8} - \color{blue}{\left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(\left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)\right)\right)}}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
      4. *-commutative8.5%

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

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

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

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

        \[\leadsto \frac{{a}^{8} - \left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \color{blue}{\left(4 \cdot \left({a}^{\left(\frac{4}{2}\right)} \cdot \left(1 - a\right)\right)\right)}\right)}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
      9. metadata-eval8.5%

        \[\leadsto \frac{{a}^{8} - \left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(4 \cdot \left({a}^{\color{blue}{2}} \cdot \left(1 - a\right)\right)\right)\right)}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
      10. pow28.5%

        \[\leadsto \frac{{a}^{8} - \left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(4 \cdot \left(\color{blue}{\left(a \cdot a\right)} \cdot \left(1 - a\right)\right)\right)\right)}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
    12. Applied egg-rr8.5%

      \[\leadsto \frac{{a}^{8} - \color{blue}{\left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right)\right)\right)\right)}}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
    13. Taylor expanded in a around inf 94.6%

      \[\leadsto \color{blue}{\left(-4 \cdot {a}^{3} + {a}^{4}\right)} + -1 \]
    14. Step-by-step derivation
      1. *-commutative94.6%

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

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

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

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

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

    if -0.0189999999999999995 < a < 1.8000000000000001e54

    1. Initial program 99.9%

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def99.9%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified99.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 0 84.7%

      \[\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+84.7%

        \[\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*84.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{12 \cdot \left(b \cdot b\right)} + {b}^{4}\right) + -1 \]
    10. Step-by-step derivation
      1. +-commutative95.7%

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

        \[\leadsto \left({b}^{\color{blue}{\left(2 \cdot 2\right)}} + 12 \cdot \left(b \cdot b\right)\right) + -1 \]
      3. pow-sqr95.7%

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

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

        \[\leadsto \left(\color{blue}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + 12 \cdot \left(b \cdot b\right)\right) + -1 \]
      6. distribute-rgt-out95.7%

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(b \cdot b + 12\right)} + -1 \]
    11. Applied egg-rr95.7%

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

    if 1.8000000000000001e54 < a

    1. Initial program 22.2%

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

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def25.9%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified25.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 100.0%

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

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

Alternative 7: 93.7% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.019 \lor \neg \left(a \leq 3.95 \cdot 10^{+62}\right):\\
\;\;\;\;-1 + {a}^{4}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -0.0189999999999999995 or 3.9499999999999998e62 < a

    1. Initial program 42.1%

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

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def44.1%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified44.1%

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

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

    if -0.0189999999999999995 < a < 3.9499999999999998e62

    1. Initial program 99.9%

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def99.9%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified99.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 0 84.7%

      \[\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+84.7%

        \[\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*84.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{12 \cdot \left(b \cdot b\right)} + {b}^{4}\right) + -1 \]
    10. Step-by-step derivation
      1. +-commutative95.7%

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

        \[\leadsto \left({b}^{\color{blue}{\left(2 \cdot 2\right)}} + 12 \cdot \left(b \cdot b\right)\right) + -1 \]
      3. pow-sqr95.7%

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

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

        \[\leadsto \left(\color{blue}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + 12 \cdot \left(b \cdot b\right)\right) + -1 \]
      6. distribute-rgt-out95.7%

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(b \cdot b + 12\right)} + -1 \]
    11. Applied egg-rr95.7%

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

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

Alternative 8: 86.7% accurate, 8.5× speedup?

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

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

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

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


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

    1. Initial program 60.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-neg60.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. fma-def60.9%

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def60.9%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified60.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 100.0%

      \[\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-*r*100.0%

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

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

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

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

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

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

        \[\leadsto \frac{{a}^{8} - \color{blue}{{\left(\left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 - a\right)\right)}^{2}}}{{a}^{4} - \left(4 \cdot \left(a \cdot a\right)\right) \cdot \left(1 - a\right)} + -1 \]
      5. *-commutative0.0%

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

        \[\leadsto \frac{{a}^{8} - {\left(\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)}^{2}}{{a}^{4} - \color{blue}{\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)}} + -1 \]
    8. Applied egg-rr0.0%

      \[\leadsto \color{blue}{\frac{{a}^{8} - {\left(\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)}^{2}}{{a}^{4} - \left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)}} + -1 \]
    9. Step-by-step derivation
      1. associate-*r*0.0%

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

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

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

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

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

        \[\leadsto \frac{{a}^{8} - \color{blue}{\left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(\left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)\right)\right)}}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
      4. *-commutative0.0%

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

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

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

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

        \[\leadsto \frac{{a}^{8} - \left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \color{blue}{\left(4 \cdot \left({a}^{\left(\frac{4}{2}\right)} \cdot \left(1 - a\right)\right)\right)}\right)}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
      9. metadata-eval0.0%

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

        \[\leadsto \frac{{a}^{8} - \left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(4 \cdot \left(\color{blue}{\left(a \cdot a\right)} \cdot \left(1 - a\right)\right)\right)\right)}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
    12. Applied egg-rr0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{a \cdot \left(a \cdot 4 + \left(-a \cdot \left(a \cdot 4\right)\right)\right)} + -1 \]
      13. *-lft-identity86.5%

        \[\leadsto a \cdot \left(\color{blue}{1 \cdot \left(a \cdot 4\right)} + \left(-a \cdot \left(a \cdot 4\right)\right)\right) + -1 \]
      14. distribute-lft-neg-in86.5%

        \[\leadsto a \cdot \left(1 \cdot \left(a \cdot 4\right) + \color{blue}{\left(-a\right) \cdot \left(a \cdot 4\right)}\right) + -1 \]
      15. distribute-rgt-in86.5%

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

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

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

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

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

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

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

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

    if -6.9999999999999995e57 < a < 5.80000000000000004e153

    1. Initial program 94.4%

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

        \[\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. fma-def94.4%

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def95.5%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified95.5%

      \[\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 76.0%

      \[\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+76.0%

        \[\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*76.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{{\left(b \cdot b\right)}^{2}} + 12 \cdot \left(b \cdot b\right)\right) + -1 \]
      5. pow285.8%

        \[\leadsto \left(\color{blue}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)} + 12 \cdot \left(b \cdot b\right)\right) + -1 \]
      6. distribute-rgt-out85.8%

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(b \cdot b + 12\right)} + -1 \]
    11. Applied egg-rr85.8%

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

    if 5.80000000000000004e153 < a

    1. Initial program 0.0%

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def0.0%

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

        \[\leadsto \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 \color{blue}{\left(a + 3\right)}\right)\right) + \left(-1\right) \]
      5. metadata-eval0.0%

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified0.0%

      \[\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 0.0%

      \[\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-*r*0.0%

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

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

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

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

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

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

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

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

Alternative 9: 71.6% accurate, 9.8× speedup?

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

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

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

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


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

    1. Initial program 62.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-neg62.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. fma-def62.7%

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def62.7%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified62.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 b around 0 97.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-*r*97.8%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{a}^{8} - {\left(\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)}^{2}}{{a}^{4} - \color{blue}{\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)}} + -1 \]
    8. Applied egg-rr0.1%

      \[\leadsto \color{blue}{\frac{{a}^{8} - {\left(\left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)\right)}^{2}}{{a}^{4} - \left(1 - a\right) \cdot \left(4 \cdot \left(a \cdot a\right)\right)}} + -1 \]
    9. Step-by-step derivation
      1. associate-*r*0.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{{a}^{8} - \left(\left(1 - a\right) \cdot \left(4 \cdot a\right)\right) \cdot \left(a \cdot \left(4 \cdot \left(\color{blue}{\left(a \cdot a\right)} \cdot \left(1 - a\right)\right)\right)\right)}{{a}^{4} - \left(1 - a\right) \cdot \left(\left(4 \cdot a\right) \cdot a\right)} + -1 \]
    12. Applied egg-rr0.1%

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

      \[\leadsto \color{blue}{\left(4 \cdot {a}^{2} + -4 \cdot {a}^{3}\right)} + -1 \]
    14. Step-by-step derivation
      1. *-commutative82.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot \left(a \cdot 4\right) + a \cdot \left(-\color{blue}{a \cdot \left(a \cdot 4\right)}\right)\right) + -1 \]
      12. distribute-lft-out82.7%

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

        \[\leadsto a \cdot \left(\color{blue}{1 \cdot \left(a \cdot 4\right)} + \left(-a \cdot \left(a \cdot 4\right)\right)\right) + -1 \]
      14. distribute-lft-neg-in82.7%

        \[\leadsto a \cdot \left(1 \cdot \left(a \cdot 4\right) + \color{blue}{\left(-a\right) \cdot \left(a \cdot 4\right)}\right) + -1 \]
      15. distribute-rgt-in82.7%

        \[\leadsto a \cdot \color{blue}{\left(\left(a \cdot 4\right) \cdot \left(1 + \left(-a\right)\right)\right)} + -1 \]
      16. sub-neg82.7%

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

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

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

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

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

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

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

    if -9.5000000000000003e40 < a < 6.49999999999999972e153

    1. Initial program 94.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(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. sub-neg94.3%

        \[\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. fma-def94.3%

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def95.4%

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

        \[\leadsto \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 \color{blue}{\left(a + 3\right)}\right)\right) + \left(-1\right) \]
      5. metadata-eval95.4%

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified95.4%

      \[\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 76.2%

      \[\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+76.2%

        \[\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*76.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(12 \cdot \left(b \cdot b\right) + {b}^{\color{blue}{\left(2 \cdot 2\right)}}\right) + -1 \]
      3. pow-sqr86.1%

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

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

        \[\leadsto \left(12 \cdot \left(b \cdot b\right) + \left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b\right)}\right) + -1 \]
      6. distribute-rgt-in86.1%

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(12 + b \cdot b\right)} + -1 \]
      7. associate-*l*86.1%

        \[\leadsto \color{blue}{b \cdot \left(b \cdot \left(12 + b \cdot b\right)\right)} + -1 \]
      8. +-commutative86.1%

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

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

      \[\leadsto \color{blue}{b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 12\right)\right)} + -1 \]
    13. Taylor expanded in b around 0 60.8%

      \[\leadsto \color{blue}{12 \cdot {b}^{2}} + -1 \]
    14. Step-by-step derivation
      1. unpow260.8%

        \[\leadsto 12 \cdot \color{blue}{\left(b \cdot b\right)} + -1 \]
    15. Simplified60.8%

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

    if 6.49999999999999972e153 < a

    1. Initial program 0.0%

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

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def0.0%

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

        \[\leadsto \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 \color{blue}{\left(a + 3\right)}\right)\right) + \left(-1\right) \]
      5. metadata-eval0.0%

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified0.0%

      \[\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 0.0%

      \[\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-*r*0.0%

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

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

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

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

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

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

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

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

Alternative 10: 69.4% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 80.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-neg80.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. fma-def80.7%

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def80.7%

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

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

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified80.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 b around 0 61.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-*r*61.2%

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

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

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

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

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

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

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

    if 2e295 < (*.f64 b b)

    1. Initial program 62.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(3 + a\right)\right)\right) - 1 \]
    2. Step-by-step derivation
      1. sub-neg62.3%

        \[\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. fma-def62.3%

        \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
      3. fma-def66.0%

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

        \[\leadsto \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 \color{blue}{\left(a + 3\right)}\right)\right) + \left(-1\right) \]
      5. metadata-eval66.0%

        \[\leadsto \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) + \color{blue}{-1} \]
    3. Simplified66.0%

      \[\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 50.9%

      \[\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+50.9%

        \[\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*50.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(12 \cdot \left(b \cdot b\right) + \left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b\right)}\right) + -1 \]
      6. distribute-rgt-in100.0%

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(12 + b \cdot b\right)} + -1 \]
      7. associate-*l*100.0%

        \[\leadsto \color{blue}{b \cdot \left(b \cdot \left(12 + b \cdot b\right)\right)} + -1 \]
      8. +-commutative100.0%

        \[\leadsto b \cdot \left(b \cdot \color{blue}{\left(b \cdot b + 12\right)}\right) + -1 \]
      9. fma-def100.0%

        \[\leadsto b \cdot \left(b \cdot \color{blue}{\mathsf{fma}\left(b, b, 12\right)}\right) + -1 \]
    12. Simplified100.0%

      \[\leadsto \color{blue}{b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 12\right)\right)} + -1 \]
    13. Taylor expanded in b around 0 100.0%

      \[\leadsto \color{blue}{12 \cdot {b}^{2}} + -1 \]
    14. Step-by-step derivation
      1. unpow2100.0%

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

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

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

Alternative 11: 50.7% accurate, 18.3× speedup?

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

\\
-1 + \left(b \cdot b\right) \cdot 12
\end{array}
Derivation
  1. Initial program 76.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-neg76.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. fma-def76.9%

      \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
    3. fma-def77.6%

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

      \[\leadsto \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 \color{blue}{\left(a + 3\right)}\right)\right) + \left(-1\right) \]
    5. metadata-eval77.6%

      \[\leadsto \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) + \color{blue}{-1} \]
  3. Simplified77.6%

    \[\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 60.9%

    \[\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+60.9%

      \[\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*60.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(12 \cdot \left(b \cdot b\right) + \left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b\right)}\right) + -1 \]
    6. distribute-rgt-in73.0%

      \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(12 + b \cdot b\right)} + -1 \]
    7. associate-*l*73.0%

      \[\leadsto \color{blue}{b \cdot \left(b \cdot \left(12 + b \cdot b\right)\right)} + -1 \]
    8. +-commutative73.0%

      \[\leadsto b \cdot \left(b \cdot \color{blue}{\left(b \cdot b + 12\right)}\right) + -1 \]
    9. fma-def73.0%

      \[\leadsto b \cdot \left(b \cdot \color{blue}{\mathsf{fma}\left(b, b, 12\right)}\right) + -1 \]
  12. Simplified73.0%

    \[\leadsto \color{blue}{b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 12\right)\right)} + -1 \]
  13. Taylor expanded in b around 0 50.0%

    \[\leadsto \color{blue}{12 \cdot {b}^{2}} + -1 \]
  14. Step-by-step derivation
    1. unpow250.0%

      \[\leadsto 12 \cdot \color{blue}{\left(b \cdot b\right)} + -1 \]
  15. Simplified50.0%

    \[\leadsto \color{blue}{12 \cdot \left(b \cdot b\right)} + -1 \]
  16. Final simplification50.0%

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

Alternative 12: 24.8% 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 76.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-neg76.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. fma-def76.9%

      \[\leadsto \left({\color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot 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) \]
    3. fma-def77.6%

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

      \[\leadsto \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 \color{blue}{\left(a + 3\right)}\right)\right) + \left(-1\right) \]
    5. metadata-eval77.6%

      \[\leadsto \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) + \color{blue}{-1} \]
  3. Simplified77.6%

    \[\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 66.9%

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

    \[\leadsto \color{blue}{-1} \]
  6. Final simplification27.4%

    \[\leadsto -1 \]

Reproduce

?
herbie shell --seed 2023261 
(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))