Bouland and Aaronson, Equation (25)

Percentage Accurate: 73.4% → 97.5%
Time: 9.5s
Alternatives: 13
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

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

Alternative 1: 97.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -9.5 \cdot 10^{+71}:\\ \;\;\;\;{a}^{4}\\ \mathbf{else}:\\ \;\;\;\;{\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(4 \cdot \mathsf{fma}\left(a \cdot a, a + 1, {\left({b}^{6}\right)}^{0.3333333333333333}\right) + -1\right)\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= a -9.5e+71)
   (pow a 4.0)
   (+
    (pow (fma a a (* b b)) 2.0)
    (+
     (* 4.0 (fma (* a a) (+ a 1.0) (pow (pow b 6.0) 0.3333333333333333)))
     -1.0))))
double code(double a, double b) {
	double tmp;
	if (a <= -9.5e+71) {
		tmp = pow(a, 4.0);
	} else {
		tmp = pow(fma(a, a, (b * b)), 2.0) + ((4.0 * fma((a * a), (a + 1.0), pow(pow(b, 6.0), 0.3333333333333333))) + -1.0);
	}
	return tmp;
}
function code(a, b)
	tmp = 0.0
	if (a <= -9.5e+71)
		tmp = a ^ 4.0;
	else
		tmp = Float64((fma(a, a, Float64(b * b)) ^ 2.0) + Float64(Float64(4.0 * fma(Float64(a * a), Float64(a + 1.0), ((b ^ 6.0) ^ 0.3333333333333333))) + -1.0));
	end
	return tmp
end
code[a_, b_] := If[LessEqual[a, -9.5e+71], N[Power[a, 4.0], $MachinePrecision], N[(N[Power[N[(a * a + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(N[(4.0 * N[(N[(a * a), $MachinePrecision] * N[(a + 1.0), $MachinePrecision] + N[Power[N[Power[b, 6.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 18.5%

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

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

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

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

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

    if -9.50000000000000015e71 < a

    1. Initial program 88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.1% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;{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 1 (*.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(1 - 3 \cdot a\right)\right)\right) - 1 \]

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

    1. Initial program 0.0%

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

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

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

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

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

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

Alternative 3: 94.1% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;a \leq 750000000000:\\
\;\;\;\;b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 4\right)\right) + -1\\

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


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

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

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

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

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

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

    if -1.7e15 < a < 7.5e11

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{\left(\left(b \cdot b\right) \cdot b\right)} \cdot b\right) - 1 \]
      5. associate-*r*99.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, b \cdot \color{blue}{\mathsf{fma}\left(b, b, 4\right)}, -1\right) \]
      11. metadata-eval99.7%

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

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

        \[\leadsto \color{blue}{b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 4\right)\right) + -1} \]
    11. Applied egg-rr99.7%

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

    if 7.5e11 < a

    1. Initial program 66.6%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 94.1% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -720000000000:\\
\;\;\;\;{a}^{4}\\

\mathbf{elif}\;a \leq 550000000000:\\
\;\;\;\;b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 4\right)\right) + -1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -7.2e11 or 5.5e11 < a

    1. Initial program 50.7%

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

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

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

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

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

    if -7.2e11 < a < 5.5e11

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{\left(\left(b \cdot b\right) \cdot b\right)} \cdot b\right) - 1 \]
      5. associate-*r*99.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, b \cdot \color{blue}{\mathsf{fma}\left(b, b, 4\right)}, -1\right) \]
      11. metadata-eval99.7%

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

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

        \[\leadsto \color{blue}{b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 4\right)\right) + -1} \]
    11. Applied egg-rr99.7%

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

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

Alternative 5: 68.2% accurate, 1.2× speedup?

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

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

\mathbf{elif}\;a \leq -1.4 \cdot 10^{-105}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;a \leq -9.5 \cdot 10^{-165}:\\
\;\;\;\;-1\\

