Bouland and Aaronson, Equation (25)

Percentage Accurate: 73.8% → 98.3%
Time: 7.2s
Alternatives: 11
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 73.8% accurate, 1.0× speedup?

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

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

Alternative 1: 98.3% accurate, 0.2× speedup?

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow0.0%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified7.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.2% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 99.9%

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

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

    1. Initial program 0.0%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow0.0%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified7.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 93.6% accurate, 1.1× speedup?

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

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

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

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


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

    1. Initial program 16.9%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow16.9%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified26.3%

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

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

    if -7.99999999999999957e49 < a < 1.06000000000000004e69

    1. Initial program 98.6%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1 \]
    2. Taylor expanded in a around 0 83.1%

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

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

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

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

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

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

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

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

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

    if 1.06000000000000004e69 < a

    1. Initial program 66.7%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow66.7%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified66.7%

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

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

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

        \[\leadsto \color{blue}{{a}^{2} \cdot {a}^{2}} \]
      3. pow2100.0%

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

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

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

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

Alternative 4: 93.5% accurate, 1.1× speedup?

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

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

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

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


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

    1. Initial program 16.9%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow16.9%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified26.3%

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

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

    if -1.55000000000000001e50 < a < 6.2000000000000006e70

    1. Initial program 98.6%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow98.5%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified98.5%

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

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

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

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

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

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

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

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

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

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

    if 6.2000000000000006e70 < a

    1. Initial program 66.7%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow66.7%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified66.7%

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

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

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

        \[\leadsto \color{blue}{{a}^{2} \cdot {a}^{2}} \]
      3. pow2100.0%

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

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

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

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

Alternative 5: 47.3% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.95 \cdot 10^{-202}:\\
\;\;\;\;-1\\

\mathbf{elif}\;b \leq 2.1 \cdot 10^{-158}:\\
\;\;\;\;{a}^{4}\\

\mathbf{elif}\;b \leq 2.3 \cdot 10^{-79}:\\
\;\;\;\;-1\\

\mathbf{elif}\;b \leq 1250:\\
\;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < 1.95e-202 or 2.09999999999999991e-158 < b < 2.30000000000000012e-79

    1. Initial program 77.8%

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

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

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

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified78.4%

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

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

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

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

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

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

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

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

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

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

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

    if 1.95e-202 < b < 2.09999999999999991e-158

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow71.4%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified71.4%

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

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

    if 2.30000000000000012e-79 < b < 1250

    1. Initial program 70.6%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow70.5%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified70.5%

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

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

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

        \[\leadsto \color{blue}{{a}^{2} \cdot {a}^{2}} \]
      3. pow265.7%

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

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

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

    if 1250 < b

    1. Initial program 70.8%

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

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

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

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified77.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.95 \cdot 10^{-202}:\\ \;\;\;\;-1\\ \mathbf{elif}\;b \leq 2.1 \cdot 10^{-158}:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;b \leq 2.3 \cdot 10^{-79}:\\ \;\;\;\;-1\\ \mathbf{elif}\;b \leq 1250:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]

Alternative 6: 93.1% accurate, 1.2× speedup?

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

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

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

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


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

    1. Initial program 16.9%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow16.9%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified26.3%

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

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

    if -6.5000000000000005e49 < a < 1.15000000000000008e69

    1. Initial program 98.6%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow98.5%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.15000000000000008e69 < a

    1. Initial program 66.7%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow66.7%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified66.7%

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

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

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

        \[\leadsto \color{blue}{{a}^{2} \cdot {a}^{2}} \]
      3. pow2100.0%

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

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

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

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

Alternative 7: 93.5% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 80.0%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow80.0%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e5 < (*.f64 b b)

    1. Initial program 70.5%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow70.5%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified74.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot b \leq 200000:\\ \;\;\;\;-1 + {a}^{4}\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]

Alternative 8: 65.4% accurate, 1.2× speedup?

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

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

\mathbf{elif}\;a \leq -3.5 \cdot 10^{-114}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;a \leq -4.2 \cdot 10^{-302}:\\
\;\;\;\;-1\\

