Bouland and Aaronson, Equation (24)

Percentage Accurate: 73.1% → 99.9%
Time: 12.4s
Alternatives: 17
Speedup: 3.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 17 alternatives:

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

Initial Program: 73.1% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(b, b, a \cdot a\right)\\ t_1 := \mathsf{fma}\left(a, a, b \cdot b\right)\\ \mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) \leq 2 \cdot 10^{+62}:\\ \;\;\;\;\mathsf{fma}\left(1 - a, \left(a \cdot a\right) \cdot 4, \mathsf{fma}\left(b, 4 \cdot \left(b \cdot \left(a + 3\right)\right), t\_1 \cdot t\_1\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, t\_0, \mathsf{fma}\left(b \cdot b, 12, -1\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (let* ((t_0 (fma b b (* a a))) (t_1 (fma a a (* b b))))
   (if (<=
        (+
         (pow (+ (* a a) (* b b)) 2.0)
         (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ a 3.0)))))
        2e+62)
     (+
      (fma
       (- 1.0 a)
       (* (* a a) 4.0)
       (fma b (* 4.0 (* b (+ a 3.0))) (* t_1 t_1)))
      -1.0)
     (fma t_0 t_0 (fma (* b b) 12.0 -1.0)))))
double code(double a, double b) {
	double t_0 = fma(b, b, (a * a));
	double t_1 = fma(a, a, (b * b));
	double tmp;
	if ((pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))))) <= 2e+62) {
		tmp = fma((1.0 - a), ((a * a) * 4.0), fma(b, (4.0 * (b * (a + 3.0))), (t_1 * t_1))) + -1.0;
	} else {
		tmp = fma(t_0, t_0, fma((b * b), 12.0, -1.0));
	}
	return tmp;
}
function code(a, b)
	t_0 = fma(b, b, Float64(a * a))
	t_1 = fma(a, a, Float64(b * b))
	tmp = 0.0
	if (Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 - a)) + Float64(Float64(b * b) * Float64(a + 3.0))))) <= 2e+62)
		tmp = Float64(fma(Float64(1.0 - a), Float64(Float64(a * a) * 4.0), fma(b, Float64(4.0 * Float64(b * Float64(a + 3.0))), Float64(t_1 * t_1))) + -1.0);
	else
		tmp = fma(t_0, t_0, fma(Float64(b * b), 12.0, -1.0));
	end
	return tmp
end
code[a_, b_] := Block[{t$95$0 = N[(b * b + N[(a * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+62], N[(N[(N[(1.0 - a), $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * 4.0), $MachinePrecision] + N[(b * N[(4.0 * N[(b * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(t$95$0 * t$95$0 + N[(N[(b * b), $MachinePrecision] * 12.0 + -1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(b, b, a \cdot a\right)\\
t_1 := \mathsf{fma}\left(a, a, b \cdot b\right)\\
\mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) \leq 2 \cdot 10^{+62}:\\
\;\;\;\;\mathsf{fma}\left(1 - a, \left(a \cdot a\right) \cdot 4, \mathsf{fma}\left(b, 4 \cdot \left(b \cdot \left(a + 3\right)\right), t\_1 \cdot t\_1\right)\right) + -1\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_0, \mathsf{fma}\left(b \cdot b, 12, -1\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) < 2.00000000000000007e62

    1. Initial program 99.8%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Add Preprocessing
    3. Applied egg-rr99.8%

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

    if 2.00000000000000007e62 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a)))))

    1. Initial program 67.3%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Add Preprocessing
    3. Applied egg-rr68.9%

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

      \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{3 \cdot {b}^{2}}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{{b}^{2} \cdot 3}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      2. unpow2N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{\left(b \cdot b\right)} \cdot 3, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      3. associate-*l*N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, b \cdot \color{blue}{\left(3 \cdot b\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(3 \cdot b\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, b \cdot \color{blue}{\left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      7. lower-*.f6499.9

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

      \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \color{blue}{\left(b \cdot 3\right)}\right) + \left(\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right)} + \left(\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\left(a \cdot a + \color{blue}{b \cdot b}\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      4. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \left(a \cdot a + \color{blue}{b \cdot b}\right) + -1\right)}} \]
      6. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)} + -1\right)}} \]
      7. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)}}} \]
      8. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\mathsf{fma}\left(4, b \cdot \left(b \cdot 3\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}}} \]
      9. remove-double-div99.9

        \[\leadsto \color{blue}{\mathsf{fma}\left(4, b \cdot \left(b \cdot 3\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)} \]
      10. lift-fma.f64N/A

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) \leq 2 \cdot 10^{+62}:\\ \;\;\;\;\mathsf{fma}\left(1 - a, \left(a \cdot a\right) \cdot 4, \mathsf{fma}\left(b, 4 \cdot \left(b \cdot \left(a + 3\right)\right), \mathsf{fma}\left(a, a, b \cdot b\right) \cdot \mathsf{fma}\left(a, a, b \cdot b\right)\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b \cdot b, 12, -1\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(a, a, b \cdot b\right)\\ t_1 := \mathsf{fma}\left(b, b, a \cdot a\right)\\ \mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) \leq 2 \cdot 10^{+62}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(a, a \cdot \left(1 - a\right), b \cdot \left(b \cdot \left(a + 3\right)\right)\right), 4, \mathsf{fma}\left(t\_0, t\_0, -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t\_1, t\_1, \mathsf{fma}\left(b \cdot b, 12, -1\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (let* ((t_0 (fma a a (* b b))) (t_1 (fma b b (* a a))))
   (if (<=
        (+
         (pow (+ (* a a) (* b b)) 2.0)
         (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ a 3.0)))))
        2e+62)
     (fma (fma a (* a (- 1.0 a)) (* b (* b (+ a 3.0)))) 4.0 (fma t_0 t_0 -1.0))
     (fma t_1 t_1 (fma (* b b) 12.0 -1.0)))))
double code(double a, double b) {
	double t_0 = fma(a, a, (b * b));
	double t_1 = fma(b, b, (a * a));
	double tmp;
	if ((pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (a + 3.0))))) <= 2e+62) {
		tmp = fma(fma(a, (a * (1.0 - a)), (b * (b * (a + 3.0)))), 4.0, fma(t_0, t_0, -1.0));
	} else {
		tmp = fma(t_1, t_1, fma((b * b), 12.0, -1.0));
	}
	return tmp;
}
function code(a, b)
	t_0 = fma(a, a, Float64(b * b))
	t_1 = fma(b, b, Float64(a * a))
	tmp = 0.0
	if (Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 - a)) + Float64(Float64(b * b) * Float64(a + 3.0))))) <= 2e+62)
		tmp = fma(fma(a, Float64(a * Float64(1.0 - a)), Float64(b * Float64(b * Float64(a + 3.0)))), 4.0, fma(t_0, t_0, -1.0));
	else
		tmp = fma(t_1, t_1, fma(Float64(b * b), 12.0, -1.0));
	end
	return tmp
