Bouland and Aaronson, Equation (26)

Percentage Accurate: 99.9% → 100.0%
Time: 8.0s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \end{array} \]
(FPCore (a b)
 :precision binary64
 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))
double code(double a, double b) {
	return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 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 * (b * b))) - 1.0d0
end function
public static double code(double a, double b) {
	return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
def code(a, b):
	return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0
function code(a, b)
	return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(b * b))) - 1.0)
end
function tmp = code(a, b)
	tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (b * b))) - 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[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}

\\
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\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 10 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: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \end{array} \]
(FPCore (a b)
 :precision binary64
 (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (* b b))) 1.0))
double code(double a, double b) {
	return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 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 * (b * b))) - 1.0d0
end function
public static double code(double a, double b) {
	return (Math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0;
}
def code(a, b):
	return (math.pow(((a * a) + (b * b)), 2.0) + (4.0 * (b * b))) - 1.0
function code(a, b)
	return Float64(Float64((Float64(Float64(a * a) + Float64(b * b)) ^ 2.0) + Float64(4.0 * Float64(b * b))) - 1.0)
end
function tmp = code(a, b)
	tmp = ((((a * a) + (b * b)) ^ 2.0) + (4.0 * (b * b))) - 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[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 100.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ {\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(b, b \cdot 4, -1\right) \end{array} \]
(FPCore (a b)
 :precision binary64
 (+ (pow (hypot a b) 4.0) (fma b (* b 4.0) -1.0)))
double code(double a, double b) {
	return pow(hypot(a, b), 4.0) + fma(b, (b * 4.0), -1.0);
}
function code(a, b)
	return Float64((hypot(a, b) ^ 4.0) + fma(b, Float64(b * 4.0), -1.0))
end
code[a_, b_] := N[(N[Power[N[Sqrt[a ^ 2 + b ^ 2], $MachinePrecision], 4.0], $MachinePrecision] + N[(b * N[(b * 4.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \mathsf{fma}\left(b, b \cdot 4, -1\right)
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\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(b \cdot b\right) - 1\right)} \]
    2. unpow299.9%

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

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

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

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

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

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

Alternative 2: 100.0% accurate, 0.5× speedup?

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

\\
\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + 4 \cdot \left(b \cdot b\right)\right) + -1
\end{array}
Derivation
  1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(\color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  6. Final simplification100.0%

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

Alternative 3: 97.8% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \cdot b \leq 5 \cdot 10^{+149}:\\
\;\;\;\;{b}^{4} + 2 \cdot \left(\left(b \cdot b\right) \cdot \left(a \cdot a\right)\right)\\

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if 2e10 < (*.f64 b b) < 4.9999999999999999e149

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{b}^{4} + \left(4 + 2 \cdot \left(a \cdot a\right)\right) \cdot \left(b \cdot b\right)} \]
    7. Taylor expanded in a around inf 86.7%

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

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

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

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

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

    if 4.9999999999999999e149 < (*.f64 b b)

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)}\right) - 1 \]
      6. distribute-rgt-out100.0%

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

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

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

Alternative 4: 98.2% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.9%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\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(b \cdot b\right) - 1\right)} \]
      2. unpow299.9%

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

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

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

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

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

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

    if 0.40000000000000002 < (*.f64 b b)

    1. Initial program 99.9%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\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(b \cdot b\right) - 1\right)} \]
      2. unpow299.9%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 99.9% accurate, 1.0× speedup?

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

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

    \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  2. Final simplification99.9%

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

Alternative 6: 92.8% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

    if 4.9999999999999999e149 < (*.f64 b b)

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(4 \cdot \left(b \cdot b\right) + \color{blue}{\left(b \cdot b\right) \cdot \left(b \cdot b\right)}\right) - 1 \]
      6. distribute-rgt-out100.0%

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

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

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

Alternative 7: 81.9% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.30000000000000013e44 < a

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

Alternative 8: 69.8% accurate, 10.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)} - 1 \]
  10. Applied egg-rr72.6%

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

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