\mathbf{elif}\;a \leq 3.6 \cdot 10^{-256}:\\
\;\;\;\;t_0\\

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

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


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

    1. Initial program 16.9%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow16.9%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified26.3%

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

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

    if -6.5000000000000005e49 < a < -3.5e-114 or -4.20000000000000026e-302 < a < 3.6000000000000002e-256

    1. Initial program 99.9%

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

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

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

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{b}^{4} + 4 \cdot {b}^{2}} \]
      2. metadata-eval70.6%

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

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

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

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

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

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

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

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

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

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

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

    if -3.5e-114 < a < -4.20000000000000026e-302 or 3.6000000000000002e-256 < a < 0.021499999999999998

    1. Initial program 99.8%

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

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

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

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified99.8%

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

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

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

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

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

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

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

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

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

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

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

    if 0.021499999999999998 < a

    1. Initial program 64.8%

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

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

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

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified64.8%

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

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

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

        \[\leadsto \color{blue}{{a}^{2} \cdot {a}^{2}} \]
      3. pow294.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -6.5 \cdot 10^{+49}:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;a \leq -3.5 \cdot 10^{-114}:\\ \;\;\;\;\left(b \cdot b\right) \cdot 4\\ \mathbf{elif}\;a \leq -4.2 \cdot 10^{-302}:\\ \;\;\;\;-1\\ \mathbf{elif}\;a \leq 3.6 \cdot 10^{-256}:\\ \;\;\;\;\left(b \cdot b\right) \cdot 4\\ \mathbf{elif}\;a \leq 0.0215:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \end{array} \]

Alternative 9: 65.4% accurate, 7.5× speedup?

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

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

\mathbf{elif}\;a \leq -3.2 \cdot 10^{-114}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq -3.5 \cdot 10^{-302}:\\
\;\;\;\;-1\\

\mathbf{elif}\;a \leq 1.05 \cdot 10^{-254}:\\
\;\;\;\;t_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -1.55000000000000001e50 or 0.021499999999999998 < a

    1. Initial program 41.1%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow41.1%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified45.8%

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

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

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

        \[\leadsto \color{blue}{{a}^{2} \cdot {a}^{2}} \]
      3. pow295.7%

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

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

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

    if -1.55000000000000001e50 < a < -3.2000000000000002e-114 or -3.5000000000000001e-302 < a < 1.04999999999999998e-254

    1. Initial program 99.9%

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

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

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

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified99.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{b}^{4} + 4 \cdot {b}^{2}} \]
      2. metadata-eval70.6%

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

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

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

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

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

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

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

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

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

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

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

    if -3.2000000000000002e-114 < a < -3.5000000000000001e-302 or 1.04999999999999998e-254 < a < 0.021499999999999998

    1. Initial program 99.8%

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

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

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

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified99.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.55 \cdot 10^{+50}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \mathbf{elif}\;a \leq -3.2 \cdot 10^{-114}:\\ \;\;\;\;\left(b \cdot b\right) \cdot 4\\ \mathbf{elif}\;a \leq -3.5 \cdot 10^{-302}:\\ \;\;\;\;-1\\ \mathbf{elif}\;a \leq 1.05 \cdot 10^{-254}:\\ \;\;\;\;\left(b \cdot b\right) \cdot 4\\ \mathbf{elif}\;a \leq 0.0215:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \end{array} \]

Alternative 10: 37.7% accurate, 18.4× speedup?

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

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

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


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

    1. Initial program 76.6%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow76.6%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified77.1%

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

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

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

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

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

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

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

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

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

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

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

    if 0.0379999999999999991 < b

    1. Initial program 71.3%

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

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

        \[\leadsto \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)}} + \left(4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) - 1\right) \]
      3. sqr-pow71.3%

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

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

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

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

        \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
    3. Simplified77.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{b}^{4} + 4 \cdot {b}^{2}} \]
      2. metadata-eval90.9%

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

        \[\leadsto \color{blue}{{b}^{2} \cdot {b}^{2}} + 4 \cdot {b}^{2} \]
      4. unpow290.7%

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

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

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

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

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

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

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

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

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

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

Alternative 11: 24.7% accurate, 130.0× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} + \left(\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(1 - 3 \cdot a\right)\right)} - 1\right) \]
  3. Simplified77.2%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -1 \]

Reproduce

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