end
code[a_, b_] := Block[{t$95$0 = N[(a * a + N[(b * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(b * b + N[(a * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 - a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+62], N[(N[(a * N[(a * N[(1.0 - a), $MachinePrecision]), $MachinePrecision] + N[(b * N[(b * N[(a + 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 4.0 + N[(t$95$0 * t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$1 + N[(N[(b * b), $MachinePrecision] * 12.0 + -1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(a, a, b \cdot b\right)\\
t_1 := \mathsf{fma}\left(b, b, a \cdot a\right)\\
\mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) \leq 2 \cdot 10^{+62}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(a, a \cdot \left(1 - a\right), b \cdot \left(b \cdot \left(a + 3\right)\right)\right), 4, \mathsf{fma}\left(t\_0, t\_0, -1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, t\_1, \mathsf{fma}\left(b \cdot b, 12, -1\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) < 2.00000000000000007e62

    1. Initial program 99.8%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Add Preprocessing
    3. Applied egg-rr99.8%

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

    if 2.00000000000000007e62 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a)))))

    1. Initial program 67.3%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Add Preprocessing
    3. Applied egg-rr68.9%

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

      \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{3 \cdot {b}^{2}}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{{b}^{2} \cdot 3}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      2. unpow2N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{\left(b \cdot b\right)} \cdot 3, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      3. associate-*l*N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, b \cdot \color{blue}{\left(3 \cdot b\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(3 \cdot b\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, b \cdot \color{blue}{\left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      7. lower-*.f6499.9

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

      \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \color{blue}{\left(b \cdot 3\right)}\right) + \left(\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right)} + \left(\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\left(a \cdot a + \color{blue}{b \cdot b}\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      4. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \left(a \cdot a + \color{blue}{b \cdot b}\right) + -1\right)}} \]
      6. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)} + -1\right)}} \]
      7. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)}}} \]
      8. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\mathsf{fma}\left(4, b \cdot \left(b \cdot 3\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}}} \]
      9. remove-double-div99.9

        \[\leadsto \color{blue}{\mathsf{fma}\left(4, b \cdot \left(b \cdot 3\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)} \]
      10. lift-fma.f64N/A

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) \leq 2 \cdot 10^{+62}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(a, a \cdot \left(1 - a\right), b \cdot \left(b \cdot \left(a + 3\right)\right)\right), 4, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b \cdot b, 12, -1\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 98.9% accurate, 0.7× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_0, \mathsf{fma}\left(b \cdot b, 12, -1\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) < 1.99999999999999995e38

    1. Initial program 99.9%

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

      \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    4. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      6. cube-multN/A

        \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      7. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      8. cube-multN/A

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      10. lower-*.f64N/A

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      12. lower-*.f6499.9

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

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

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

    if 1.99999999999999995e38 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a)))))

    1. Initial program 68.3%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Add Preprocessing
    3. Applied egg-rr69.9%

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

      \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{3 \cdot {b}^{2}}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{{b}^{2} \cdot 3}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      2. unpow2N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{\left(b \cdot b\right)} \cdot 3, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      3. associate-*l*N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, b \cdot \color{blue}{\left(3 \cdot b\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(3 \cdot b\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, b \cdot \color{blue}{\left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      7. lower-*.f6499.7

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

      \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \color{blue}{\left(b \cdot 3\right)}\right) + \left(\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right)} + \left(\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\left(a \cdot a + \color{blue}{b \cdot b}\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      4. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \left(a \cdot a + \color{blue}{b \cdot b}\right) + -1\right)}} \]
      6. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)} + -1\right)}} \]
      7. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)}}} \]
      8. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\mathsf{fma}\left(4, b \cdot \left(b \cdot 3\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}}} \]
      9. remove-double-div99.7

        \[\leadsto \color{blue}{\mathsf{fma}\left(4, b \cdot \left(b \cdot 3\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)} \]
      10. lift-fma.f64N/A

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) \leq 2 \cdot 10^{+38}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(a, a \cdot \left(1 - a\right), b \cdot \left(b \cdot \left(a + 3\right)\right)\right), 4, \mathsf{fma}\left(a \cdot a, a \cdot a, -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b \cdot b, 12, -1\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 98.9% accurate, 0.7× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_0, \mathsf{fma}\left(b \cdot b, 12, -1\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) < 1.99999999999999995e38

    1. Initial program 99.9%

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

      \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    4. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      6. cube-multN/A

        \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      7. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      8. cube-multN/A

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      10. lower-*.f64N/A

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      12. lower-*.f6499.9

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

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

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

    if 1.99999999999999995e38 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a)))))

    1. Initial program 68.3%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Add Preprocessing
    3. Applied egg-rr69.9%

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

      \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{3 \cdot {b}^{2}}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{{b}^{2} \cdot 3}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      2. unpow2N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{\left(b \cdot b\right)} \cdot 3, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      3. associate-*l*N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, b \cdot \color{blue}{\left(3 \cdot b\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(3 \cdot b\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, b \cdot \color{blue}{\left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      7. lower-*.f6499.7

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

      \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \color{blue}{\left(b \cdot 3\right)}\right) + \left(\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right)} + \left(\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\left(a \cdot a + \color{blue}{b \cdot b}\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      4. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \left(a \cdot a + \color{blue}{b \cdot b}\right) + -1\right)}} \]
      6. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)} + -1\right)}} \]
      7. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)}}} \]
      8. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\mathsf{fma}\left(4, b \cdot \left(b \cdot 3\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}}} \]
      9. remove-double-div99.7

        \[\leadsto \color{blue}{\mathsf{fma}\left(4, b \cdot \left(b \cdot 3\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)} \]
      10. lift-fma.f64N/A

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) \leq 2 \cdot 10^{+38}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot \left(a \cdot a\right), a, \mathsf{fma}\left(4, \mathsf{fma}\left(a, a \cdot \left(1 - a\right), b \cdot \left(b \cdot \left(a + 3\right)\right)\right), -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b \cdot b, 12, -1\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 98.7% accurate, 0.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_0, \mathsf{fma}\left(b \cdot b, 12, -1\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a))))) < 1.99999999999999995e38

    1. Initial program 99.9%

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

      \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    4. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      6. cube-multN/A

        \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      7. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      8. cube-multN/A

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      10. lower-*.f64N/A

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      12. lower-*.f6499.9

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

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

      \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left({a}^{2} \cdot \left(1 - a\right)\right)}\right) - 1 \]
    7. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left({a}^{2} \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(a\right)\right)\right)}\right)\right) - 1 \]
      2. mul-1-negN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left({a}^{2} \cdot \left(1 + \color{blue}{-1 \cdot a}\right)\right)\right) - 1 \]
      3. distribute-lft-inN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left({a}^{2} \cdot 1 + {a}^{2} \cdot \left(-1 \cdot a\right)\right)}\right) - 1 \]
      4. *-rgt-identityN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(\color{blue}{{a}^{2}} + {a}^{2} \cdot \left(-1 \cdot a\right)\right)\right) - 1 \]
      5. unpow2N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(\color{blue}{a \cdot a} + {a}^{2} \cdot \left(-1 \cdot a\right)\right)\right) - 1 \]
      6. mul-1-negN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot a + {a}^{2} \cdot \color{blue}{\left(\mathsf{neg}\left(a\right)\right)}\right)\right) - 1 \]
      7. distribute-rgt-neg-inN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot a + \color{blue}{\left(\mathsf{neg}\left({a}^{2} \cdot a\right)\right)}\right)\right) - 1 \]
      8. distribute-lft-neg-inN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot a + \color{blue}{\left(\mathsf{neg}\left({a}^{2}\right)\right) \cdot a}\right)\right) - 1 \]
      9. mul-1-negN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot a + \color{blue}{\left(-1 \cdot {a}^{2}\right)} \cdot a\right)\right) - 1 \]
      10. distribute-rgt-inN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(a \cdot \left(a + -1 \cdot {a}^{2}\right)\right)}\right) - 1 \]
      11. *-rgt-identityN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot \left(\color{blue}{a \cdot 1} + -1 \cdot {a}^{2}\right)\right)\right) - 1 \]
      12. mul-1-negN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot \left(a \cdot 1 + \color{blue}{\left(\mathsf{neg}\left({a}^{2}\right)\right)}\right)\right)\right) - 1 \]
      13. unpow2N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot \left(a \cdot 1 + \left(\mathsf{neg}\left(\color{blue}{a \cdot a}\right)\right)\right)\right)\right) - 1 \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot \left(a \cdot 1 + \color{blue}{a \cdot \left(\mathsf{neg}\left(a\right)\right)}\right)\right)\right) - 1 \]
      15. mul-1-negN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot \left(a \cdot 1 + a \cdot \color{blue}{\left(-1 \cdot a\right)}\right)\right)\right) - 1 \]
      16. distribute-lft-inN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot \color{blue}{\left(a \cdot \left(1 + -1 \cdot a\right)\right)}\right)\right) - 1 \]
      17. lower-*.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(a \cdot \left(a \cdot \left(1 + -1 \cdot a\right)\right)\right)}\right) - 1 \]
      18. +-commutativeN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot \left(a \cdot \color{blue}{\left(-1 \cdot a + 1\right)}\right)\right)\right) - 1 \]
      19. distribute-lft-inN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot \color{blue}{\left(a \cdot \left(-1 \cdot a\right) + a \cdot 1\right)}\right)\right) - 1 \]
      20. *-rgt-identityN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot \left(a \cdot \left(-1 \cdot a\right) + \color{blue}{a}\right)\right)\right) - 1 \]
      21. lower-fma.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot \color{blue}{\mathsf{fma}\left(a, -1 \cdot a, a\right)}\right)\right) - 1 \]
      22. mul-1-negN/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot \mathsf{fma}\left(a, \color{blue}{\mathsf{neg}\left(a\right)}, a\right)\right)\right) - 1 \]
      23. lower-neg.f6499.6

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

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

    if 1.99999999999999995e38 < (+.f64 (pow.f64 (+.f64 (*.f64 a a) (*.f64 b b)) #s(literal 2 binary64)) (*.f64 #s(literal 4 binary64) (+.f64 (*.f64 (*.f64 a a) (-.f64 #s(literal 1 binary64) a)) (*.f64 (*.f64 b b) (+.f64 #s(literal 3 binary64) a)))))

    1. Initial program 68.3%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Add Preprocessing
    3. Applied egg-rr69.9%

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

      \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{3 \cdot {b}^{2}}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{{b}^{2} \cdot 3}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      2. unpow2N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{\left(b \cdot b\right)} \cdot 3, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      3. associate-*l*N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, b \cdot \color{blue}{\left(3 \cdot b\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(3 \cdot b\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, b \cdot \color{blue}{\left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
      7. lower-*.f6499.7

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

      \[\leadsto \frac{1}{\frac{1}{\mathsf{fma}\left(4, \color{blue}{b \cdot \left(b \cdot 3\right)}, \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \color{blue}{\left(b \cdot 3\right)}\right) + \left(\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right)} + \left(\left(a \cdot a + b \cdot b\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\left(a \cdot a + \color{blue}{b \cdot b}\right) \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      4. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \left(a \cdot a + b \cdot b\right) + -1\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \left(a \cdot a + \color{blue}{b \cdot b}\right) + -1\right)}} \]
      6. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \left(\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \color{blue}{\mathsf{fma}\left(a, a, b \cdot b\right)} + -1\right)}} \]
      7. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{4 \cdot \left(b \cdot \left(b \cdot 3\right)\right) + \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)}}} \]
      8. lift-fma.f64N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\mathsf{fma}\left(4, b \cdot \left(b \cdot 3\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)}}} \]
      9. remove-double-div99.7

        \[\leadsto \color{blue}{\mathsf{fma}\left(4, b \cdot \left(b \cdot 3\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)} \]
      10. lift-fma.f64N/A

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right) \leq 2 \cdot 10^{+38}:\\ \;\;\;\;\left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(a \cdot \mathsf{fma}\left(a, -a, a\right)\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b \cdot b, 12, -1\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 92.1% accurate, 3.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.45:\\
\;\;\;\;\mathsf{fma}\left(a \cdot a, a \cdot a, 12 \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\\

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

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


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

    1. Initial program 65.1%

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

      \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    4. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      6. cube-multN/A

        \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      7. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      8. cube-multN/A

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      10. lower-*.f64N/A

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

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

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

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

      \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot {b}^{2}\right)}\right) - 1 \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

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

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

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

      \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot \left(b \cdot b\right)\right)}\right) - 1 \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)\right) - 1 \]
      2. lift-*.f64N/A

        \[\leadsto \left(a \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} + 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)\right) - 1 \]
      3. lift-*.f64N/A

        \[\leadsto \left(\color{blue}{a \cdot \left(a \cdot \left(a \cdot a\right)\right)} + 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)\right) - 1 \]
      4. lift-*.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(3 \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) - 1 \]
      5. lift-*.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot \left(b \cdot b\right)\right)}\right) - 1 \]
      6. lift-*.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + \color{blue}{4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)}\right) - 1 \]
      7. associate--l+N/A

        \[\leadsto \color{blue}{a \cdot \left(a \cdot \left(a \cdot a\right)\right) + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right)} \]
      8. lift-*.f64N/A

        \[\leadsto \color{blue}{a \cdot \left(a \cdot \left(a \cdot a\right)\right)} + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right) \]
      9. lift-*.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right) \]
      11. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot \left(a \cdot a\right) + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot a, a \cdot a, 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right)} \]
      13. sub-negN/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) + \left(\mathsf{neg}\left(1\right)\right)}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, 4 \cdot \color{blue}{\left(3 \cdot \left(b \cdot b\right)\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      16. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{\left(4 \cdot 3\right) \cdot \left(b \cdot b\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{\left(b \cdot b\right) \cdot \left(4 \cdot 3\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      18. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \left(b \cdot b\right) \cdot \left(4 \cdot 3\right) + \color{blue}{-1}\right) \]
      19. lower-fma.f64N/A

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot a, a \cdot a, \mathsf{fma}\left(b \cdot b, 12, -1\right)\right)} \]
    11. Taylor expanded in b around inf

      \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{12 \cdot {b}^{3}}\right) \]
    12. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{{b}^{3} \cdot 12}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{{b}^{3} \cdot 12}\right) \]
      3. cube-multN/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot 12\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \left(b \cdot \color{blue}{{b}^{2}}\right) \cdot 12\right) \]
      5. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{\left(b \cdot {b}^{2}\right)} \cdot 12\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot 12\right) \]
      7. lower-*.f6480.9

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot 12\right) \]
    13. Simplified80.9%

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

    if -1.44999999999999996 < a < 7.70000000000000012e-31

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{b \cdot \left(b \cdot \left(2 \cdot {a}^{2} + {b}^{2}\right)\right)} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      8. lower-*.f64N/A

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

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

        \[\leadsto \left(b \cdot \left(b \cdot \left(\color{blue}{b \cdot b} + 2 \cdot {a}^{2}\right)\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      11. lower-fma.f64N/A

        \[\leadsto \left(b \cdot \left(b \cdot \color{blue}{\mathsf{fma}\left(b, b, 2 \cdot {a}^{2}\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      12. lower-*.f64N/A

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

        \[\leadsto \left(b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 2 \cdot \color{blue}{\left(a \cdot a\right)}\right)\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      14. lower-*.f6499.6

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

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

      \[\leadsto \left(\color{blue}{{b}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    7. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

        \[\leadsto \left(\color{blue}{\left(b \cdot b\right)} \cdot {b}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      5. lower-*.f64N/A

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

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

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

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

      \[\leadsto \left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) + 4 \cdot \color{blue}{\left(3 \cdot {b}^{2}\right)}\right) - 1 \]
    10. Step-by-step derivation
      1. lower-*.f64N/A

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

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

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

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

    if 7.70000000000000012e-31 < a

    1. Initial program 41.5%

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

      \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    4. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      6. cube-multN/A

        \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      7. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      8. cube-multN/A

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      10. lower-*.f64N/A

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      12. lower-*.f6440.0

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

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

      \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot {b}^{2}\right)}\right) - 1 \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

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

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

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

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

      \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + \color{blue}{{b}^{2}}\right) - 1 \]
    10. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + \color{blue}{b \cdot b}\right) - 1 \]
      2. lower-*.f6495.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.45:\\ \;\;\;\;\mathsf{fma}\left(a \cdot a, a \cdot a, 12 \cdot \left(b \cdot \left(b \cdot b\right)\right)\right)\\ \mathbf{elif}\;a \leq 7.7 \cdot 10^{-31}:\\ \;\;\;\;\left(\left(b \cdot b\right) \cdot \left(b \cdot b\right) + 4 \cdot \left(\left(b \cdot b\right) \cdot 3\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot b + a \cdot \left(a \cdot \left(a \cdot a\right)\right)\right) + -1\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 72.3% accurate, 3.2× speedup?

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

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

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


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

    1. Initial program 86.0%

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

      \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    4. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      6. cube-multN/A

        \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      7. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      8. cube-multN/A

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      10. lower-*.f64N/A

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

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

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

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

      \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot {b}^{2}\right)}\right) - 1 \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

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

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

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

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

    if 9.99999999999999967e117 < (*.f64 b b)

    1. Initial program 62.5%

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

      \[\leadsto \color{blue}{{b}^{9}} \]
    4. Step-by-step derivation
      1. lower-pow.f6448.3

        \[\leadsto \color{blue}{{b}^{9}} \]
    5. Simplified48.3%

      \[\leadsto \color{blue}{{b}^{9}} \]
    6. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto {b}^{\color{blue}{\left(3 \cdot 3\right)}} \]
      2. pow-powN/A

        \[\leadsto \color{blue}{{\left({b}^{3}\right)}^{3}} \]
      3. pow3N/A

        \[\leadsto {\color{blue}{\left(\left(b \cdot b\right) \cdot b\right)}}^{3} \]
      4. lift-*.f64N/A

        \[\leadsto {\left(\color{blue}{\left(b \cdot b\right)} \cdot b\right)}^{3} \]
      5. unpow-prod-downN/A

        \[\leadsto \color{blue}{{\left(b \cdot b\right)}^{3} \cdot {b}^{3}} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{{\left(b \cdot b\right)}^{3} \cdot {b}^{3}} \]
      7. lift-*.f64N/A

        \[\leadsto {\color{blue}{\left(b \cdot b\right)}}^{3} \cdot {b}^{3} \]
      8. unpow-prod-downN/A

        \[\leadsto \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)} \cdot {b}^{3} \]
      9. lower-*.f64N/A

        \[\leadsto \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)} \cdot {b}^{3} \]
      10. cube-unmultN/A

        \[\leadsto \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot {b}^{3}\right) \cdot {b}^{3} \]
      11. lift-*.f64N/A

        \[\leadsto \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot {b}^{3}\right) \cdot {b}^{3} \]
      12. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot {b}^{3}\right) \cdot {b}^{3} \]
      13. cube-unmultN/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)}\right) \cdot {b}^{3} \]
      14. lift-*.f64N/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \cdot {b}^{3} \]
      15. lower-*.f64N/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)}\right) \cdot {b}^{3} \]
      16. cube-unmultN/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \]
      17. lift-*.f64N/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
      18. lower-*.f6448.3

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \]
    7. Applied egg-rr48.3%

      \[\leadsto \color{blue}{\left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)} \]
    8. Taylor expanded in b around inf

      \[\leadsto \color{blue}{{b}^{2}} \cdot \left(b \cdot \left(b \cdot b\right)\right) \]
    9. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot \left(b \cdot \left(b \cdot b\right)\right) \]
      2. lower-*.f6448.3

        \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot \left(b \cdot \left(b \cdot b\right)\right) \]
    10. Simplified48.3%

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

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

