Bouland and Aaronson, Equation (24)

Percentage Accurate: 73.4% → 99.3%
Time: 7.6s
Alternatives: 12
Speedup: 5.5×

Specification

?
\[\begin{array}{l} \\ \left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \end{array} \]
(FPCore (a b)
 :precision binary64
 (-
  (+
   (pow (+ (* a a) (* b b)) 2.0)
   (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 3.0 a)))))
  1.0))
double code(double a, double b) {
	return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 73.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \end{array} \]
(FPCore (a b)
 :precision binary64
 (-
  (+
   (pow (+ (* a a) (* b b)) 2.0)
   (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 3.0 a)))))
  1.0))
double code(double a, double b) {
	return (pow(((a * a) + (b * b)), 2.0) + (4.0 * (((a * a) * (1.0 - a)) + ((b * b) * (3.0 + a))))) - 1.0;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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

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

Alternative 1: 99.3% accurate, 3.0× speedup?

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

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

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


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

    1. Initial program 88.8%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b, b, a \cdot a\right), 4 \cdot \left({a}^{2} \cdot \left(1 - a\right)\right) - \color{blue}{1 \cdot 1}\right) \]
      2. fp-cancel-sub-sign-invN/A

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b, b, a \cdot a\right), \color{blue}{\left(4 \cdot \left(1 - a\right)\right) \cdot {a}^{2}} + \left(\mathsf{neg}\left(1\right)\right) \cdot 1\right) \]
      5. distribute-lft-out--N/A

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

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b, b, a \cdot a\right), \left(4 - \color{blue}{\left(\mathsf{neg}\left(-4\right)\right)} \cdot a\right) \cdot {a}^{2} + \left(\mathsf{neg}\left(1\right)\right) \cdot 1\right) \]
      8. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.99999999999999985e75 < a

    1. Initial program 10.6%

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{a}^{4}} \]
    6. Step-by-step derivation
      1. lower-pow.f64100.0

        \[\leadsto \color{blue}{{a}^{4}} \]
    7. Applied rewrites100.0%

      \[\leadsto \color{blue}{{a}^{4}} \]
    8. Step-by-step derivation
      1. Applied rewrites100.0%

        \[\leadsto \left(a \cdot a\right) \cdot \color{blue}{\left(a \cdot a\right)} \]
    9. Recombined 2 regimes into one program.
    10. Add Preprocessing

    Alternative 2: 94.5% accurate, 5.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -6500 \lor \neg \left(a \leq 5500000000000\right):\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, b, 12\right) \cdot b, b, -1\right)\\ \end{array} \end{array} \]
    (FPCore (a b)
     :precision binary64
     (if (or (<= a -6500.0) (not (<= a 5500000000000.0)))
       (* (* a a) (* a a))
       (fma (* (fma b b 12.0) b) b -1.0)))
    double code(double a, double b) {
    	double tmp;
    	if ((a <= -6500.0) || !(a <= 5500000000000.0)) {
    		tmp = (a * a) * (a * a);
    	} else {
    		tmp = fma((fma(b, b, 12.0) * b), b, -1.0);
    	}
    	return tmp;
    }
    
    function code(a, b)
    	tmp = 0.0
    	if ((a <= -6500.0) || !(a <= 5500000000000.0))
    		tmp = Float64(Float64(a * a) * Float64(a * a));
    	else
    		tmp = fma(Float64(fma(b, b, 12.0) * b), b, -1.0);
    	end
    	return tmp
    end
    
    code[a_, b_] := If[Or[LessEqual[a, -6500.0], N[Not[LessEqual[a, 5500000000000.0]], $MachinePrecision]], N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b * b + 12.0), $MachinePrecision] * b), $MachinePrecision] * b + -1.0), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;a \leq -6500 \lor \neg \left(a \leq 5500000000000\right):\\
    \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, b, 12\right) \cdot b, b, -1\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if a < -6500 or 5.5e12 < a

      1. Initial program 48.7%

        \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{a}^{4}} \]
      6. Step-by-step derivation
        1. lower-pow.f6491.2

          \[\leadsto \color{blue}{{a}^{4}} \]
      7. Applied rewrites91.2%

        \[\leadsto \color{blue}{{a}^{4}} \]
      8. Step-by-step derivation
        1. Applied rewrites91.1%

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

        if -6500 < a < 5.5e12

        1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto {b}^{2} \cdot \left(4 \cdot \left(3 + a\right) + {b}^{2}\right) - \color{blue}{1 \cdot 1} \]
          13. fp-cancel-sub-sign-invN/A

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

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

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

            \[\leadsto \color{blue}{\left(\left(4 \cdot \left(3 + a\right) + {b}^{2}\right) \cdot b\right) \cdot b} + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
        5. Applied rewrites98.6%

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

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(b, b, 12\right) \cdot b, b, -1\right) \]
        7. Step-by-step derivation
          1. Applied rewrites98.6%

            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(b, b, 12\right) \cdot b, b, -1\right) \]
        8. Recombined 2 regimes into one program.
        9. Final simplification94.9%

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

        Alternative 3: 94.5% accurate, 5.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -6500 \lor \neg \left(a \leq 5500000000000\right):\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 12\right), -1\right)\\ \end{array} \end{array} \]
        (FPCore (a b)
         :precision binary64
         (if (or (<= a -6500.0) (not (<= a 5500000000000.0)))
           (* (* a a) (* a a))
           (fma (* b b) (fma b b 12.0) -1.0)))
        double code(double a, double b) {
        	double tmp;
        	if ((a <= -6500.0) || !(a <= 5500000000000.0)) {
        		tmp = (a * a) * (a * a);
        	} else {
        		tmp = fma((b * b), fma(b, b, 12.0), -1.0);
        	}
        	return tmp;
        }
        
        function code(a, b)
        	tmp = 0.0
        	if ((a <= -6500.0) || !(a <= 5500000000000.0))
        		tmp = Float64(Float64(a * a) * Float64(a * a));
        	else
        		tmp = fma(Float64(b * b), fma(b, b, 12.0), -1.0);
        	end
        	return tmp
        end
        
        code[a_, b_] := If[Or[LessEqual[a, -6500.0], N[Not[LessEqual[a, 5500000000000.0]], $MachinePrecision]], N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision], N[(N[(b * b), $MachinePrecision] * N[(b * b + 12.0), $MachinePrecision] + -1.0), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;a \leq -6500 \lor \neg \left(a \leq 5500000000000\right):\\
        \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 12\right), -1\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if a < -6500 or 5.5e12 < a

          1. Initial program 48.7%

            \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{{a}^{4}} \]
          6. Step-by-step derivation
            1. lower-pow.f6491.2

              \[\leadsto \color{blue}{{a}^{4}} \]
          7. Applied rewrites91.2%

            \[\leadsto \color{blue}{{a}^{4}} \]
          8. Step-by-step derivation
            1. Applied rewrites91.1%

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

            if -6500 < a < 5.5e12

            1. Initial program 99.9%

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

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

                \[\leadsto \left(12 \cdot {b}^{2} + {b}^{4}\right) - \color{blue}{1 \cdot 1} \]
              2. fp-cancel-sub-sign-invN/A

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

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

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

                \[\leadsto \left(\color{blue}{{b}^{2} \cdot {b}^{2}} + 12 \cdot {b}^{2}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
              6. distribute-rgt-outN/A

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(b \cdot b, \color{blue}{b \cdot b} + 12, -1\right) \]
              13. lower-fma.f6498.6

                \[\leadsto \mathsf{fma}\left(b \cdot b, \color{blue}{\mathsf{fma}\left(b, b, 12\right)}, -1\right) \]
            5. Applied rewrites98.6%

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

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

          Alternative 4: 94.6% accurate, 5.2× speedup?

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

            1. Initial program 65.5%

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

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

                \[\leadsto \left(4 \cdot \left({a}^{2} \cdot \left(1 - a\right)\right) + {a}^{4}\right) - \color{blue}{1 \cdot 1} \]
              2. fp-cancel-sub-sign-invN/A

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

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

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

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

                \[\leadsto \left({a}^{2} \cdot {a}^{2} + 4 \cdot \color{blue}{\left(\left(1 - a\right) \cdot {a}^{2}\right)}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
              7. associate-*r*N/A

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

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

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

                \[\leadsto \left({a}^{2} \cdot {a}^{2} + \left(4 - \color{blue}{\left(\mathsf{neg}\left(-4\right)\right)} \cdot a\right) \cdot {a}^{2}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
              11. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

            if -4.19999999999999977e-5 < a < 5.5e12

            1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto {b}^{2} \cdot \left(4 \cdot \left(3 + a\right) + {b}^{2}\right) - \color{blue}{1 \cdot 1} \]
              13. fp-cancel-sub-sign-invN/A

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(b, b, 12\right) \cdot b, b, -1\right) \]
            7. Step-by-step derivation
              1. Applied rewrites99.4%

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

              if 5.5e12 < a

              1. Initial program 32.1%

                \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{{a}^{4}} \]
              6. Step-by-step derivation
                1. lower-pow.f6491.0

                  \[\leadsto \color{blue}{{a}^{4}} \]
              7. Applied rewrites91.0%

                \[\leadsto \color{blue}{{a}^{4}} \]
              8. Step-by-step derivation
                1. Applied rewrites91.0%

                  \[\leadsto \left(\left(a \cdot a\right) \cdot \left(-a\right)\right) \cdot \color{blue}{\left(-a\right)} \]
              9. Recombined 3 regimes into one program.
              10. Final simplification95.6%

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

              Alternative 5: 94.6% accurate, 5.2× speedup?

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

                1. Initial program 65.5%

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

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

                    \[\leadsto \left(4 \cdot \left({a}^{2} \cdot \left(1 - a\right)\right) + {a}^{4}\right) - \color{blue}{1 \cdot 1} \]
                  2. fp-cancel-sub-sign-invN/A

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

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

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

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

                    \[\leadsto \left({a}^{2} \cdot {a}^{2} + 4 \cdot \color{blue}{\left(\left(1 - a\right) \cdot {a}^{2}\right)}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
                  7. associate-*r*N/A

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

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

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

                    \[\leadsto \left({a}^{2} \cdot {a}^{2} + \left(4 - \color{blue}{\left(\mathsf{neg}\left(-4\right)\right)} \cdot a\right) \cdot {a}^{2}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
                  11. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

                  if -4.19999999999999977e-5 < a < 5.5e12

                  1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto {b}^{2} \cdot \left(4 \cdot \left(3 + a\right) + {b}^{2}\right) - \color{blue}{1 \cdot 1} \]
                    13. fp-cancel-sub-sign-invN/A

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

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(b, b, 12\right) \cdot b, b, -1\right) \]
                  7. Step-by-step derivation
                    1. Applied rewrites99.4%

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

                    if 5.5e12 < a

                    1. Initial program 32.1%

                      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{{a}^{4}} \]
                    6. Step-by-step derivation
                      1. lower-pow.f6491.0

                        \[\leadsto \color{blue}{{a}^{4}} \]
                    7. Applied rewrites91.0%

                      \[\leadsto \color{blue}{{a}^{4}} \]
                    8. Step-by-step derivation
                      1. Applied rewrites91.0%

                        \[\leadsto \left(\left(a \cdot a\right) \cdot \left(-a\right)\right) \cdot \color{blue}{\left(-a\right)} \]
                    9. Recombined 3 regimes into one program.
                    10. Final simplification95.6%

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

                    Alternative 6: 94.5% accurate, 5.2× speedup?

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

                      1. Initial program 64.4%

                        \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
                      2. Add Preprocessing
                      3. Step-by-step derivation
                        1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{{a}^{4}} \]
                      6. Step-by-step derivation
                        1. lower-pow.f6491.4

                          \[\leadsto \color{blue}{{a}^{4}} \]
                      7. Applied rewrites91.4%

                        \[\leadsto \color{blue}{{a}^{4}} \]
                      8. Step-by-step derivation
                        1. Applied rewrites91.3%

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

                        if -6500 < a < 5.5e12

                        1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto {b}^{2} \cdot \left(4 \cdot \left(3 + a\right) + {b}^{2}\right) - \color{blue}{1 \cdot 1} \]
                          13. fp-cancel-sub-sign-invN/A

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

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

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

                            \[\leadsto \color{blue}{\left(\left(4 \cdot \left(3 + a\right) + {b}^{2}\right) \cdot b\right) \cdot b} + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
                        5. Applied rewrites98.6%

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

                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(b, b, 12\right) \cdot b, b, -1\right) \]
                        7. Step-by-step derivation
                          1. Applied rewrites98.6%

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

                          if 5.5e12 < a

                          1. Initial program 32.1%

                            \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
                          2. Add Preprocessing
                          3. Step-by-step derivation
                            1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \color{blue}{{a}^{4}} \]
                          6. Step-by-step derivation
                            1. lower-pow.f6491.0

                              \[\leadsto \color{blue}{{a}^{4}} \]
                          7. Applied rewrites91.0%

                            \[\leadsto \color{blue}{{a}^{4}} \]
                          8. Step-by-step derivation
                            1. Applied rewrites91.0%

                              \[\leadsto \left(\left(a \cdot a\right) \cdot \left(-a\right)\right) \cdot \color{blue}{\left(-a\right)} \]
                          9. Recombined 3 regimes into one program.
                          10. Final simplification94.9%

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

                          Alternative 7: 82.5% accurate, 5.2× speedup?

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

                            1. Initial program 75.0%

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

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

                                \[\leadsto \left(4 \cdot \left({a}^{2} \cdot \left(1 - a\right)\right) + {a}^{4}\right) - \color{blue}{1 \cdot 1} \]
                              2. fp-cancel-sub-sign-invN/A

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

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

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

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

                                \[\leadsto \left({a}^{2} \cdot {a}^{2} + 4 \cdot \color{blue}{\left(\left(1 - a\right) \cdot {a}^{2}\right)}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
                              7. associate-*r*N/A

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

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

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

                                \[\leadsto \left({a}^{2} \cdot {a}^{2} + \left(4 - \color{blue}{\left(\mathsf{neg}\left(-4\right)\right)} \cdot a\right) \cdot {a}^{2}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
                              11. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

                            if 0.044999999999999998 < b

                            1. Initial program 72.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto {b}^{2} \cdot \left(4 \cdot \left(3 + a\right) + {b}^{2}\right) - \color{blue}{1 \cdot 1} \]
                              13. fp-cancel-sub-sign-invN/A

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

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

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

                                \[\leadsto \color{blue}{\left(\left(4 \cdot \left(3 + a\right) + {b}^{2}\right) \cdot b\right) \cdot b} + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
                            5. Applied rewrites91.9%

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

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

                          Alternative 8: 83.1% accurate, 5.5× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -5500 \lor \neg \left(a \leq 39000000\right):\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\left(12 \cdot b\right) \cdot b - 1\\ \end{array} \end{array} \]
                          (FPCore (a b)
                           :precision binary64
                           (if (or (<= a -5500.0) (not (<= a 39000000.0)))
                             (* (* a a) (* a a))
                             (- (* (* 12.0 b) b) 1.0)))
                          double code(double a, double b) {
                          	double tmp;
                          	if ((a <= -5500.0) || !(a <= 39000000.0)) {
                          		tmp = (a * a) * (a * a);
                          	} else {
                          		tmp = ((12.0 * b) * b) - 1.0;
                          	}
                          	return tmp;
                          }
                          
                          module fmin_fmax_functions
                              implicit none
                              private
                              public fmax
                              public fmin
                          
                              interface fmax
                                  module procedure fmax88
                                  module procedure fmax44
                                  module procedure fmax84
                                  module procedure fmax48
                              end interface
                              interface fmin
                                  module procedure fmin88
                                  module procedure fmin44
                                  module procedure fmin84
                                  module procedure fmin48
                              end interface
                          contains
                              real(8) function fmax88(x, y) result (res)
                                  real(8), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                              end function
                              real(4) function fmax44(x, y) result (res)
                                  real(4), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                              end function
                              real(8) function fmax84(x, y) result(res)
                                  real(8), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                              end function
                              real(8) function fmax48(x, y) result(res)
                                  real(4), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                              end function
                              real(8) function fmin88(x, y) result (res)
                                  real(8), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                              end function
                              real(4) function fmin44(x, y) result (res)
                                  real(4), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                              end function
                              real(8) function fmin84(x, y) result(res)
                                  real(8), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                              end function
                              real(8) function fmin48(x, y) result(res)
                                  real(4), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                              end function
                          end module
                          
                          real(8) function code(a, b)
                          use fmin_fmax_functions
                              real(8), intent (in) :: a
                              real(8), intent (in) :: b
                              real(8) :: tmp
                              if ((a <= (-5500.0d0)) .or. (.not. (a <= 39000000.0d0))) then
                                  tmp = (a * a) * (a * a)
                              else
                                  tmp = ((12.0d0 * b) * b) - 1.0d0
                              end if
                              code = tmp
                          end function
                          
                          public static double code(double a, double b) {
                          	double tmp;
                          	if ((a <= -5500.0) || !(a <= 39000000.0)) {
                          		tmp = (a * a) * (a * a);
                          	} else {
                          		tmp = ((12.0 * b) * b) - 1.0;
                          	}
                          	return tmp;
                          }
                          
                          def code(a, b):
                          	tmp = 0
                          	if (a <= -5500.0) or not (a <= 39000000.0):
                          		tmp = (a * a) * (a * a)
                          	else:
                          		tmp = ((12.0 * b) * b) - 1.0
                          	return tmp
                          
                          function code(a, b)
                          	tmp = 0.0
                          	if ((a <= -5500.0) || !(a <= 39000000.0))
                          		tmp = Float64(Float64(a * a) * Float64(a * a));
                          	else
                          		tmp = Float64(Float64(Float64(12.0 * b) * b) - 1.0);
                          	end
                          	return tmp
                          end
                          
                          function tmp_2 = code(a, b)
                          	tmp = 0.0;
                          	if ((a <= -5500.0) || ~((a <= 39000000.0)))
                          		tmp = (a * a) * (a * a);
                          	else
                          		tmp = ((12.0 * b) * b) - 1.0;
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          code[a_, b_] := If[Or[LessEqual[a, -5500.0], N[Not[LessEqual[a, 39000000.0]], $MachinePrecision]], N[(N[(a * a), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(12.0 * b), $MachinePrecision] * b), $MachinePrecision] - 1.0), $MachinePrecision]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;a \leq -5500 \lor \neg \left(a \leq 39000000\right):\\
                          \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\left(12 \cdot b\right) \cdot b - 1\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if a < -5500 or 3.9e7 < a

                            1. Initial program 48.7%

                              \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
                            2. Add Preprocessing
                            3. Step-by-step derivation
                              1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \color{blue}{{a}^{4}} \]
                            6. Step-by-step derivation
                              1. lower-pow.f6491.2

                                \[\leadsto \color{blue}{{a}^{4}} \]
                            7. Applied rewrites91.2%

                              \[\leadsto \color{blue}{{a}^{4}} \]
                            8. Step-by-step derivation
                              1. Applied rewrites91.1%

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

                              if -5500 < a < 3.9e7

                              1. Initial program 99.9%

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot b}, 12, {b}^{4}\right) - 1 \]
                                5. lower-pow.f6498.7

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

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

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

                                  \[\leadsto \left(b \cdot b\right) \cdot \color{blue}{12} - 1 \]
                                2. Step-by-step derivation
                                  1. Applied rewrites68.4%

                                    \[\leadsto \left(12 \cdot b\right) \cdot b - 1 \]
                                3. Recombined 2 regimes into one program.
                                4. Final simplification79.7%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -5500 \lor \neg \left(a \leq 39000000\right):\\ \;\;\;\;\left(a \cdot a\right) \cdot \left(a \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\left(12 \cdot b\right) \cdot b - 1\\ \end{array} \]
                                5. Add Preprocessing

                                Alternative 9: 66.9% accurate, 7.0× speedup?

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

                                  1. Initial program 74.7%

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

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

                                      \[\leadsto \left(4 \cdot \left({a}^{2} \cdot \left(1 - a\right)\right) + {a}^{4}\right) - \color{blue}{1 \cdot 1} \]
                                    2. fp-cancel-sub-sign-invN/A

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

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

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

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

                                      \[\leadsto \left({a}^{2} \cdot {a}^{2} + 4 \cdot \color{blue}{\left(\left(1 - a\right) \cdot {a}^{2}\right)}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
                                    7. associate-*r*N/A

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

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

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

                                      \[\leadsto \left({a}^{2} \cdot {a}^{2} + \left(4 - \color{blue}{\left(\mathsf{neg}\left(-4\right)\right)} \cdot a\right) \cdot {a}^{2}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
                                    11. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

                                    \[\leadsto \mathsf{fma}\left(a \cdot a, 4, -1\right) \]
                                  7. Step-by-step derivation
                                    1. Applied rewrites57.5%

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

                                    if 1.36e17 < b

                                    1. Initial program 73.6%

                                      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1 \]
                                    2. Add Preprocessing
                                    3. Step-by-step derivation
                                      1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                        \[\leadsto \color{blue}{{b}^{4}} \]
                                    7. Applied rewrites93.3%

                                      \[\leadsto \color{blue}{{b}^{4}} \]
                                    8. Step-by-step derivation
                                      1. Applied rewrites93.3%

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

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

                                    Alternative 10: 60.9% accurate, 7.7× speedup?

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

                                      1. Initial program 76.2%

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

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

                                          \[\leadsto \left(4 \cdot \left({a}^{2} \cdot \left(1 - a\right)\right) + {a}^{4}\right) - \color{blue}{1 \cdot 1} \]
                                        2. fp-cancel-sub-sign-invN/A

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

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

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

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

                                          \[\leadsto \left({a}^{2} \cdot {a}^{2} + 4 \cdot \color{blue}{\left(\left(1 - a\right) \cdot {a}^{2}\right)}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
                                        7. associate-*r*N/A

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

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

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

                                          \[\leadsto \left({a}^{2} \cdot {a}^{2} + \left(4 - \color{blue}{\left(\mathsf{neg}\left(-4\right)\right)} \cdot a\right) \cdot {a}^{2}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
                                        11. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

                                        \[\leadsto \mathsf{fma}\left(a \cdot a, 4, -1\right) \]
                                      7. Step-by-step derivation
                                        1. Applied rewrites51.7%

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

                                        if 1.0500000000000001e152 < b

                                        1. Initial program 60.7%

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

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

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

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

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

                                            \[\leadsto \mathsf{fma}\left(\color{blue}{b \cdot b}, 12, {b}^{4}\right) - 1 \]
                                          5. lower-pow.f64100.0

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

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

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

                                            \[\leadsto \left(b \cdot b\right) \cdot \color{blue}{12} - 1 \]
                                          2. Step-by-step derivation
                                            1. Applied rewrites97.1%

                                              \[\leadsto \left(12 \cdot b\right) \cdot b - 1 \]
                                          3. Recombined 2 regimes into one program.
                                          4. Final simplification56.7%

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

                                          Alternative 11: 51.9% accurate, 12.9× speedup?

                                          \[\begin{array}{l} \\ \mathsf{fma}\left(a \cdot a, 4, -1\right) \end{array} \]
                                          (FPCore (a b) :precision binary64 (fma (* a a) 4.0 -1.0))
                                          double code(double a, double b) {
                                          	return fma((a * a), 4.0, -1.0);
                                          }
                                          
                                          function code(a, b)
                                          	return fma(Float64(a * a), 4.0, -1.0)
                                          end
                                          
                                          code[a_, b_] := N[(N[(a * a), $MachinePrecision] * 4.0 + -1.0), $MachinePrecision]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \mathsf{fma}\left(a \cdot a, 4, -1\right)
                                          \end{array}
                                          
                                          Derivation
                                          1. Initial program 74.5%

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

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

                                              \[\leadsto \left(4 \cdot \left({a}^{2} \cdot \left(1 - a\right)\right) + {a}^{4}\right) - \color{blue}{1 \cdot 1} \]
                                            2. fp-cancel-sub-sign-invN/A

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

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

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

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

                                              \[\leadsto \left({a}^{2} \cdot {a}^{2} + 4 \cdot \color{blue}{\left(\left(1 - a\right) \cdot {a}^{2}\right)}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
                                            7. associate-*r*N/A

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

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

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

                                              \[\leadsto \left({a}^{2} \cdot {a}^{2} + \left(4 - \color{blue}{\left(\mathsf{neg}\left(-4\right)\right)} \cdot a\right) \cdot {a}^{2}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
                                            11. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

                                            \[\leadsto \mathsf{fma}\left(a \cdot a, 4, -1\right) \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites49.0%

                                              \[\leadsto \mathsf{fma}\left(a \cdot a, 4, -1\right) \]
                                            2. Final simplification49.0%

                                              \[\leadsto \mathsf{fma}\left(a \cdot a, 4, -1\right) \]
                                            3. Add Preprocessing

                                            Alternative 12: 24.8% accurate, 155.0× speedup?

                                            \[\begin{array}{l} \\ -1 \end{array} \]
                                            (FPCore (a b) :precision binary64 -1.0)
                                            double code(double a, double b) {
                                            	return -1.0;
                                            }
                                            
                                            module fmin_fmax_functions
                                                implicit none
                                                private
                                                public fmax
                                                public fmin
                                            
                                                interface fmax
                                                    module procedure fmax88
                                                    module procedure fmax44
                                                    module procedure fmax84
                                                    module procedure fmax48
                                                end interface
                                                interface fmin
                                                    module procedure fmin88
                                                    module procedure fmin44
                                                    module procedure fmin84
                                                    module procedure fmin48
                                                end interface
                                            contains
                                                real(8) function fmax88(x, y) result (res)
                                                    real(8), intent (in) :: x
                                                    real(8), intent (in) :: y
                                                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                end function
                                                real(4) function fmax44(x, y) result (res)
                                                    real(4), intent (in) :: x
                                                    real(4), intent (in) :: y
                                                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                end function
                                                real(8) function fmax84(x, y) result(res)
                                                    real(8), intent (in) :: x
                                                    real(4), intent (in) :: y
                                                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                end function
                                                real(8) function fmax48(x, y) result(res)
                                                    real(4), intent (in) :: x
                                                    real(8), intent (in) :: y
                                                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                end function
                                                real(8) function fmin88(x, y) result (res)
                                                    real(8), intent (in) :: x
                                                    real(8), intent (in) :: y
                                                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                end function
                                                real(4) function fmin44(x, y) result (res)
                                                    real(4), intent (in) :: x
                                                    real(4), intent (in) :: y
                                                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                end function
                                                real(8) function fmin84(x, y) result(res)
                                                    real(8), intent (in) :: x
                                                    real(4), intent (in) :: y
                                                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                end function
                                                real(8) function fmin48(x, y) result(res)
                                                    real(4), intent (in) :: x
                                                    real(8), intent (in) :: y
                                                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                end function
                                            end module
                                            
                                            real(8) function code(a, b)
                                            use fmin_fmax_functions
                                                real(8), intent (in) :: a
                                                real(8), intent (in) :: b
                                                code = -1.0d0
                                            end function
                                            
                                            public static double code(double a, double b) {
                                            	return -1.0;
                                            }
                                            
                                            def code(a, b):
                                            	return -1.0
                                            
                                            function code(a, b)
                                            	return -1.0
                                            end
                                            
                                            function tmp = code(a, b)
                                            	tmp = -1.0;
                                            end
                                            
                                            code[a_, b_] := -1.0
                                            
                                            \begin{array}{l}
                                            
                                            \\
                                            -1
                                            \end{array}
                                            
                                            Derivation
                                            1. Initial program 74.5%

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

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

                                                \[\leadsto \left(12 \cdot {b}^{2} + {b}^{4}\right) - \color{blue}{1 \cdot 1} \]
                                              2. fp-cancel-sub-sign-invN/A

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

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

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

                                                \[\leadsto \left(\color{blue}{{b}^{2} \cdot {b}^{2}} + 12 \cdot {b}^{2}\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1 \]
                                              6. distribute-rgt-outN/A

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

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

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

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

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

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

                                                \[\leadsto \mathsf{fma}\left(b \cdot b, \color{blue}{b \cdot b} + 12, -1\right) \]
                                              13. lower-fma.f6469.0

                                                \[\leadsto \mathsf{fma}\left(b \cdot b, \color{blue}{\mathsf{fma}\left(b, b, 12\right)}, -1\right) \]
                                            5. Applied rewrites69.0%

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

                                              \[\leadsto -1 \]
                                            7. Step-by-step derivation
                                              1. Applied rewrites24.4%

                                                \[\leadsto -1 \]
                                              2. Final simplification24.4%

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

                                              Reproduce

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