Bouland and Aaronson, Equation (24)

Percentage Accurate: 73.1% → 99.1%
Time: 8.6s
Alternatives: 9
Speedup: 1.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq 10^{+77}:\\ \;\;\;\;\left({\left(\sqrt{\mathsf{hypot}\left(a, b\right)}\right)}^{8} + 4 \cdot \left(a \cdot \left(a \cdot \left(1 - a\right)\right)\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;-1 + {a}^{4}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (if (<= a 1e+77)
   (+ (+ (pow (sqrt (hypot a b)) 8.0) (* 4.0 (* a (* a (- 1.0 a))))) -1.0)
   (+ -1.0 (pow a 4.0))))
double code(double a, double b) {
	double tmp;
	if (a <= 1e+77) {
		tmp = (pow(sqrt(hypot(a, b)), 8.0) + (4.0 * (a * (a * (1.0 - a))))) + -1.0;
	} else {
		tmp = -1.0 + pow(a, 4.0);
	}
	return tmp;
}
public static double code(double a, double b) {
	double tmp;
	if (a <= 1e+77) {
		tmp = (Math.pow(Math.sqrt(Math.hypot(a, b)), 8.0) + (4.0 * (a * (a * (1.0 - a))))) + -1.0;
	} else {
		tmp = -1.0 + Math.pow(a, 4.0);
	}
	return tmp;
}
def code(a, b):
	tmp = 0
	if a <= 1e+77:
		tmp = (math.pow(math.sqrt(math.hypot(a, b)), 8.0) + (4.0 * (a * (a * (1.0 - a))))) + -1.0
	else:
		tmp = -1.0 + math.pow(a, 4.0)
	return tmp
function code(a, b)
	tmp = 0.0
	if (a <= 1e+77)
		tmp = Float64(Float64((sqrt(hypot(a, b)) ^ 8.0) + Float64(4.0 * Float64(a * Float64(a * Float64(1.0 - a))))) + -1.0);
	else
		tmp = Float64(-1.0 + (a ^ 4.0));
	end
	return tmp
end
function tmp_2 = code(a, b)
	tmp = 0.0;
	if (a <= 1e+77)
		tmp = ((sqrt(hypot(a, b)) ^ 8.0) + (4.0 * (a * (a * (1.0 - a))))) + -1.0;
	else
		tmp = -1.0 + (a ^ 4.0);
	end
	tmp_2 = tmp;
end
code[a_, b_] := If[LessEqual[a, 1e+77], N[(N[(N[Power[N[Sqrt[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision]], $MachinePrecision], 8.0], $MachinePrecision] + N[(4.0 * N[(a * N[(a * N[(1.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], N[(-1.0 + N[Power[a, 4.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 9.99999999999999983e76

    1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({\color{blue}{\left(\sqrt{\mathsf{hypot}\left(a, b\right)} \cdot \sqrt{\mathsf{hypot}\left(a, b\right)}\right)}}^{4} + 4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) + -1 \]
      6. unpow-prod-down83.3%

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

      \[\leadsto \left(\color{blue}{{\left(\sqrt{\mathsf{hypot}\left(a, b\right)}\right)}^{4} \cdot {\left(\sqrt{\mathsf{hypot}\left(a, b\right)}\right)}^{4}} + 4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) + -1 \]
    6. Step-by-step derivation
      1. pow-sqr83.3%

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

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

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

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

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

        \[\leadsto \left({\left(\sqrt{\mathsf{hypot}\left(a, b\right)}\right)}^{8} + 4 \cdot \color{blue}{\left(a \cdot \left(a \cdot \left(1 - a\right)\right)\right)}\right) + -1 \]
    10. Simplified98.7%

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

    if 9.99999999999999983e76 < a

    1. Initial program 11.1%

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

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

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

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

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

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

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

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

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

Alternative 2: 98.4% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 99.9%

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

Alternative 3: 81.2% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 78.6%

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

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

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

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

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

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

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

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

    if 0.0013500000000000001 < b

    1. Initial program 55.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 86.0% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 49.1%

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

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

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

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

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

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

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

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

    if -3 < a < 14000

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{{\left(\sqrt{\mathsf{hypot}\left(a, b\right)}\right)}^{4} \cdot {\left(\sqrt{\mathsf{hypot}\left(a, b\right)}\right)}^{4}} + 4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) + -1 \]
    6. Step-by-step derivation
      1. pow-sqr99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\frac{\left(a \cdot b\right) \cdot \left(a \cdot b\right) - \left(b \cdot 3\right) \cdot \left(b \cdot 3\right)}{a \cdot b - b \cdot 3}}\right) + -1 \]
    13. Step-by-step derivation
      1. swap-sqr60.2%

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

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

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

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

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

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

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

      \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\frac{a \cdot \left(b \cdot \left(b \cdot a\right)\right) - \left(b \cdot b\right) \cdot 9}{b \cdot a - b \cdot 3}}\right) + -1 \]
    15. Step-by-step derivation
      1. associate-*r*75.0%

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

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

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

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

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

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

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

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

Alternative 5: 80.9% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 78.6%

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

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

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

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

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

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

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

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

    if 0.0013500000000000001 < b

    1. Initial program 55.9%

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

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

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

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

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

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

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

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

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

Alternative 6: 73.0% accurate, 4.4× speedup?

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

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

\mathbf{elif}\;b \cdot b \leq 5 \cdot 10^{+301}:\\
\;\;\;\;-1 + 4 \cdot \frac{\frac{b \cdot \left(\left(b \cdot b\right) \cdot \left(a \cdot a - 9\right)\right)}{b}}{a + -3}\\

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


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

    1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.9999999999999999e87 < (*.f64 b b) < 5.0000000000000004e301

    1. Initial program 78.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({\color{blue}{\left(\sqrt{\mathsf{hypot}\left(a, b\right)} \cdot \sqrt{\mathsf{hypot}\left(a, b\right)}\right)}}^{4} + 4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) + -1 \]
      6. unpow-prod-down78.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot \left(b \cdot \left(b \cdot \left(a + 3\right)\right)\right)} + -1 \]
    11. Step-by-step derivation
      1. distribute-lft-in7.8%

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

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

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

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

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

      \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\frac{\left(a \cdot b\right) \cdot \left(a \cdot b\right) - \left(b \cdot 3\right) \cdot \left(b \cdot 3\right)}{a \cdot b - b \cdot 3}}\right) + -1 \]
    13. Step-by-step derivation
      1. swap-sqr4.8%

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

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

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

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

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

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

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

      \[\leadsto 4 \cdot \left(b \cdot \color{blue}{\frac{a \cdot \left(b \cdot \left(b \cdot a\right)\right) - \left(b \cdot b\right) \cdot 9}{b \cdot a - b \cdot 3}}\right) + -1 \]
    15. Step-by-step derivation
      1. associate-*r*4.8%

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

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

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

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

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

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

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

    if 5.0000000000000004e301 < (*.f64 b b)

    1. Initial program 41.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({\color{blue}{\left(\sqrt{\mathsf{hypot}\left(a, b\right)} \cdot \sqrt{\mathsf{hypot}\left(a, b\right)}\right)}}^{4} + 4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) + -1 \]
      6. unpow-prod-down45.7%

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

      \[\leadsto \left(\color{blue}{{\left(\sqrt{\mathsf{hypot}\left(a, b\right)}\right)}^{4} \cdot {\left(\sqrt{\mathsf{hypot}\left(a, b\right)}\right)}^{4}} + 4 \cdot \mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) + -1 \]
    6. Step-by-step derivation
      1. pow-sqr45.7%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot b \leq 2 \cdot 10^{+87}:\\ \;\;\;\;-1 + 4 \cdot \left(a \cdot a\right)\\ \mathbf{elif}\;b \cdot b \leq 5 \cdot 10^{+301}:\\ \;\;\;\;-1 + 4 \cdot \frac{\frac{b \cdot \left(\left(b \cdot b\right) \cdot \left(a \cdot a - 9\right)\right)}{b}}{a + -3}\\ \mathbf{else}:\\ \;\;\;\;-1 + \left(b \cdot b\right) \cdot 12\\ \end{array} \]

Alternative 7: 69.1% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 84.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.9999999999999998e274 < (*.f64 b b)

    1. Initial program 46.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 51.6% accurate, 18.3× speedup?

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

\\
-1 + 4 \cdot \left(a \cdot a\right)
\end{array}
Derivation
  1. Initial program 73.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -1 + 4 \cdot \left(a \cdot a\right) \]

Alternative 9: 24.5% accurate, 128.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto -1 \]

Reproduce

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