Alternative 8: 72.3% accurate, 4.0× speedup?

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

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

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


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

    1. Initial program 86.0%

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

      \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    4. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      6. cube-multN/A

        \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      7. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      8. cube-multN/A

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      10. lower-*.f64N/A

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

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

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

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

      \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot {b}^{2}\right)}\right) - 1 \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

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

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

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

      \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot \left(b \cdot b\right)\right)}\right) - 1 \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)\right) - 1 \]
      2. lift-*.f64N/A

        \[\leadsto \left(a \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} + 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)\right) - 1 \]
      3. lift-*.f64N/A

        \[\leadsto \left(\color{blue}{a \cdot \left(a \cdot \left(a \cdot a\right)\right)} + 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)\right) - 1 \]
      4. lift-*.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(3 \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) - 1 \]
      5. lift-*.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot \left(b \cdot b\right)\right)}\right) - 1 \]
      6. lift-*.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + \color{blue}{4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)}\right) - 1 \]
      7. associate--l+N/A

        \[\leadsto \color{blue}{a \cdot \left(a \cdot \left(a \cdot a\right)\right) + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right)} \]
      8. lift-*.f64N/A

        \[\leadsto \color{blue}{a \cdot \left(a \cdot \left(a \cdot a\right)\right)} + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right) \]
      9. lift-*.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right) \]
      11. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot \left(a \cdot a\right) + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot a, a \cdot a, 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right)} \]
      13. sub-negN/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) + \left(\mathsf{neg}\left(1\right)\right)}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, 4 \cdot \color{blue}{\left(3 \cdot \left(b \cdot b\right)\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      16. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{\left(4 \cdot 3\right) \cdot \left(b \cdot b\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{\left(b \cdot b\right) \cdot \left(4 \cdot 3\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      18. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \left(b \cdot b\right) \cdot \left(4 \cdot 3\right) + \color{blue}{-1}\right) \]
      19. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{\mathsf{fma}\left(b \cdot b, 4 \cdot 3, -1\right)}\right) \]
    10. Applied egg-rr88.9%

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

    if 9.99999999999999967e117 < (*.f64 b b)

    1. Initial program 62.5%

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

      \[\leadsto \color{blue}{{b}^{9}} \]
    4. Step-by-step derivation
      1. lower-pow.f6448.3

        \[\leadsto \color{blue}{{b}^{9}} \]
    5. Simplified48.3%

      \[\leadsto \color{blue}{{b}^{9}} \]
    6. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto {b}^{\color{blue}{\left(3 \cdot 3\right)}} \]
      2. pow-powN/A

        \[\leadsto \color{blue}{{\left({b}^{3}\right)}^{3}} \]
      3. pow3N/A

        \[\leadsto {\color{blue}{\left(\left(b \cdot b\right) \cdot b\right)}}^{3} \]
      4. lift-*.f64N/A

        \[\leadsto {\left(\color{blue}{\left(b \cdot b\right)} \cdot b\right)}^{3} \]
      5. unpow-prod-downN/A

        \[\leadsto \color{blue}{{\left(b \cdot b\right)}^{3} \cdot {b}^{3}} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{{\left(b \cdot b\right)}^{3} \cdot {b}^{3}} \]
      7. lift-*.f64N/A

        \[\leadsto {\color{blue}{\left(b \cdot b\right)}}^{3} \cdot {b}^{3} \]
      8. unpow-prod-downN/A

        \[\leadsto \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)} \cdot {b}^{3} \]
      9. lower-*.f64N/A

        \[\leadsto \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)} \cdot {b}^{3} \]
      10. cube-unmultN/A

        \[\leadsto \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot {b}^{3}\right) \cdot {b}^{3} \]
      11. lift-*.f64N/A

        \[\leadsto \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot {b}^{3}\right) \cdot {b}^{3} \]
      12. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot {b}^{3}\right) \cdot {b}^{3} \]
      13. cube-unmultN/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)}\right) \cdot {b}^{3} \]
      14. lift-*.f64N/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \cdot {b}^{3} \]
      15. lower-*.f64N/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)}\right) \cdot {b}^{3} \]
      16. cube-unmultN/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \]
      17. lift-*.f64N/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
      18. lower-*.f6448.3

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \]
    7. Applied egg-rr48.3%

      \[\leadsto \color{blue}{\left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)} \]
    8. Taylor expanded in b around inf

      \[\leadsto \color{blue}{{b}^{2}} \cdot \left(b \cdot \left(b \cdot b\right)\right) \]
    9. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot \left(b \cdot \left(b \cdot b\right)\right) \]
      2. lower-*.f6448.3

        \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot \left(b \cdot \left(b \cdot b\right)\right) \]
    10. Simplified48.3%

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