\mathbf{elif}\;a \leq -5.8 \cdot 10^{-241}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;a \leq 1.7 \cdot 10^{-8}:\\
\;\;\;\;-1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.7e16 or 1.7e-8 < a

    1. Initial program 50.7%

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

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

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

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

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

    if -1.7e16 < a < -1.4e-105 or -9.49999999999999973e-165 < a < -5.7999999999999998e-241

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{b}^{2} \cdot 4} + {b}^{4} \]
      2. fma-def69.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left({b}^{2}, 4, {b}^{4}\right)} \]
      3. unpow269.5%

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot b}, 4, {b}^{4}\right) \]
    9. Simplified69.5%

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

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

        \[\leadsto \left(b \cdot b\right) \cdot 4 + {b}^{\color{blue}{\left(2 + 2\right)}} \]
      3. pow-prod-up69.3%

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

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

        \[\leadsto \left(b \cdot b\right) \cdot 4 + \left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
      6. distribute-lft-out69.3%

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)} \]
    11. Applied egg-rr69.3%

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

    if -1.4e-105 < a < -9.49999999999999973e-165 or -5.7999999999999998e-241 < a < 1.7e-8

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.7 \cdot 10^{+16}:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;a \leq -1.4 \cdot 10^{-105}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)\\ \mathbf{elif}\;a \leq -9.5 \cdot 10^{-165}:\\ \;\;\;\;-1\\ \mathbf{elif}\;a \leq -5.8 \cdot 10^{-241}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)\\ \mathbf{elif}\;a \leq 1.7 \cdot 10^{-8}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;{a}^{4}\\ \end{array} \]

Alternative 6: 68.1% accurate, 1.2× speedup?

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

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

\mathbf{elif}\;a \leq -2.8 \cdot 10^{-103}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)\\

\mathbf{elif}\;a \leq -1.22 \cdot 10^{-164}:\\
\;\;\;\;-1\\

\mathbf{elif}\;a \leq -1.9 \cdot 10^{-241}:\\
\;\;\;\;{b}^{4}\\

\mathbf{elif}\;a \leq 1.7 \cdot 10^{-8}:\\
\;\;\;\;-1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -9.8e17 or 1.7e-8 < a

    1. Initial program 50.7%

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

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

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

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

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

    if -9.8e17 < a < -2.80000000000000023e-103

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{b}^{2} \cdot 4} + {b}^{4} \]
      2. fma-def69.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left({b}^{2}, 4, {b}^{4}\right)} \]
      3. unpow269.2%

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot b}, 4, {b}^{4}\right) \]
    9. Simplified69.2%

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

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

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

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

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

        \[\leadsto \left(b \cdot b\right) \cdot 4 + \left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
      6. distribute-lft-out69.0%

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)} \]
    11. Applied egg-rr69.0%

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

    if -2.80000000000000023e-103 < a < -1.2199999999999999e-164 or -1.8999999999999999e-241 < a < 1.7e-8

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if -1.2199999999999999e-164 < a < -1.8999999999999999e-241

    1. Initial program 99.8%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -9.8 \cdot 10^{+17}:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;a \leq -2.8 \cdot 10^{-103}:\\ \;\;\;\;\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)\\ \mathbf{elif}\;a \leq -1.22 \cdot 10^{-164}:\\ \;\;\;\;-1\\ \mathbf{elif}\;a \leq -1.9 \cdot 10^{-241}:\\ \;\;\;\;{b}^{4}\\ \mathbf{elif}\;a \leq 1.7 \cdot 10^{-8}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;{a}^{4}\\ \end{array} \]

Alternative 7: 82.4% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -420000000000:\\
\;\;\;\;{a}^{4}\\

