Bouland and Aaronson, Equation (24)

Percentage Accurate: 74.3% → 98.1%
Time: 9.0s
Alternatives: 14
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 74.3% accurate, 1.0× speedup?

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

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

Alternative 1: 98.1% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 99.8%

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.1% accurate, 0.6× speedup?

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

\\
\left(\left(\left(2 \cdot \left(a \cdot \left(b \cdot \left(b \cdot a\right)\right)\right) + {a}^{4}\right) + {b}^{4}\right) + 4 \cdot \left(b \cdot \left(b \cdot 3\right)\right)\right) + -1
\end{array}
Derivation
  1. Initial program 75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{+18} \lor \neg \left(a \leq 115000\right):\\
\;\;\;\;-1 + \left(\left(a \cdot \left(b \cdot b\right)\right) \cdot \left(4 + 2 \cdot a\right) + {a}^{3} \cdot \left(a + -4\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.4e18 or 115000 < a

    1. Initial program 48.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.4e18 < a < 115000

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 93.5% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -4 \cdot 10^{+18} \lor \neg \left(a \leq 3.7 \cdot 10^{+59}\right):\\
\;\;\;\;{a}^{4}\\

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


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

    1. Initial program 43.0%

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

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

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

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

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

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

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

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

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

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

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

    if -4e18 < a < 3.69999999999999997e59

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -4 \cdot 10^{+18} \lor \neg \left(a \leq 3.7 \cdot 10^{+59}\right):\\ \;\;\;\;{a}^{4}\\ \mathbf{else}:\\ \;\;\;\;-1 + \left({b}^{4} + b \cdot \left(b \cdot \left(4 \cdot \left(a + 3\right)\right)\right)\right)\\ \end{array} \]

Alternative 5: 93.7% accurate, 1.1× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -9.5000000000000005e25 or 1.7e58 < a

    1. Initial program 43.0%

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

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

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

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

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

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

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

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

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

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

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

    if -9.5000000000000005e25 < a < 1.7e58

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 93.1% accurate, 1.2× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -5.6e32 or 3.84999999999999993e59 < a

    1. Initial program 43.0%

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

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

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

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

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

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

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

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

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

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

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

    if -5.6e32 < a < 3.84999999999999993e59

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -5.6 \cdot 10^{+32}:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;a \leq 3.85 \cdot 10^{+59}:\\ \;\;\;\;{b}^{4} + -1\\ \mathbf{else}:\\ \;\;\;\;{a}^{4}\\ \end{array} \]

Alternative 7: 84.2% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 77.7%

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000003e298 < (*.f64 b b)

    1. Initial program 68.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{12 \cdot {b}^{2}} + -1 \]
    11. Step-by-step derivation
      1. unpow296.9%

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

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

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

Alternative 8: 81.6% accurate, 1.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.6499999999999999 or 1.1000000000000001e42 < a

    1. Initial program 46.0%

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

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

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

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

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

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

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

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

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

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

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

    if -1.6499999999999999 < a < 1.1000000000000001e42

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 54.3% accurate, 9.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -6.99999999999999961e-10

    1. Initial program 68.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{12 \cdot {b}^{2}} + -1 \]
    11. Step-by-step derivation
      1. unpow219.9%

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

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

    if -6.99999999999999961e-10 < a

    1. Initial program 78.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 65.1% accurate, 9.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.3e-6

    1. Initial program 68.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.3e-6 < a

    1. Initial program 78.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 54.3% accurate, 11.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 9.59999999999999948e-12

    1. Initial program 88.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{12 \cdot {b}^{2}} + -1 \]
    11. Step-by-step derivation
      1. unpow256.5%

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

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

    if 9.59999999999999948e-12 < a

    1. Initial program 35.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 54.3% accurate, 11.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 2.0000000000000002e-15

    1. Initial program 88.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{12 \cdot {b}^{2}} + -1 \]
    11. Step-by-step derivation
      1. unpow256.5%

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

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

    if 2.0000000000000002e-15 < a

    1. Initial program 35.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 51.4% accurate, 18.3× speedup?

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

\\
-1 + \left(b \cdot b\right) \cdot 12
\end{array}
Derivation
  1. Initial program 75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{12 \cdot \left(b \cdot b\right)} + -1 \]
  13. Final simplification49.6%

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

Alternative 14: 25.1% accurate, 128.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -1 \]

Reproduce

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