Alternative 9: 72.2% accurate, 4.1× speedup?

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

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

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


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

    1. Initial program 86.0%

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

      \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    4. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      6. cube-multN/A

        \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      7. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      8. cube-multN/A

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      10. lower-*.f64N/A

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

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

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

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

      \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot {b}^{2}\right)}\right) - 1 \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

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

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

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

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

      \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + \color{blue}{{b}^{2}}\right) - 1 \]
    10. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + \color{blue}{b \cdot b}\right) - 1 \]
      2. lower-*.f6488.8

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

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

    if 9.99999999999999967e117 < (*.f64 b b)

    1. Initial program 62.5%

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

      \[\leadsto \color{blue}{{b}^{9}} \]
    4. Step-by-step derivation
      1. lower-pow.f6448.3

        \[\leadsto \color{blue}{{b}^{9}} \]
    5. Simplified48.3%

      \[\leadsto \color{blue}{{b}^{9}} \]
    6. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto {b}^{\color{blue}{\left(3 \cdot 3\right)}} \]
      2. pow-powN/A

        \[\leadsto \color{blue}{{\left({b}^{3}\right)}^{3}} \]
      3. pow3N/A

        \[\leadsto {\color{blue}{\left(\left(b \cdot b\right) \cdot b\right)}}^{3} \]
      4. lift-*.f64N/A

        \[\leadsto {\left(\color{blue}{\left(b \cdot b\right)} \cdot b\right)}^{3} \]
      5. unpow-prod-downN/A

        \[\leadsto \color{blue}{{\left(b \cdot b\right)}^{3} \cdot {b}^{3}} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{{\left(b \cdot b\right)}^{3} \cdot {b}^{3}} \]
      7. lift-*.f64N/A

        \[\leadsto {\color{blue}{\left(b \cdot b\right)}}^{3} \cdot {b}^{3} \]
      8. unpow-prod-downN/A

        \[\leadsto \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)} \cdot {b}^{3} \]
      9. lower-*.f64N/A

        \[\leadsto \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)} \cdot {b}^{3} \]
      10. cube-unmultN/A

        \[\leadsto \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot {b}^{3}\right) \cdot {b}^{3} \]
      11. lift-*.f64N/A

        \[\leadsto \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot {b}^{3}\right) \cdot {b}^{3} \]
      12. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot {b}^{3}\right) \cdot {b}^{3} \]
      13. cube-unmultN/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)}\right) \cdot {b}^{3} \]
      14. lift-*.f64N/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \cdot {b}^{3} \]
      15. lower-*.f64N/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)}\right) \cdot {b}^{3} \]
      16. cube-unmultN/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \]
      17. lift-*.f64N/A

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
      18. lower-*.f6448.3

        \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \]
    7. Applied egg-rr48.3%

      \[\leadsto \color{blue}{\left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)} \]
    8. Taylor expanded in b around inf

      \[\leadsto \color{blue}{{b}^{2}} \cdot \left(b \cdot \left(b \cdot b\right)\right) \]
    9. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot \left(b \cdot \left(b \cdot b\right)\right) \]
      2. lower-*.f6448.3

        \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot \left(b \cdot \left(b \cdot b\right)\right) \]
    10. Simplified48.3%

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

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