\mathbf{elif}\;a \leq 980000000000:\\
\;\;\;\;\mathsf{fma}\left(b, 4 \cdot b, -1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -4.2e11 or 9.8e11 < a

    1. Initial program 50.7%

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

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

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

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

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

    if -4.2e11 < a < 9.8e11

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{\left(\left(b \cdot b\right) \cdot b\right)} \cdot b\right) - 1 \]
      5. associate-*r*99.7%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(b, b \cdot \color{blue}{\mathsf{fma}\left(b, b, 4\right)}, -1\right) \]
      11. metadata-eval99.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -420000000000:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;a \leq 980000000000:\\ \;\;\;\;\mathsf{fma}\left(b, 4 \cdot b, -1\right)\\ \mathbf{else}:\\ \;\;\;\;{a}^{4}\\ \end{array} \]

Alternative 8: 82.0% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e16 < (*.f64 b b)

    1. Initial program 62.8%

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

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

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

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

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

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

Alternative 9: 59.8% accurate, 9.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.52 \cdot 10^{-12} \lor \neg \left(a \leq 1.7 \cdot 10^{-8}\right):\\
\;\;\;\;b \cdot \left(b \cdot \left(2 \cdot \left(a \cdot a\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.52e-12 or 1.7e-8 < a

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(a \cdot a\right) \cdot \left(2 \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
    9. Simplified53.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.52e-12 < a < 1.7e-8

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.52 \cdot 10^{-12} \lor \neg \left(a \leq 1.7 \cdot 10^{-8}\right):\\ \;\;\;\;b \cdot \left(b \cdot \left(2 \cdot \left(a \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]

Alternative 10: 39.6% accurate, 11.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.48:\\
\;\;\;\;-1\\

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

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


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

    1. Initial program 77.6%

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

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

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

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

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

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

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

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

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

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

    if 0.47999999999999998 < b < 1.7499999999999999e148

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(b \cdot b\right) \cdot \color{blue}{\left(a \cdot \left(2 \cdot a + -12\right)\right)} \]
      11. *-commutative44.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.7499999999999999e148 < b

    1. Initial program 56.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{b}^{2} \cdot 4} + {b}^{4} \]
      2. fma-def100.0%

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

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot b}, 4, {b}^{4}\right) \]
    9. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot b, 4, {b}^{4}\right)} \]
    10. Taylor expanded in b around 0 91.1%

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

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

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot 4} \]
      3. associate-*l*91.1%

        \[\leadsto \color{blue}{b \cdot \left(b \cdot 4\right)} \]
    12. Simplified91.1%

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

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

Alternative 11: 47.9% accurate, 11.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.48:\\
\;\;\;\;-1\\

\mathbf{else}:\\
\;\;\;\;\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)\\


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

    1. Initial program 77.6%

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

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

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

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

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

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

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

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

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

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

    if 0.47999999999999998 < b

    1. Initial program 60.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{b}^{2} \cdot 4} + {b}^{4} \]
      2. fma-def83.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left({b}^{2}, 4, {b}^{4}\right)} \]
      3. unpow283.8%

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot b}, 4, {b}^{4}\right) \]
    9. Simplified83.8%

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

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

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

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

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

        \[\leadsto \left(b \cdot b\right) \cdot 4 + \left(b \cdot b\right) \cdot \color{blue}{\left(b \cdot b\right)} \]
      6. distribute-lft-out83.7%

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

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

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

Alternative 12: 38.5% accurate, 18.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 0.48:\\
\;\;\;\;-1\\

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


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

    1. Initial program 77.6%

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

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

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

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

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

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

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

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

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

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

    if 0.47999999999999998 < b

    1. Initial program 60.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{b}^{2} \cdot 4} + {b}^{4} \]
      2. fma-def83.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left({b}^{2}, 4, {b}^{4}\right)} \]
      3. unpow283.8%

        \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot b}, 4, {b}^{4}\right) \]
    9. Simplified83.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot b, 4, {b}^{4}\right)} \]
    10. Taylor expanded in b around 0 49.2%

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

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

        \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot 4} \]
      3. associate-*l*49.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 0.48:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(4 \cdot b\right)\\ \end{array} \]

Alternative 13: 24.9% accurate, 130.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-1} \]
  8. Final simplification27.3%

    \[\leadsto -1 \]

Reproduce

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