Alternative 9: 51.0% accurate, 16.6× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(b \cdot b\right) \cdot \left(4 + b \cdot b\right)} - 1 \]
  10. Applied egg-rr72.6%

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

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

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

    \[\leadsto \color{blue}{4 \cdot \left(b \cdot b\right)} - 1 \]
  14. Final simplification53.5%

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

Alternative 10: 24.8% accurate, 116.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 99.9%

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

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

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

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

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

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

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

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

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

    \[\leadsto \left(\color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4}} + 4 \cdot \left(b \cdot b\right)\right) - 1 \]
  6. Step-by-step derivation
    1. add-log-exp88.2%

      \[\leadsto \color{blue}{\log \left(e^{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + 4 \cdot \left(b \cdot b\right)\right) - 1}\right)} \]
    2. sub-neg88.2%

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

      \[\leadsto \log \left(e^{\color{blue}{\left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + 4 \cdot \left(b \cdot b\right)\right) - 1}}\right) \]
    4. associate--l+88.2%

      \[\leadsto \log \left(e^{\color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left(4 \cdot \left(b \cdot b\right) - 1\right)}}\right) \]
    5. add-cbrt-cube88.2%

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

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

      \[\leadsto \log \left(e^{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left(\sqrt[3]{\color{blue}{64}} \cdot \left(b \cdot b\right) - 1\right)}\right) \]
    8. unpow1/388.2%

      \[\leadsto \log \left(e^{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left(\color{blue}{{64}^{0.3333333333333333}} \cdot \left(b \cdot b\right) - 1\right)}\right) \]
    9. pow288.2%

      \[\leadsto \log \left(e^{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left({64}^{0.3333333333333333} \cdot \color{blue}{{b}^{2}} - 1\right)}\right) \]
    10. metadata-eval88.2%

      \[\leadsto \log \left(e^{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left({64}^{0.3333333333333333} \cdot {b}^{\color{blue}{\left(6 \cdot 0.3333333333333333\right)}} - 1\right)}\right) \]
    11. pow-pow88.2%

      \[\leadsto \log \left(e^{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left({64}^{0.3333333333333333} \cdot \color{blue}{{\left({b}^{6}\right)}^{0.3333333333333333}} - 1\right)}\right) \]
    12. unpow-prod-down88.2%

      \[\leadsto \log \left(e^{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left(\color{blue}{{\left(64 \cdot {b}^{6}\right)}^{0.3333333333333333}} - 1\right)}\right) \]
    13. unpow-prod-down88.2%

      \[\leadsto \log \left(e^{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \left(\color{blue}{{64}^{0.3333333333333333} \cdot {\left({b}^{6}\right)}^{0.3333333333333333}} - 1\right)}\right) \]
    14. fma-neg88.2%

      \[\leadsto \log \left(e^{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{4} + \color{blue}{\mathsf{fma}\left({64}^{0.3333333333333333}, {\left({b}^{6}\right)}^{0.3333333333333333}, -1\right)}}\right) \]
  7. Applied egg-rr88.2%

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

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

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

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

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

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

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

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

      \[\leadsto \log \left(e^{\mathsf{fma}\left(\color{blue}{b \cdot b}, 4 + b \cdot b, -1\right)}\right) \]
    8. unpow273.9%

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

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

      \[\leadsto \log \left(e^{\mathsf{fma}\left(b \cdot b, \color{blue}{b \cdot b} + 4, -1\right)}\right) \]
    11. fma-def73.9%

      \[\leadsto \log \left(e^{\mathsf{fma}\left(b \cdot b, \color{blue}{\mathsf{fma}\left(b, b, 4\right)}, -1\right)}\right) \]
  10. Simplified73.9%

    \[\leadsto \log \color{blue}{\left(e^{\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 4\right), -1\right)}\right)} \]
  11. Taylor expanded in b around 0 27.3%

    \[\leadsto \color{blue}{-1} \]
  12. Final simplification27.3%

    \[\leadsto -1 \]

Reproduce

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