Alternative 10: 71.8% accurate, 4.8× speedup?

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

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

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


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

    1. Initial program 86.0%

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

      \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    4. Step-by-step derivation
      1. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      6. cube-multN/A

        \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      7. lower-*.f64N/A

        \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      8. cube-multN/A

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

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      10. lower-*.f64N/A

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

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

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

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

      \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot {b}^{2}\right)}\right) - 1 \]
    7. Step-by-step derivation
      1. lower-*.f64N/A

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

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

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

      \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot \left(b \cdot b\right)\right)}\right) - 1 \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)\right) - 1 \]
      2. lift-*.f64N/A

        \[\leadsto \left(a \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} + 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)\right) - 1 \]
      3. lift-*.f64N/A

        \[\leadsto \left(\color{blue}{a \cdot \left(a \cdot \left(a \cdot a\right)\right)} + 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)\right) - 1 \]
      4. lift-*.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(3 \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) - 1 \]
      5. lift-*.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot \left(b \cdot b\right)\right)}\right) - 1 \]
      6. lift-*.f64N/A

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + \color{blue}{4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)}\right) - 1 \]
      7. associate--l+N/A

        \[\leadsto \color{blue}{a \cdot \left(a \cdot \left(a \cdot a\right)\right) + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right)} \]
      8. lift-*.f64N/A

        \[\leadsto \color{blue}{a \cdot \left(a \cdot \left(a \cdot a\right)\right)} + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right) \]
      9. lift-*.f64N/A

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

        \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right) \]
      11. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot \left(a \cdot a\right) + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot a, a \cdot a, 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right)} \]
      13. sub-negN/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) + \left(\mathsf{neg}\left(1\right)\right)}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      15. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, 4 \cdot \color{blue}{\left(3 \cdot \left(b \cdot b\right)\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      16. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{\left(4 \cdot 3\right) \cdot \left(b \cdot b\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      17. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{\left(b \cdot b\right) \cdot \left(4 \cdot 3\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
      18. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \left(b \cdot b\right) \cdot \left(4 \cdot 3\right) + \color{blue}{-1}\right) \]
      19. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{\mathsf{fma}\left(b \cdot b, 4 \cdot 3, -1\right)}\right) \]
    10. Applied egg-rr88.9%

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

      \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{-1}\right) \]
    12. Step-by-step derivation
      1. Simplified88.3%

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

      if 9.99999999999999967e117 < (*.f64 b b)

      1. Initial program 62.5%

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

        \[\leadsto \color{blue}{{b}^{9}} \]
      4. Step-by-step derivation
        1. lower-pow.f6448.3

          \[\leadsto \color{blue}{{b}^{9}} \]
      5. Simplified48.3%

        \[\leadsto \color{blue}{{b}^{9}} \]
      6. Step-by-step derivation
        1. metadata-evalN/A

          \[\leadsto {b}^{\color{blue}{\left(3 \cdot 3\right)}} \]
        2. pow-powN/A

          \[\leadsto \color{blue}{{\left({b}^{3}\right)}^{3}} \]
        3. pow3N/A

          \[\leadsto {\color{blue}{\left(\left(b \cdot b\right) \cdot b\right)}}^{3} \]
        4. lift-*.f64N/A

          \[\leadsto {\left(\color{blue}{\left(b \cdot b\right)} \cdot b\right)}^{3} \]
        5. unpow-prod-downN/A

          \[\leadsto \color{blue}{{\left(b \cdot b\right)}^{3} \cdot {b}^{3}} \]
        6. lower-*.f64N/A

          \[\leadsto \color{blue}{{\left(b \cdot b\right)}^{3} \cdot {b}^{3}} \]
        7. lift-*.f64N/A

          \[\leadsto {\color{blue}{\left(b \cdot b\right)}}^{3} \cdot {b}^{3} \]
        8. unpow-prod-downN/A

          \[\leadsto \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)} \cdot {b}^{3} \]
        9. lower-*.f64N/A

          \[\leadsto \color{blue}{\left({b}^{3} \cdot {b}^{3}\right)} \cdot {b}^{3} \]
        10. cube-unmultN/A

          \[\leadsto \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot {b}^{3}\right) \cdot {b}^{3} \]
        11. lift-*.f64N/A

          \[\leadsto \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot {b}^{3}\right) \cdot {b}^{3} \]
        12. lower-*.f64N/A

          \[\leadsto \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot {b}^{3}\right) \cdot {b}^{3} \]
        13. cube-unmultN/A

          \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)}\right) \cdot {b}^{3} \]
        14. lift-*.f64N/A

          \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) \cdot {b}^{3} \]
        15. lower-*.f64N/A

          \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)}\right) \cdot {b}^{3} \]
        16. cube-unmultN/A

          \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \]
        17. lift-*.f64N/A

          \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
        18. lower-*.f6448.3

          \[\leadsto \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \]
      7. Applied egg-rr48.3%

        \[\leadsto \color{blue}{\left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)\right) \cdot \left(b \cdot \left(b \cdot b\right)\right)} \]
      8. Taylor expanded in b around inf

        \[\leadsto \color{blue}{{b}^{2}} \cdot \left(b \cdot \left(b \cdot b\right)\right) \]
      9. Step-by-step derivation
        1. unpow2N/A

          \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot \left(b \cdot \left(b \cdot b\right)\right) \]
        2. lower-*.f6448.3

          \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot \left(b \cdot \left(b \cdot b\right)\right) \]
      10. Simplified48.3%

        \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot \left(b \cdot \left(b \cdot b\right)\right) \]
    13. Recombined 2 regimes into one program.
    14. Add Preprocessing

    Alternative 11: 71.6% accurate, 5.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \cdot b \leq 3 \cdot 10^{+193}:\\ \;\;\;\;\mathsf{fma}\left(a \cdot a, a \cdot a, -1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot \left(b \cdot b\right)\right) \cdot 16\\ \end{array} \end{array} \]
    (FPCore (a b)
     :precision binary64
     (if (<= (* b b) 3e+193) (fma (* a a) (* a a) -1.0) (* (* b (* b b)) 16.0)))
    double code(double a, double b) {
    	double tmp;
    	if ((b * b) <= 3e+193) {
    		tmp = fma((a * a), (a * a), -1.0);
    	} else {
    		tmp = (b * (b * b)) * 16.0;
    	}
    	return tmp;
    }
    
    function code(a, b)
    	tmp = 0.0
    	if (Float64(b * b) <= 3e+193)
    		tmp = fma(Float64(a * a), Float64(a * a), -1.0);
    	else
    		tmp = Float64(Float64(b * Float64(b * b)) * 16.0);
    	end
    	return tmp
    end
    
    code[a_, b_] := If[LessEqual[N[(b * b), $MachinePrecision], 3e+193], N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision] + -1.0), $MachinePrecision], N[(N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision] * 16.0), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \cdot b \leq 3 \cdot 10^{+193}:\\
    \;\;\;\;\mathsf{fma}\left(a \cdot a, a \cdot a, -1\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(b \cdot \left(b \cdot b\right)\right) \cdot 16\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 b b) < 3e193

      1. Initial program 83.1%

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

        \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      4. Step-by-step derivation
        1. metadata-evalN/A

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

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

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

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

          \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        6. cube-multN/A

          \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        7. lower-*.f64N/A

          \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        8. cube-multN/A

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

          \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        10. lower-*.f64N/A

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

          \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        12. lower-*.f6473.0

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

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

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot {b}^{2}\right)}\right) - 1 \]
      7. Step-by-step derivation
        1. lower-*.f64N/A

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

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

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

        \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot \left(b \cdot b\right)\right)}\right) - 1 \]
      9. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)\right) - 1 \]
        2. lift-*.f64N/A

          \[\leadsto \left(a \cdot \color{blue}{\left(a \cdot \left(a \cdot a\right)\right)} + 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)\right) - 1 \]
        3. lift-*.f64N/A

          \[\leadsto \left(\color{blue}{a \cdot \left(a \cdot \left(a \cdot a\right)\right)} + 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)\right) - 1 \]
        4. lift-*.f64N/A

          \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \left(3 \cdot \color{blue}{\left(b \cdot b\right)}\right)\right) - 1 \]
        5. lift-*.f64N/A

          \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + 4 \cdot \color{blue}{\left(3 \cdot \left(b \cdot b\right)\right)}\right) - 1 \]
        6. lift-*.f64N/A

          \[\leadsto \left(a \cdot \left(a \cdot \left(a \cdot a\right)\right) + \color{blue}{4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)}\right) - 1 \]
        7. associate--l+N/A

          \[\leadsto \color{blue}{a \cdot \left(a \cdot \left(a \cdot a\right)\right) + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right)} \]
        8. lift-*.f64N/A

          \[\leadsto \color{blue}{a \cdot \left(a \cdot \left(a \cdot a\right)\right)} + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right) \]
        9. lift-*.f64N/A

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

          \[\leadsto \color{blue}{\left(a \cdot a\right) \cdot \left(a \cdot a\right)} + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right) \]
        11. lift-*.f64N/A

          \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot \left(a \cdot a\right) + \left(4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right) \]
        12. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot a, a \cdot a, 4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) - 1\right)} \]
        13. sub-negN/A

          \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{4 \cdot \left(3 \cdot \left(b \cdot b\right)\right) + \left(\mathsf{neg}\left(1\right)\right)}\right) \]
        14. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{4 \cdot \left(3 \cdot \left(b \cdot b\right)\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
        15. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, 4 \cdot \color{blue}{\left(3 \cdot \left(b \cdot b\right)\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
        16. associate-*r*N/A

          \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{\left(4 \cdot 3\right) \cdot \left(b \cdot b\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
        17. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{\left(b \cdot b\right) \cdot \left(4 \cdot 3\right)} + \left(\mathsf{neg}\left(1\right)\right)\right) \]
        18. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \left(b \cdot b\right) \cdot \left(4 \cdot 3\right) + \color{blue}{-1}\right) \]
        19. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{\mathsf{fma}\left(b \cdot b, 4 \cdot 3, -1\right)}\right) \]
      10. Applied egg-rr87.0%

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

        \[\leadsto \mathsf{fma}\left(a \cdot a, a \cdot a, \color{blue}{-1}\right) \]
      12. Step-by-step derivation
        1. Simplified86.4%

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

        if 3e193 < (*.f64 b b)

        1. Initial program 64.0%

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

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

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

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

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

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

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

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

            \[\leadsto \left(\color{blue}{b \cdot \left(b \cdot \left(2 \cdot {a}^{2} + {b}^{2}\right)\right)} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          8. lower-*.f64N/A

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

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

            \[\leadsto \left(b \cdot \left(b \cdot \left(\color{blue}{b \cdot b} + 2 \cdot {a}^{2}\right)\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          11. lower-fma.f64N/A

            \[\leadsto \left(b \cdot \left(b \cdot \color{blue}{\mathsf{fma}\left(b, b, 2 \cdot {a}^{2}\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          12. lower-*.f64N/A

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

            \[\leadsto \left(b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 2 \cdot \color{blue}{\left(a \cdot a\right)}\right)\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          14. lower-*.f6464.0

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

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

          \[\leadsto \left(\color{blue}{{b}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        7. Step-by-step derivation
          1. metadata-evalN/A

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

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

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

            \[\leadsto \left(\color{blue}{\left(b \cdot b\right)} \cdot {b}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          5. lower-*.f64N/A

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

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

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

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

          \[\leadsto \color{blue}{16 \cdot {b}^{3}} \]
        10. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \color{blue}{{b}^{3} \cdot 16} \]
          2. lower-*.f64N/A

            \[\leadsto \color{blue}{{b}^{3} \cdot 16} \]
          3. cube-multN/A

            \[\leadsto \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot 16 \]
          4. unpow2N/A

            \[\leadsto \left(b \cdot \color{blue}{{b}^{2}}\right) \cdot 16 \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(b \cdot {b}^{2}\right)} \cdot 16 \]
          6. unpow2N/A

            \[\leadsto \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot 16 \]
          7. lower-*.f6449.4

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

          \[\leadsto \color{blue}{\left(b \cdot \left(b \cdot b\right)\right) \cdot 16} \]
      13. Recombined 2 regimes into one program.
      14. Add Preprocessing

      Alternative 12: 47.4% accurate, 6.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 52000:\\ \;\;\;\;\mathsf{fma}\left(12, b \cdot \left(b \cdot b\right), -1\right)\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \left(b \cdot \left(a \cdot b\right)\right)\\ \end{array} \end{array} \]
      (FPCore (a b)
       :precision binary64
       (if (<= a 52000.0) (fma 12.0 (* b (* b b)) -1.0) (* 4.0 (* b (* a b)))))
      double code(double a, double b) {
      	double tmp;
      	if (a <= 52000.0) {
      		tmp = fma(12.0, (b * (b * b)), -1.0);
      	} else {
      		tmp = 4.0 * (b * (a * b));
      	}
      	return tmp;
      }
      
      function code(a, b)
      	tmp = 0.0
      	if (a <= 52000.0)
      		tmp = fma(12.0, Float64(b * Float64(b * b)), -1.0);
      	else
      		tmp = Float64(4.0 * Float64(b * Float64(a * b)));
      	end
      	return tmp
      end
      
      code[a_, b_] := If[LessEqual[a, 52000.0], N[(12.0 * N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(4.0 * N[(b * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;a \leq 52000:\\
      \;\;\;\;\mathsf{fma}\left(12, b \cdot \left(b \cdot b\right), -1\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;4 \cdot \left(b \cdot \left(a \cdot b\right)\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if a < 52000

        1. Initial program 87.5%

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

          \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        4. Step-by-step derivation
          1. metadata-evalN/A

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

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

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

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          6. cube-multN/A

            \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          7. lower-*.f64N/A

            \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          8. cube-multN/A

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          10. lower-*.f64N/A

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

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

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

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

          \[\leadsto \color{blue}{12 \cdot {b}^{3} - 1} \]
        7. Step-by-step derivation
          1. sub-negN/A

            \[\leadsto \color{blue}{12 \cdot {b}^{3} + \left(\mathsf{neg}\left(1\right)\right)} \]
          2. metadata-evalN/A

            \[\leadsto 12 \cdot {b}^{3} + \color{blue}{-1} \]
          3. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(12, {b}^{3}, -1\right)} \]
          4. cube-multN/A

            \[\leadsto \mathsf{fma}\left(12, \color{blue}{b \cdot \left(b \cdot b\right)}, -1\right) \]
          5. unpow2N/A

            \[\leadsto \mathsf{fma}\left(12, b \cdot \color{blue}{{b}^{2}}, -1\right) \]
          6. lower-*.f64N/A

            \[\leadsto \mathsf{fma}\left(12, \color{blue}{b \cdot {b}^{2}}, -1\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{fma}\left(12, b \cdot \color{blue}{\left(b \cdot b\right)}, -1\right) \]
          8. lower-*.f6448.1

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

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

        if 52000 < a

        1. Initial program 36.2%

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

          \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        4. Step-by-step derivation
          1. metadata-evalN/A

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

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

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

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          6. cube-multN/A

            \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          7. lower-*.f64N/A

            \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          8. cube-multN/A

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          10. lower-*.f64N/A

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          12. lower-*.f6434.6

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

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

          \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
        7. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
          2. lower-*.f64N/A

            \[\leadsto 4 \cdot \color{blue}{\left({b}^{3} \cdot \left(3 + a\right)\right)} \]
          3. cube-multN/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot \left(3 + a\right)\right) \]
          4. unpow2N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{{b}^{2}}\right) \cdot \left(3 + a\right)\right) \]
          5. lower-*.f64N/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot {b}^{2}\right)} \cdot \left(3 + a\right)\right) \]
          6. unpow2N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
          7. lower-*.f64N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
          8. lower-+.f6419.4

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

          \[\leadsto \color{blue}{4 \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(3 + a\right)\right)} \]
        9. Taylor expanded in a around inf

          \[\leadsto 4 \cdot \color{blue}{\left(a \cdot {b}^{2}\right)} \]
        10. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto 4 \cdot \color{blue}{\left({b}^{2} \cdot a\right)} \]
          2. unpow2N/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot b\right)} \cdot a\right) \]
          3. associate-*l*N/A

            \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(b \cdot a\right)\right)} \]
          4. *-commutativeN/A

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(a \cdot b\right)}\right) \]
          5. lower-*.f64N/A

            \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(a \cdot b\right)\right)} \]
          6. *-commutativeN/A

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot a\right)}\right) \]
          7. lower-*.f6437.2

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot a\right)}\right) \]
        11. Simplified37.2%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 52000:\\ \;\;\;\;\mathsf{fma}\left(12, b \cdot \left(b \cdot b\right), -1\right)\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \left(b \cdot \left(a \cdot b\right)\right)\\ \end{array} \]
      5. Add Preprocessing

      Alternative 13: 24.2% accurate, 7.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 23000000:\\ \;\;\;\;\left(b \cdot \left(b \cdot b\right)\right) \cdot 16\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \left(b \cdot \left(a \cdot b\right)\right)\\ \end{array} \end{array} \]
      (FPCore (a b)
       :precision binary64
       (if (<= a 23000000.0) (* (* b (* b b)) 16.0) (* 4.0 (* b (* a b)))))
      double code(double a, double b) {
      	double tmp;
      	if (a <= 23000000.0) {
      		tmp = (b * (b * b)) * 16.0;
      	} else {
      		tmp = 4.0 * (b * (a * b));
      	}
      	return tmp;
      }
      
      real(8) function code(a, b)
          real(8), intent (in) :: a
          real(8), intent (in) :: b
          real(8) :: tmp
          if (a <= 23000000.0d0) then
              tmp = (b * (b * b)) * 16.0d0
          else
              tmp = 4.0d0 * (b * (a * b))
          end if
          code = tmp
      end function
      
      public static double code(double a, double b) {
      	double tmp;
      	if (a <= 23000000.0) {
      		tmp = (b * (b * b)) * 16.0;
      	} else {
      		tmp = 4.0 * (b * (a * b));
      	}
      	return tmp;
      }
      
      def code(a, b):
      	tmp = 0
      	if a <= 23000000.0:
      		tmp = (b * (b * b)) * 16.0
      	else:
      		tmp = 4.0 * (b * (a * b))
      	return tmp
      
      function code(a, b)
      	tmp = 0.0
      	if (a <= 23000000.0)
      		tmp = Float64(Float64(b * Float64(b * b)) * 16.0);
      	else
      		tmp = Float64(4.0 * Float64(b * Float64(a * b)));
      	end
      	return tmp
      end
      
      function tmp_2 = code(a, b)
      	tmp = 0.0;
      	if (a <= 23000000.0)
      		tmp = (b * (b * b)) * 16.0;
      	else
      		tmp = 4.0 * (b * (a * b));
      	end
      	tmp_2 = tmp;
      end
      
      code[a_, b_] := If[LessEqual[a, 23000000.0], N[(N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision] * 16.0), $MachinePrecision], N[(4.0 * N[(b * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;a \leq 23000000:\\
      \;\;\;\;\left(b \cdot \left(b \cdot b\right)\right) \cdot 16\\
      
      \mathbf{else}:\\
      \;\;\;\;4 \cdot \left(b \cdot \left(a \cdot b\right)\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if a < 2.3e7

        1. Initial program 87.5%

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

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

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

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

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

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

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

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

            \[\leadsto \left(\color{blue}{b \cdot \left(b \cdot \left(2 \cdot {a}^{2} + {b}^{2}\right)\right)} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          8. lower-*.f64N/A

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

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

            \[\leadsto \left(b \cdot \left(b \cdot \left(\color{blue}{b \cdot b} + 2 \cdot {a}^{2}\right)\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          11. lower-fma.f64N/A

            \[\leadsto \left(b \cdot \left(b \cdot \color{blue}{\mathsf{fma}\left(b, b, 2 \cdot {a}^{2}\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          12. lower-*.f64N/A

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

            \[\leadsto \left(b \cdot \left(b \cdot \mathsf{fma}\left(b, b, 2 \cdot \color{blue}{\left(a \cdot a\right)}\right)\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          14. lower-*.f6480.0

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

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

          \[\leadsto \left(\color{blue}{{b}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        7. Step-by-step derivation
          1. metadata-evalN/A

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

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

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

            \[\leadsto \left(\color{blue}{\left(b \cdot b\right)} \cdot {b}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          5. lower-*.f64N/A

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

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

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

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

          \[\leadsto \color{blue}{16 \cdot {b}^{3}} \]
        10. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \color{blue}{{b}^{3} \cdot 16} \]
          2. lower-*.f64N/A

            \[\leadsto \color{blue}{{b}^{3} \cdot 16} \]
          3. cube-multN/A

            \[\leadsto \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot 16 \]
          4. unpow2N/A

            \[\leadsto \left(b \cdot \color{blue}{{b}^{2}}\right) \cdot 16 \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(b \cdot {b}^{2}\right)} \cdot 16 \]
          6. unpow2N/A

            \[\leadsto \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot 16 \]
          7. lower-*.f6420.3

            \[\leadsto \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot 16 \]
        11. Simplified20.3%

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

        if 2.3e7 < a

        1. Initial program 36.2%

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

          \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        4. Step-by-step derivation
          1. metadata-evalN/A

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

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

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

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          6. cube-multN/A

            \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          7. lower-*.f64N/A

            \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          8. cube-multN/A

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          10. lower-*.f64N/A

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          12. lower-*.f6434.6

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

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

          \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
        7. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
          2. lower-*.f64N/A

            \[\leadsto 4 \cdot \color{blue}{\left({b}^{3} \cdot \left(3 + a\right)\right)} \]
          3. cube-multN/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot \left(3 + a\right)\right) \]
          4. unpow2N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{{b}^{2}}\right) \cdot \left(3 + a\right)\right) \]
          5. lower-*.f64N/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot {b}^{2}\right)} \cdot \left(3 + a\right)\right) \]
          6. unpow2N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
          7. lower-*.f64N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
          8. lower-+.f6419.4

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

          \[\leadsto \color{blue}{4 \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(3 + a\right)\right)} \]
        9. Taylor expanded in a around inf

          \[\leadsto 4 \cdot \color{blue}{\left(a \cdot {b}^{2}\right)} \]
        10. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto 4 \cdot \color{blue}{\left({b}^{2} \cdot a\right)} \]
          2. unpow2N/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot b\right)} \cdot a\right) \]
          3. associate-*l*N/A

            \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(b \cdot a\right)\right)} \]
          4. *-commutativeN/A

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(a \cdot b\right)}\right) \]
          5. lower-*.f64N/A

            \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(a \cdot b\right)\right)} \]
          6. *-commutativeN/A

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot a\right)}\right) \]
          7. lower-*.f6437.2

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot a\right)}\right) \]
        11. Simplified37.2%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 23000000:\\ \;\;\;\;\left(b \cdot \left(b \cdot b\right)\right) \cdot 16\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \left(b \cdot \left(a \cdot b\right)\right)\\ \end{array} \]
      5. Add Preprocessing

      Alternative 14: 24.2% accurate, 7.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 23000000:\\ \;\;\;\;12 \cdot \left(b \cdot \left(b \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \left(b \cdot \left(a \cdot b\right)\right)\\ \end{array} \end{array} \]
      (FPCore (a b)
       :precision binary64
       (if (<= a 23000000.0) (* 12.0 (* b (* b b))) (* 4.0 (* b (* a b)))))
      double code(double a, double b) {
      	double tmp;
      	if (a <= 23000000.0) {
      		tmp = 12.0 * (b * (b * b));
      	} else {
      		tmp = 4.0 * (b * (a * b));
      	}
      	return tmp;
      }
      
      real(8) function code(a, b)
          real(8), intent (in) :: a
          real(8), intent (in) :: b
          real(8) :: tmp
          if (a <= 23000000.0d0) then
              tmp = 12.0d0 * (b * (b * b))
          else
              tmp = 4.0d0 * (b * (a * b))
          end if
          code = tmp
      end function
      
      public static double code(double a, double b) {
      	double tmp;
      	if (a <= 23000000.0) {
      		tmp = 12.0 * (b * (b * b));
      	} else {
      		tmp = 4.0 * (b * (a * b));
      	}
      	return tmp;
      }
      
      def code(a, b):
      	tmp = 0
      	if a <= 23000000.0:
      		tmp = 12.0 * (b * (b * b))
      	else:
      		tmp = 4.0 * (b * (a * b))
      	return tmp
      
      function code(a, b)
      	tmp = 0.0
      	if (a <= 23000000.0)
      		tmp = Float64(12.0 * Float64(b * Float64(b * b)));
      	else
      		tmp = Float64(4.0 * Float64(b * Float64(a * b)));
      	end
      	return tmp
      end
      
      function tmp_2 = code(a, b)
      	tmp = 0.0;
      	if (a <= 23000000.0)
      		tmp = 12.0 * (b * (b * b));
      	else
      		tmp = 4.0 * (b * (a * b));
      	end
      	tmp_2 = tmp;
      end
      
      code[a_, b_] := If[LessEqual[a, 23000000.0], N[(12.0 * N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(4.0 * N[(b * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;a \leq 23000000:\\
      \;\;\;\;12 \cdot \left(b \cdot \left(b \cdot b\right)\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;4 \cdot \left(b \cdot \left(a \cdot b\right)\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if a < 2.3e7

        1. Initial program 87.5%

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

          \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        4. Step-by-step derivation
          1. metadata-evalN/A

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

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

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

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          6. cube-multN/A

            \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          7. lower-*.f64N/A

            \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          8. cube-multN/A

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          10. lower-*.f64N/A

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

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

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

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

          \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
        7. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
          2. lower-*.f64N/A

            \[\leadsto 4 \cdot \color{blue}{\left({b}^{3} \cdot \left(3 + a\right)\right)} \]
          3. cube-multN/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot \left(3 + a\right)\right) \]
          4. unpow2N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{{b}^{2}}\right) \cdot \left(3 + a\right)\right) \]
          5. lower-*.f64N/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot {b}^{2}\right)} \cdot \left(3 + a\right)\right) \]
          6. unpow2N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
          7. lower-*.f64N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
          8. lower-+.f6420.8

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

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

          \[\leadsto \color{blue}{12 \cdot {b}^{3}} \]
        10. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \color{blue}{12 \cdot {b}^{3}} \]
          2. cube-multN/A

            \[\leadsto 12 \cdot \color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \]
          3. unpow2N/A

            \[\leadsto 12 \cdot \left(b \cdot \color{blue}{{b}^{2}}\right) \]
          4. lower-*.f64N/A

            \[\leadsto 12 \cdot \color{blue}{\left(b \cdot {b}^{2}\right)} \]
          5. unpow2N/A

            \[\leadsto 12 \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
          6. lower-*.f6420.3

            \[\leadsto 12 \cdot \left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \]
        11. Simplified20.3%

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

        if 2.3e7 < a

        1. Initial program 36.2%

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

          \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        4. Step-by-step derivation
          1. metadata-evalN/A

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

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

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

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          6. cube-multN/A

            \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          7. lower-*.f64N/A

            \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          8. cube-multN/A

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          10. lower-*.f64N/A

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          12. lower-*.f6434.6

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

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

          \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
        7. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
          2. lower-*.f64N/A

            \[\leadsto 4 \cdot \color{blue}{\left({b}^{3} \cdot \left(3 + a\right)\right)} \]
          3. cube-multN/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot \left(3 + a\right)\right) \]
          4. unpow2N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{{b}^{2}}\right) \cdot \left(3 + a\right)\right) \]
          5. lower-*.f64N/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot {b}^{2}\right)} \cdot \left(3 + a\right)\right) \]
          6. unpow2N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
          7. lower-*.f64N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
          8. lower-+.f6419.4

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

          \[\leadsto \color{blue}{4 \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(3 + a\right)\right)} \]
        9. Taylor expanded in a around inf

          \[\leadsto 4 \cdot \color{blue}{\left(a \cdot {b}^{2}\right)} \]
        10. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto 4 \cdot \color{blue}{\left({b}^{2} \cdot a\right)} \]
          2. unpow2N/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot b\right)} \cdot a\right) \]
          3. associate-*l*N/A

            \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(b \cdot a\right)\right)} \]
          4. *-commutativeN/A

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(a \cdot b\right)}\right) \]
          5. lower-*.f64N/A

            \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(a \cdot b\right)\right)} \]
          6. *-commutativeN/A

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot a\right)}\right) \]
          7. lower-*.f6437.2

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot a\right)}\right) \]
        11. Simplified37.2%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 23000000:\\ \;\;\;\;12 \cdot \left(b \cdot \left(b \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \left(b \cdot \left(a \cdot b\right)\right)\\ \end{array} \]
      5. Add Preprocessing

      Alternative 15: 31.2% accurate, 7.0× speedup?

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

        1. Initial program 87.1%

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

          \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        4. Step-by-step derivation
          1. metadata-evalN/A

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

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

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

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          6. cube-multN/A

            \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          7. lower-*.f64N/A

            \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          8. cube-multN/A

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          10. lower-*.f64N/A

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

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

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

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

          \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
        7. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
          2. lower-*.f64N/A

            \[\leadsto 4 \cdot \color{blue}{\left({b}^{3} \cdot \left(3 + a\right)\right)} \]
          3. cube-multN/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot \left(3 + a\right)\right) \]
          4. unpow2N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{{b}^{2}}\right) \cdot \left(3 + a\right)\right) \]
          5. lower-*.f64N/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot {b}^{2}\right)} \cdot \left(3 + a\right)\right) \]
          6. unpow2N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
          7. lower-*.f64N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
          8. lower-+.f6420.7

            \[\leadsto 4 \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(3 + a\right)}\right) \]
        8. Simplified20.7%

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

          \[\leadsto 4 \cdot \color{blue}{\left(3 \cdot {b}^{2}\right)} \]
        10. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto 4 \cdot \color{blue}{\left({b}^{2} \cdot 3\right)} \]
          2. unpow2N/A

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

            \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right)} \]
          4. *-commutativeN/A

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(3 \cdot b\right)}\right) \]
          5. lower-*.f64N/A

            \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(3 \cdot b\right)\right)} \]
          6. *-commutativeN/A

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot 3\right)}\right) \]
          7. lower-*.f6432.3

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot 3\right)}\right) \]
        11. Simplified32.3%

          \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right)} \]
        12. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot 3\right)}\right) \]
          2. lift-*.f64N/A

            \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right)} \]
          3. *-commutativeN/A

            \[\leadsto \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right) \cdot 4} \]
          4. lift-*.f64N/A

            \[\leadsto \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right)} \cdot 4 \]
          5. lift-*.f64N/A

            \[\leadsto \left(b \cdot \color{blue}{\left(b \cdot 3\right)}\right) \cdot 4 \]
          6. associate-*r*N/A

            \[\leadsto \color{blue}{\left(\left(b \cdot b\right) \cdot 3\right)} \cdot 4 \]
          7. lift-*.f64N/A

            \[\leadsto \left(\color{blue}{\left(b \cdot b\right)} \cdot 3\right) \cdot 4 \]
          8. associate-*l*N/A

            \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(3 \cdot 4\right)} \]
          9. metadata-evalN/A

            \[\leadsto \left(b \cdot b\right) \cdot \color{blue}{12} \]
          10. lift-*.f64N/A

            \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot 12 \]
          11. associate-*l*N/A

            \[\leadsto \color{blue}{b \cdot \left(b \cdot 12\right)} \]
          12. *-commutativeN/A

            \[\leadsto \color{blue}{\left(b \cdot 12\right) \cdot b} \]
          13. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(b \cdot 12\right) \cdot b} \]
          14. lower-*.f6432.3

            \[\leadsto \color{blue}{\left(b \cdot 12\right)} \cdot b \]
        13. Applied egg-rr32.3%

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

        if 7.70000000000000012e-31 < a

        1. Initial program 41.5%

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

          \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        4. Step-by-step derivation
          1. metadata-evalN/A

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

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

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

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          6. cube-multN/A

            \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          7. lower-*.f64N/A

            \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          8. cube-multN/A

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          10. lower-*.f64N/A

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

            \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          12. lower-*.f6440.0

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

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

          \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
        7. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
          2. lower-*.f64N/A

            \[\leadsto 4 \cdot \color{blue}{\left({b}^{3} \cdot \left(3 + a\right)\right)} \]
          3. cube-multN/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot \left(3 + a\right)\right) \]
          4. unpow2N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{{b}^{2}}\right) \cdot \left(3 + a\right)\right) \]
          5. lower-*.f64N/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot {b}^{2}\right)} \cdot \left(3 + a\right)\right) \]
          6. unpow2N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
          7. lower-*.f64N/A

            \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
          8. lower-+.f6419.7

            \[\leadsto 4 \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \color{blue}{\left(3 + a\right)}\right) \]
        8. Simplified19.7%

          \[\leadsto \color{blue}{4 \cdot \left(\left(b \cdot \left(b \cdot b\right)\right) \cdot \left(3 + a\right)\right)} \]
        9. Taylor expanded in a around inf

          \[\leadsto 4 \cdot \color{blue}{\left(a \cdot {b}^{2}\right)} \]
        10. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto 4 \cdot \color{blue}{\left({b}^{2} \cdot a\right)} \]
          2. unpow2N/A

            \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot b\right)} \cdot a\right) \]
          3. associate-*l*N/A

            \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(b \cdot a\right)\right)} \]
          4. *-commutativeN/A

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(a \cdot b\right)}\right) \]
          5. lower-*.f64N/A

            \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(a \cdot b\right)\right)} \]
          6. *-commutativeN/A

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot a\right)}\right) \]
          7. lower-*.f6436.0

            \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot a\right)}\right) \]
        11. Simplified36.0%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 7.7 \cdot 10^{-31}:\\ \;\;\;\;b \cdot \left(b \cdot 12\right)\\ \mathbf{else}:\\ \;\;\;\;4 \cdot \left(b \cdot \left(a \cdot b\right)\right)\\ \end{array} \]
      5. Add Preprocessing

      Alternative 16: 27.9% accurate, 14.1× speedup?

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

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

        \[\leadsto \left(\color{blue}{{a}^{4}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      4. Step-by-step derivation
        1. metadata-evalN/A

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

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

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

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

          \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        6. cube-multN/A

          \[\leadsto \left(a \cdot \color{blue}{{a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        7. lower-*.f64N/A

          \[\leadsto \left(\color{blue}{a \cdot {a}^{3}} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        8. cube-multN/A

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

          \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{{a}^{2}}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        10. lower-*.f64N/A

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

          \[\leadsto \left(a \cdot \left(a \cdot \color{blue}{\left(a \cdot a\right)}\right) + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
        12. lower-*.f6464.8

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

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

        \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
      7. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \color{blue}{4 \cdot \left({b}^{3} \cdot \left(3 + a\right)\right)} \]
        2. lower-*.f64N/A

          \[\leadsto 4 \cdot \color{blue}{\left({b}^{3} \cdot \left(3 + a\right)\right)} \]
        3. cube-multN/A

          \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot \left(b \cdot b\right)\right)} \cdot \left(3 + a\right)\right) \]
        4. unpow2N/A

          \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{{b}^{2}}\right) \cdot \left(3 + a\right)\right) \]
        5. lower-*.f64N/A

          \[\leadsto 4 \cdot \left(\color{blue}{\left(b \cdot {b}^{2}\right)} \cdot \left(3 + a\right)\right) \]
        6. unpow2N/A

          \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
        7. lower-*.f64N/A

          \[\leadsto 4 \cdot \left(\left(b \cdot \color{blue}{\left(b \cdot b\right)}\right) \cdot \left(3 + a\right)\right) \]
        8. lower-+.f6420.5

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

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

        \[\leadsto 4 \cdot \color{blue}{\left(3 \cdot {b}^{2}\right)} \]
      10. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto 4 \cdot \color{blue}{\left({b}^{2} \cdot 3\right)} \]
        2. unpow2N/A

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

          \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right)} \]
        4. *-commutativeN/A

          \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(3 \cdot b\right)}\right) \]
        5. lower-*.f64N/A

          \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(3 \cdot b\right)\right)} \]
        6. *-commutativeN/A

          \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot 3\right)}\right) \]
        7. lower-*.f6429.7

          \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot 3\right)}\right) \]
      11. Simplified29.7%

        \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right)} \]
      12. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\left(b \cdot 3\right)}\right) \]
        2. lift-*.f64N/A

          \[\leadsto 4 \cdot \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right)} \]
        3. *-commutativeN/A

          \[\leadsto \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right) \cdot 4} \]
        4. lift-*.f64N/A

          \[\leadsto \color{blue}{\left(b \cdot \left(b \cdot 3\right)\right)} \cdot 4 \]
        5. lift-*.f64N/A

          \[\leadsto \left(b \cdot \color{blue}{\left(b \cdot 3\right)}\right) \cdot 4 \]
        6. associate-*r*N/A

          \[\leadsto \color{blue}{\left(\left(b \cdot b\right) \cdot 3\right)} \cdot 4 \]
        7. lift-*.f64N/A

          \[\leadsto \left(\color{blue}{\left(b \cdot b\right)} \cdot 3\right) \cdot 4 \]
        8. associate-*l*N/A

          \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(3 \cdot 4\right)} \]
        9. metadata-evalN/A

          \[\leadsto \left(b \cdot b\right) \cdot \color{blue}{12} \]
        10. lift-*.f64N/A

          \[\leadsto \color{blue}{\left(b \cdot b\right)} \cdot 12 \]
        11. associate-*l*N/A

          \[\leadsto \color{blue}{b \cdot \left(b \cdot 12\right)} \]
        12. *-commutativeN/A

          \[\leadsto \color{blue}{\left(b \cdot 12\right) \cdot b} \]
        13. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(b \cdot 12\right) \cdot b} \]
        14. lower-*.f6429.7

          \[\leadsto \color{blue}{\left(b \cdot 12\right)} \cdot b \]
      13. Applied egg-rr29.7%

        \[\leadsto \color{blue}{\left(b \cdot 12\right) \cdot b} \]
      14. Final simplification29.7%

        \[\leadsto b \cdot \left(b \cdot 12\right) \]
      15. Add Preprocessing

      Alternative 17: 27.8% accurate, 25.8× speedup?

      \[\begin{array}{l} \\ b \cdot b \end{array} \]
      (FPCore (a b) :precision binary64 (* b b))
      double code(double a, double b) {
      	return b * b;
      }
      
      real(8) function code(a, b)
          real(8), intent (in) :: a
          real(8), intent (in) :: b
          code = b * b
      end function
      
      public static double code(double a, double b) {
      	return b * b;
      }
      
      def code(a, b):
      	return b * b
      
      function code(a, b)
      	return Float64(b * b)
      end
      
      function tmp = code(a, b)
      	tmp = b * b;
      end
      
      code[a_, b_] := N[(b * b), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      b \cdot b
      \end{array}
      
      Derivation
      1. Initial program 76.4%

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

        \[\leadsto \color{blue}{{b}^{9}} \]
      4. Step-by-step derivation
        1. lower-pow.f6421.5

          \[\leadsto \color{blue}{{b}^{9}} \]
      5. Simplified21.5%

        \[\leadsto \color{blue}{{b}^{9}} \]
      6. Taylor expanded in b around inf

        \[\leadsto \color{blue}{{b}^{2}} \]
      7. Step-by-step derivation
        1. unpow2N/A

          \[\leadsto \color{blue}{b \cdot b} \]
        2. lower-*.f6429.7

          \[\leadsto \color{blue}{b \cdot b} \]
      8. Simplified29.7%

        \[\leadsto \color{blue}{b \cdot b} \]
      9. Add Preprocessing

      Reproduce

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