Bouland and Aaronson, Equation (25)

Percentage Accurate: 72.7% → 98.3%
Time: 8.5s
Alternatives: 7
Speedup: 1.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(1 - 3 \cdot a\right)\right)\right) - 1 \end{array} \]
(FPCore (a b)
 :precision binary64
 (-
  (+
   (pow (+ (* a a) (* b b)) 2.0)
   (* 4.0 (+ (* (* a a) (+ 1.0 a)) (* (* b b) (- 1.0 (* 3.0 a))))))
  1.0))
double code(double a, double b) {
	return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
real(8) function code(a, b)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = ((((a * a) + (b * b)) ** 2.0d0) + (4.0d0 * (((a * a) * (1.0d0 + a)) + ((b * b) * (1.0d0 - (3.0d0 * a)))))) - 1.0d0
end function
public static double code(double a, double b) {
	return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
}
def code(a, b):
	return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0
function code(a, b)
	return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(Float64(Float64(a * a) * Float64(1.0 + a)) + Float64(Float64(b * b) * Float64(1.0 - Float64(3.0 * a)))))) - 1.0)
end
function tmp = code(a, b)
	tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (((a * a) * (1.0 + a)) + ((b * b) * (1.0 - (3.0 * a)))))) - 1.0;
end
code[a_, b_] := N[(N[(N[Power[N[(N[(a * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(4.0 * N[(N[(N[(a * a), $MachinePrecision] * N[(1.0 + a), $MachinePrecision]), $MachinePrecision] + N[(N[(b * b), $MachinePrecision] * N[(1.0 - N[(3.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 7 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: 72.7% accurate, 1.0× speedup?

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

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

Alternative 1: 98.3% accurate, 0.2× speedup?

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot {a}^{3} + {a}^{4}} \]
    13. Step-by-step derivation
      1. +-commutative26.5%

        \[\leadsto \color{blue}{{a}^{4} + 4 \cdot {a}^{3}} \]
      2. metadata-eval26.5%

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

        \[\leadsto \color{blue}{{a}^{3} \cdot a} + 4 \cdot {a}^{3} \]
      4. *-commutative26.5%

        \[\leadsto {a}^{3} \cdot a + \color{blue}{{a}^{3} \cdot 4} \]
      5. distribute-lft-out90.2%

        \[\leadsto \color{blue}{{a}^{3} \cdot \left(a + 4\right)} \]
    14. Simplified90.2%

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

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

Alternative 2: 98.2% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 99.9%

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot {a}^{3} + {a}^{4}} \]
    13. Step-by-step derivation
      1. +-commutative26.5%

        \[\leadsto \color{blue}{{a}^{4} + 4 \cdot {a}^{3}} \]
      2. metadata-eval26.5%

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

        \[\leadsto \color{blue}{{a}^{3} \cdot a} + 4 \cdot {a}^{3} \]
      4. *-commutative26.5%

        \[\leadsto {a}^{3} \cdot a + \color{blue}{{a}^{3} \cdot 4} \]
      5. distribute-lft-out90.2%

        \[\leadsto \color{blue}{{a}^{3} \cdot \left(a + 4\right)} \]
    14. Simplified90.2%

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

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

Alternative 3: 80.6% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;b \leq 7.2 \cdot 10^{+40} \lor \neg \left(b \leq 2.8 \cdot 10^{+49}\right):\\
\;\;\;\;{b}^{4}\\

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


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

    1. Initial program 77.1%

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

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

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

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

    if 580 < b < 7.19999999999999993e40 or 2.7999999999999998e49 < b

    1. Initial program 66.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.19999999999999993e40 < b < 2.7999999999999998e49

    1. Initial program 20.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 580:\\ \;\;\;\;-1 + {a}^{4}\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{+40} \lor \neg \left(b \leq 2.8 \cdot 10^{+49}\right):\\ \;\;\;\;{b}^{4}\\ \mathbf{else}:\\ \;\;\;\;{a}^{4}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 65.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -1 + a \cdot \left(a \cdot 4\right)\\ \mathbf{if}\;b \leq 3.9 \cdot 10^{-128}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;b \leq 1.15 \cdot 10^{-120}:\\ \;\;\;\;{a}^{4}\\ \mathbf{elif}\;b \leq 475:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;{b}^{4}\\ \end{array} \end{array} \]
(FPCore (a b)
 :precision binary64
 (let* ((t_0 (+ -1.0 (* a (* a 4.0)))))
   (if (<= b 3.9e-128)
     t_0
     (if (<= b 1.15e-120) (pow a 4.0) (if (<= b 475.0) t_0 (pow b 4.0))))))
double code(double a, double b) {
	double t_0 = -1.0 + (a * (a * 4.0));
	double tmp;
	if (b <= 3.9e-128) {
		tmp = t_0;
	} else if (b <= 1.15e-120) {
		tmp = pow(a, 4.0);
	} else if (b <= 475.0) {
		tmp = t_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) :: t_0
    real(8) :: tmp
    t_0 = (-1.0d0) + (a * (a * 4.0d0))
    if (b <= 3.9d-128) then
        tmp = t_0
    else if (b <= 1.15d-120) then
        tmp = a ** 4.0d0
    else if (b <= 475.0d0) then
        tmp = t_0
    else
        tmp = b ** 4.0d0
    end if
    code = tmp
end function
public static double code(double a, double b) {
	double t_0 = -1.0 + (a * (a * 4.0));
	double tmp;
	if (b <= 3.9e-128) {
		tmp = t_0;
	} else if (b <= 1.15e-120) {
		tmp = Math.pow(a, 4.0);
	} else if (b <= 475.0) {
		tmp = t_0;
	} else {
		tmp = Math.pow(b, 4.0);
	}
	return tmp;
}
def code(a, b):
	t_0 = -1.0 + (a * (a * 4.0))
	tmp = 0
	if b <= 3.9e-128:
		tmp = t_0
	elif b <= 1.15e-120:
		tmp = math.pow(a, 4.0)
	elif b <= 475.0:
		tmp = t_0
	else:
		tmp = math.pow(b, 4.0)
	return tmp
function code(a, b)
	t_0 = Float64(-1.0 + Float64(a * Float64(a * 4.0)))
	tmp = 0.0
	if (b <= 3.9e-128)
		tmp = t_0;
	elseif (b <= 1.15e-120)
		tmp = a ^ 4.0;
	elseif (b <= 475.0)
		tmp = t_0;
	else
		tmp = b ^ 4.0;
	end
	return tmp
end
function tmp_2 = code(a, b)
	t_0 = -1.0 + (a * (a * 4.0));
	tmp = 0.0;
	if (b <= 3.9e-128)
		tmp = t_0;
	elseif (b <= 1.15e-120)
		tmp = a ^ 4.0;
	elseif (b <= 475.0)
		tmp = t_0;
	else
		tmp = b ^ 4.0;
	end
	tmp_2 = tmp;
end
code[a_, b_] := Block[{t$95$0 = N[(-1.0 + N[(a * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 3.9e-128], t$95$0, If[LessEqual[b, 1.15e-120], N[Power[a, 4.0], $MachinePrecision], If[LessEqual[b, 475.0], t$95$0, N[Power[b, 4.0], $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;b \leq 475:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < 3.89999999999999997e-128 or 1.14999999999999993e-120 < b < 475

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot {a}^{2}} - 1 \]
    7. Step-by-step derivation
      1. expm1-log1p-u60.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(4 \cdot {a}^{2}\right)\right)} - 1 \]
      2. expm1-udef60.7%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(4 \cdot {a}^{2}\right)} - 1\right)} - 1 \]
      3. log1p-udef60.7%

        \[\leadsto \left(e^{\color{blue}{\log \left(1 + 4 \cdot {a}^{2}\right)}} - 1\right) - 1 \]
      4. rem-exp-log60.7%

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

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

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

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

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

        \[\leadsto \color{blue}{4 \cdot {a}^{2}} - 1 \]
      4. unpow260.7%

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

        \[\leadsto \color{blue}{\left(4 \cdot a\right) \cdot a} - 1 \]
    10. Applied egg-rr60.7%

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

    if 3.89999999999999997e-128 < b < 1.14999999999999993e-120

    1. Initial program 49.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 475 < b

    1. Initial program 63.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 68.5% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.0065 \lor \neg \left(a \leq 3.9 \cdot 10^{-7}\right):\\
\;\;\;\;{a}^{4}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -0.0064999999999999997 or 3.90000000000000025e-7 < a

    1. Initial program 48.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0064999999999999997 < a < 3.90000000000000025e-7

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{4 \cdot {a}^{2}} - 1 \]
    7. Step-by-step derivation
      1. expm1-log1p-u48.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(4 \cdot {a}^{2}\right)\right)} - 1 \]
      2. expm1-udef48.0%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(4 \cdot {a}^{2}\right)} - 1\right)} - 1 \]
      3. log1p-udef48.0%

        \[\leadsto \left(e^{\color{blue}{\log \left(1 + 4 \cdot {a}^{2}\right)}} - 1\right) - 1 \]
      4. rem-exp-log48.0%

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

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

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

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

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

        \[\leadsto \color{blue}{4 \cdot {a}^{2}} - 1 \]
      4. unpow248.0%

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

        \[\leadsto \color{blue}{\left(4 \cdot a\right) \cdot a} - 1 \]
    10. Applied egg-rr48.0%

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

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

Alternative 6: 50.8% accurate, 18.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{4 \cdot {a}^{2}} - 1 \]
  7. Step-by-step derivation
    1. expm1-log1p-u50.2%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(4 \cdot {a}^{2}\right)\right)} - 1 \]
    2. expm1-udef50.2%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(4 \cdot {a}^{2}\right)} - 1\right)} - 1 \]
    3. log1p-udef50.2%

      \[\leadsto \left(e^{\color{blue}{\log \left(1 + 4 \cdot {a}^{2}\right)}} - 1\right) - 1 \]
    4. rem-exp-log50.2%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(4 \cdot a\right) \cdot a} - 1 \]
  10. Applied egg-rr50.2%

    \[\leadsto \color{blue}{\left(4 \cdot a\right) \cdot a} - 1 \]
  11. Final simplification50.2%

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

Alternative 7: 24.1% accurate, 130.0× speedup?

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

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

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

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

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

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

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

    \[\leadsto -1 \]
  8. Add Preprocessing

Reproduce

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