Bouland and Aaronson, Equation (24)

Percentage Accurate: 74.3% → 99.9%
Time: 10.0s
Alternatives: 8
Speedup: 6.1×

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 8 alternatives:

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

Initial Program: 74.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;{a}^{4} \cdot \left(1 + \frac{2 \cdot \frac{b \cdot b}{a} - 4}{a}\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))))) < +inf.0

    1. Initial program 99.8%

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

    if +inf.0 < (+.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 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. associate--l+0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {a}^{4} \cdot \left(1 + \left(-\frac{4 + \left(-2 \cdot \frac{\color{blue}{b \cdot b}}{a}\right)}{a}\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 \infty:\\ \;\;\;\;\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(a + 3\right)\right)\right) + -1\\ \mathbf{else}:\\ \;\;\;\;{a}^{4} \cdot \left(1 + \frac{2 \cdot \frac{b \cdot b}{a} - 4}{a}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 80.6% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;a \leq -9 \cdot 10^{-264}:\\
\;\;\;\;{b}^{4}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -4.6e11 or 1.6e25 < a

    1. Initial program 43.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. associate--l+43.1%

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

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

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

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

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

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

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

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

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

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

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

    if -4.6e11 < a < -1.11999999999999995e-235

    1. Initial program 96.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. associate--l+96.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.11999999999999995e-235 < a < -9.0000000000000001e-264

    1. Initial program 99.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. associate--l+99.6%

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

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

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

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

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

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

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

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

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

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

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

    if -9.0000000000000001e-264 < a < 1.6e25

    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. associate--l+99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -460000000000:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;a \leq -1.12 \cdot 10^{-235}:\\ \;\;\;\;\left(b \cdot b\right) \cdot 12 + -1\\ \mathbf{elif}\;a \leq -9 \cdot 10^{-264}:\\ \;\;\;\;{b}^{4}\\ \mathbf{elif}\;a \leq 1.6 \cdot 10^{+25}:\\ \;\;\;\;-1 + 4 \cdot \left(\left(b \cdot b\right) \cdot \left(a + 3\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{a}^{4}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 94.7% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 85.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. associate--l+85.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt[3]{{a}^{12}} + \left(4 \cdot \color{blue}{\left({a}^{2} \cdot \left(1 - a\right)\right)} - 1\right) \]
    11. Taylor expanded in a around 0 98.7%

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

    if 1e9 < (*.f64 b b)

    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. Step-by-step derivation
      1. associate--l+65.1%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 82.5% accurate, 1.1× speedup?

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

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

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


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

    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. associate--l+84.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt[3]{{a}^{12}} + \left(4 \cdot \color{blue}{\left({a}^{2} \cdot \left(1 - a\right)\right)} - 1\right) \]
    11. Taylor expanded in a around 0 73.6%

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

    if 1e-3 < (*.f64 b b)

    1. Initial program 65.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. associate--l+65.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \cdot b \leq 0.001:\\ \;\;\;\;4 \cdot {a}^{2} + -1\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 81.5% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -8.5e12 or 1.6e25 < a

    1. Initial program 43.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. associate--l+43.1%

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

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

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

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

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

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

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

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

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

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

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

    if -8.5e12 < a < 1.6e25

    1. Initial program 98.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. associate--l+98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 81.4% accurate, 6.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -4e12 or 2.39999999999999996e25 < a

    1. Initial program 43.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. associate--l+43.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{a}^{4} \cdot \left(1 + \left(-\frac{4 + \left(-\frac{4 + 2 \cdot {b}^{2}}{a}\right)}{a}\right)\right)} \]
    8. Taylor expanded in b around 0 93.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(a \cdot a\right)} \cdot \left(4 + a \cdot \left(a - 4\right)\right) \]
    13. Applied egg-rr93.8%

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

    if -4e12 < a < 2.39999999999999996e25

    1. Initial program 98.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. associate--l+98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 51.7% accurate, 18.3× speedup?

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

\\
\left(b \cdot b\right) \cdot 12 + -1
\end{array}
Derivation
  1. Initial program 74.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. associate--l+74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(b \cdot b\right) \cdot 12 + -1 \]
  14. Add Preprocessing

Alternative 8: 25.0% 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 74.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. associate--l+74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{12 \cdot {b}^{2} - 1} \]
  11. Taylor expanded in b around 0 23.0%

    \[\leadsto \color{blue}{-1} \]
  12. Add Preprocessing

Reproduce

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