Rosa's FloatVsDoubleBenchmark

Percentage Accurate: 70.4% → 99.7%
Time: 28.7s
Alternatives: 18
Speedup: 5.5×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(3 \cdot x1\right) \cdot x1\\ t_1 := x1 \cdot x1 + 1\\ t_2 := \frac{\left(t\_0 + 2 \cdot x2\right) - x1}{t\_1}\\ x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot t\_2 - 6\right)\right) \cdot t\_1 + t\_0 \cdot t\_2\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(t\_0 - 2 \cdot x2\right) - x1}{t\_1}\right) \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* (* 3.0 x1) x1))
        (t_1 (+ (* x1 x1) 1.0))
        (t_2 (/ (- (+ t_0 (* 2.0 x2)) x1) t_1)))
   (+
    x1
    (+
     (+
      (+
       (+
        (*
         (+
          (* (* (* 2.0 x1) t_2) (- t_2 3.0))
          (* (* x1 x1) (- (* 4.0 t_2) 6.0)))
         t_1)
        (* t_0 t_2))
       (* (* x1 x1) x1))
      x1)
     (* 3.0 (/ (- (- t_0 (* 2.0 x2)) x1) t_1))))))
double code(double x1, double x2) {
	double t_0 = (3.0 * x1) * x1;
	double t_1 = (x1 * x1) + 1.0;
	double t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	return x1 + (((((((((2.0 * x1) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((4.0 * t_2) - 6.0))) * t_1) + (t_0 * t_2)) + ((x1 * x1) * x1)) + x1) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)));
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    t_0 = (3.0d0 * x1) * x1
    t_1 = (x1 * x1) + 1.0d0
    t_2 = ((t_0 + (2.0d0 * x2)) - x1) / t_1
    code = x1 + (((((((((2.0d0 * x1) * t_2) * (t_2 - 3.0d0)) + ((x1 * x1) * ((4.0d0 * t_2) - 6.0d0))) * t_1) + (t_0 * t_2)) + ((x1 * x1) * x1)) + x1) + (3.0d0 * (((t_0 - (2.0d0 * x2)) - x1) / t_1)))
end function
public static double code(double x1, double x2) {
	double t_0 = (3.0 * x1) * x1;
	double t_1 = (x1 * x1) + 1.0;
	double t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	return x1 + (((((((((2.0 * x1) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((4.0 * t_2) - 6.0))) * t_1) + (t_0 * t_2)) + ((x1 * x1) * x1)) + x1) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)));
}
def code(x1, x2):
	t_0 = (3.0 * x1) * x1
	t_1 = (x1 * x1) + 1.0
	t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1
	return x1 + (((((((((2.0 * x1) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((4.0 * t_2) - 6.0))) * t_1) + (t_0 * t_2)) + ((x1 * x1) * x1)) + x1) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)))
function code(x1, x2)
	t_0 = Float64(Float64(3.0 * x1) * x1)
	t_1 = Float64(Float64(x1 * x1) + 1.0)
	t_2 = Float64(Float64(Float64(t_0 + Float64(2.0 * x2)) - x1) / t_1)
	return Float64(x1 + Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(2.0 * x1) * t_2) * Float64(t_2 - 3.0)) + Float64(Float64(x1 * x1) * Float64(Float64(4.0 * t_2) - 6.0))) * t_1) + Float64(t_0 * t_2)) + Float64(Float64(x1 * x1) * x1)) + x1) + Float64(3.0 * Float64(Float64(Float64(t_0 - Float64(2.0 * x2)) - x1) / t_1))))
end
function tmp = code(x1, x2)
	t_0 = (3.0 * x1) * x1;
	t_1 = (x1 * x1) + 1.0;
	t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	tmp = x1 + (((((((((2.0 * x1) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((4.0 * t_2) - 6.0))) * t_1) + (t_0 * t_2)) + ((x1 * x1) * x1)) + x1) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)));
end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$0 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]}, N[(x1 + N[(N[(N[(N[(N[(N[(N[(N[(N[(2.0 * x1), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(t$95$2 - 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * N[(N[(4.0 * t$95$2), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] + N[(t$95$0 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision] + N[(3.0 * N[(N[(N[(t$95$0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(3 \cdot x1\right) \cdot x1\\
t_1 := x1 \cdot x1 + 1\\
t_2 := \frac{\left(t\_0 + 2 \cdot x2\right) - x1}{t\_1}\\
x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot t\_2 - 6\right)\right) \cdot t\_1 + t\_0 \cdot t\_2\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(t\_0 - 2 \cdot x2\right) - x1}{t\_1}\right)
\end{array}
\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 18 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: 70.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(3 \cdot x1\right) \cdot x1\\ t_1 := x1 \cdot x1 + 1\\ t_2 := \frac{\left(t\_0 + 2 \cdot x2\right) - x1}{t\_1}\\ x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot t\_2 - 6\right)\right) \cdot t\_1 + t\_0 \cdot t\_2\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(t\_0 - 2 \cdot x2\right) - x1}{t\_1}\right) \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* (* 3.0 x1) x1))
        (t_1 (+ (* x1 x1) 1.0))
        (t_2 (/ (- (+ t_0 (* 2.0 x2)) x1) t_1)))
   (+
    x1
    (+
     (+
      (+
       (+
        (*
         (+
          (* (* (* 2.0 x1) t_2) (- t_2 3.0))
          (* (* x1 x1) (- (* 4.0 t_2) 6.0)))
         t_1)
        (* t_0 t_2))
       (* (* x1 x1) x1))
      x1)
     (* 3.0 (/ (- (- t_0 (* 2.0 x2)) x1) t_1))))))
double code(double x1, double x2) {
	double t_0 = (3.0 * x1) * x1;
	double t_1 = (x1 * x1) + 1.0;
	double t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	return x1 + (((((((((2.0 * x1) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((4.0 * t_2) - 6.0))) * t_1) + (t_0 * t_2)) + ((x1 * x1) * x1)) + x1) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)));
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    t_0 = (3.0d0 * x1) * x1
    t_1 = (x1 * x1) + 1.0d0
    t_2 = ((t_0 + (2.0d0 * x2)) - x1) / t_1
    code = x1 + (((((((((2.0d0 * x1) * t_2) * (t_2 - 3.0d0)) + ((x1 * x1) * ((4.0d0 * t_2) - 6.0d0))) * t_1) + (t_0 * t_2)) + ((x1 * x1) * x1)) + x1) + (3.0d0 * (((t_0 - (2.0d0 * x2)) - x1) / t_1)))
end function
public static double code(double x1, double x2) {
	double t_0 = (3.0 * x1) * x1;
	double t_1 = (x1 * x1) + 1.0;
	double t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	return x1 + (((((((((2.0 * x1) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((4.0 * t_2) - 6.0))) * t_1) + (t_0 * t_2)) + ((x1 * x1) * x1)) + x1) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)));
}
def code(x1, x2):
	t_0 = (3.0 * x1) * x1
	t_1 = (x1 * x1) + 1.0
	t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1
	return x1 + (((((((((2.0 * x1) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((4.0 * t_2) - 6.0))) * t_1) + (t_0 * t_2)) + ((x1 * x1) * x1)) + x1) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)))
function code(x1, x2)
	t_0 = Float64(Float64(3.0 * x1) * x1)
	t_1 = Float64(Float64(x1 * x1) + 1.0)
	t_2 = Float64(Float64(Float64(t_0 + Float64(2.0 * x2)) - x1) / t_1)
	return Float64(x1 + Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(2.0 * x1) * t_2) * Float64(t_2 - 3.0)) + Float64(Float64(x1 * x1) * Float64(Float64(4.0 * t_2) - 6.0))) * t_1) + Float64(t_0 * t_2)) + Float64(Float64(x1 * x1) * x1)) + x1) + Float64(3.0 * Float64(Float64(Float64(t_0 - Float64(2.0 * x2)) - x1) / t_1))))
end
function tmp = code(x1, x2)
	t_0 = (3.0 * x1) * x1;
	t_1 = (x1 * x1) + 1.0;
	t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	tmp = x1 + (((((((((2.0 * x1) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((4.0 * t_2) - 6.0))) * t_1) + (t_0 * t_2)) + ((x1 * x1) * x1)) + x1) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)));
end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$0 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]}, N[(x1 + N[(N[(N[(N[(N[(N[(N[(N[(N[(2.0 * x1), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(t$95$2 - 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * N[(N[(4.0 * t$95$2), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] + N[(t$95$0 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision] + N[(3.0 * N[(N[(N[(t$95$0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(3 \cdot x1\right) \cdot x1\\
t_1 := x1 \cdot x1 + 1\\
t_2 := \frac{\left(t\_0 + 2 \cdot x2\right) - x1}{t\_1}\\
x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot t\_2 - 6\right)\right) \cdot t\_1 + t\_0 \cdot t\_2\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(t\_0 - 2 \cdot x2\right) - x1}{t\_1}\right)
\end{array}
\end{array}

Alternative 1: 99.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\\ t_1 := x1 \cdot \left(x1 \cdot 3\right)\\ t_2 := x1 \cdot x1 + 1\\ t_3 := \frac{\left(t\_1 + 2 \cdot x2\right) - x1}{t\_2}\\ t_4 := 3 \cdot \left(x1 \cdot x1\right)\\ \mathbf{if}\;x1 + \left(\left(x1 + \left(\left(t\_2 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t\_3\right) \cdot \left(t\_3 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(t\_3 \cdot 4 - 6\right)\right) + t\_1 \cdot t\_3\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right) + 3 \cdot \frac{\left(t\_1 - 2 \cdot x2\right) - x1}{t\_2}\right) \leq \infty:\\ \;\;\;\;x1 + \mathsf{fma}\left(3, \frac{t\_4 - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(t\_0, 4, -6\right), \left(x1 \cdot \left(2 \cdot t\_0\right)\right) \cdot \left(t\_0 + -3\right)\right), \mathsf{fma}\left(t\_4, t\_0, {x1}^{3}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x1 \cdot x1\right) \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (/ (- (fma x1 (* x1 3.0) (* 2.0 x2)) x1) (fma x1 x1 1.0)))
        (t_1 (* x1 (* x1 3.0)))
        (t_2 (+ (* x1 x1) 1.0))
        (t_3 (/ (- (+ t_1 (* 2.0 x2)) x1) t_2))
        (t_4 (* 3.0 (* x1 x1))))
   (if (<=
        (+
         x1
         (+
          (+
           x1
           (+
            (+
             (*
              t_2
              (+
               (* (* (* x1 2.0) t_3) (- t_3 3.0))
               (* (* x1 x1) (- (* t_3 4.0) 6.0))))
             (* t_1 t_3))
            (* x1 (* x1 x1))))
          (* 3.0 (/ (- (- t_1 (* 2.0 x2)) x1) t_2))))
        INFINITY)
     (+
      x1
      (fma
       3.0
       (/ (- t_4 (fma 2.0 x2 x1)) (fma x1 x1 1.0))
       (+
        x1
        (fma
         (fma x1 x1 1.0)
         (fma x1 (* x1 (fma t_0 4.0 -6.0)) (* (* x1 (* 2.0 t_0)) (+ t_0 -3.0)))
         (fma t_4 t_0 (pow x1 3.0))))))
     (*
      (* x1 x1)
      (+ 9.0 (+ (* 4.0 (- (* 2.0 x2) 3.0)) (* x1 (- (* x1 6.0) 3.0))))))))
double code(double x1, double x2) {
	double t_0 = (fma(x1, (x1 * 3.0), (2.0 * x2)) - x1) / fma(x1, x1, 1.0);
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = (x1 * x1) + 1.0;
	double t_3 = ((t_1 + (2.0 * x2)) - x1) / t_2;
	double t_4 = 3.0 * (x1 * x1);
	double tmp;
	if ((x1 + ((x1 + (((t_2 * ((((x1 * 2.0) * t_3) * (t_3 - 3.0)) + ((x1 * x1) * ((t_3 * 4.0) - 6.0)))) + (t_1 * t_3)) + (x1 * (x1 * x1)))) + (3.0 * (((t_1 - (2.0 * x2)) - x1) / t_2)))) <= ((double) INFINITY)) {
		tmp = x1 + fma(3.0, ((t_4 - fma(2.0, x2, x1)) / fma(x1, x1, 1.0)), (x1 + fma(fma(x1, x1, 1.0), fma(x1, (x1 * fma(t_0, 4.0, -6.0)), ((x1 * (2.0 * t_0)) * (t_0 + -3.0))), fma(t_4, t_0, pow(x1, 3.0)))));
	} else {
		tmp = (x1 * x1) * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))));
	}
	return tmp;
}
function code(x1, x2)
	t_0 = Float64(Float64(fma(x1, Float64(x1 * 3.0), Float64(2.0 * x2)) - x1) / fma(x1, x1, 1.0))
	t_1 = Float64(x1 * Float64(x1 * 3.0))
	t_2 = Float64(Float64(x1 * x1) + 1.0)
	t_3 = Float64(Float64(Float64(t_1 + Float64(2.0 * x2)) - x1) / t_2)
	t_4 = Float64(3.0 * Float64(x1 * x1))
	tmp = 0.0
	if (Float64(x1 + Float64(Float64(x1 + Float64(Float64(Float64(t_2 * Float64(Float64(Float64(Float64(x1 * 2.0) * t_3) * Float64(t_3 - 3.0)) + Float64(Float64(x1 * x1) * Float64(Float64(t_3 * 4.0) - 6.0)))) + Float64(t_1 * t_3)) + Float64(x1 * Float64(x1 * x1)))) + Float64(3.0 * Float64(Float64(Float64(t_1 - Float64(2.0 * x2)) - x1) / t_2)))) <= Inf)
		tmp = Float64(x1 + fma(3.0, Float64(Float64(t_4 - fma(2.0, x2, x1)) / fma(x1, x1, 1.0)), Float64(x1 + fma(fma(x1, x1, 1.0), fma(x1, Float64(x1 * fma(t_0, 4.0, -6.0)), Float64(Float64(x1 * Float64(2.0 * t_0)) * Float64(t_0 + -3.0))), fma(t_4, t_0, (x1 ^ 3.0))))));
	else
		tmp = Float64(Float64(x1 * x1) * Float64(9.0 + Float64(Float64(4.0 * Float64(Float64(2.0 * x2) - 3.0)) + Float64(x1 * Float64(Float64(x1 * 6.0) - 3.0)))));
	end
	return tmp
end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(N[(x1 * N[(x1 * 3.0), $MachinePrecision] + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(t$95$1 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(3.0 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x1 + N[(N[(x1 + N[(N[(N[(t$95$2 * N[(N[(N[(N[(x1 * 2.0), $MachinePrecision] * t$95$3), $MachinePrecision] * N[(t$95$3 - 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * N[(N[(t$95$3 * 4.0), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(3.0 * N[(N[(N[(t$95$1 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(x1 + N[(3.0 * N[(N[(t$95$4 - N[(2.0 * x2 + x1), $MachinePrecision]), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision] + N[(x1 + N[(N[(x1 * x1 + 1.0), $MachinePrecision] * N[(x1 * N[(x1 * N[(t$95$0 * 4.0 + -6.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 * t$95$0 + N[Power[x1, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x1 * x1), $MachinePrecision] * N[(9.0 + N[(N[(4.0 * N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(N[(x1 * 6.0), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\\
t_1 := x1 \cdot \left(x1 \cdot 3\right)\\
t_2 := x1 \cdot x1 + 1\\
t_3 := \frac{\left(t\_1 + 2 \cdot x2\right) - x1}{t\_2}\\
t_4 := 3 \cdot \left(x1 \cdot x1\right)\\
\mathbf{if}\;x1 + \left(\left(x1 + \left(\left(t\_2 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t\_3\right) \cdot \left(t\_3 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(t\_3 \cdot 4 - 6\right)\right) + t\_1 \cdot t\_3\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right) + 3 \cdot \frac{\left(t\_1 - 2 \cdot x2\right) - x1}{t\_2}\right) \leq \infty:\\
\;\;\;\;x1 + \mathsf{fma}\left(3, \frac{t\_4 - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(t\_0, 4, -6\right), \left(x1 \cdot \left(2 \cdot t\_0\right)\right) \cdot \left(t\_0 + -3\right)\right), \mathsf{fma}\left(t\_4, t\_0, {x1}^{3}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x1 \cdot x1\right) \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x1 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 (+.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) x1) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64)))) (-.f64 (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))) #s(literal 3 binary64))) (*.f64 (*.f64 x1 x1) (-.f64 (*.f64 #s(literal 4 binary64) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64)))) #s(literal 6 binary64)))) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))) (*.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))))) (*.f64 (*.f64 x1 x1) x1)) x1) (*.f64 #s(literal 3 binary64) (/.f64 (-.f64 (-.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64)))))) < +inf.0

    1. Initial program 99.4%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified99.7%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right), \left(x1 \cdot \left(2 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right) \cdot \left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right), \mathsf{fma}\left(3 \cdot \left(x1 \cdot x1\right), \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)} \]
    3. Add Preprocessing

    if +inf.0 < (+.f64 x1 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 (+.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) x1) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64)))) (-.f64 (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))) #s(literal 3 binary64))) (*.f64 (*.f64 x1 x1) (-.f64 (*.f64 #s(literal 4 binary64) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64)))) #s(literal 6 binary64)))) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))) (*.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))))) (*.f64 (*.f64 x1 x1) x1)) x1) (*.f64 #s(literal 3 binary64) (/.f64 (-.f64 (-.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))))))

    1. Initial program 0.0%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified0.0%

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

      \[\leadsto \color{blue}{{x1}^{4} \cdot \left(6 + -1 \cdot \frac{3 + -1 \cdot \frac{9 + 4 \cdot \left(2 \cdot x2 - 3\right)}{x1}}{x1}\right)} \]
    5. Taylor expanded in x1 around 0 100.0%

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

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(6 \cdot x1 - 3\right)\right)\right) \]
    7. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(6 \cdot x1 - 3\right)\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.8%

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

Alternative 2: 99.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot \left(x1 \cdot 3\right)\\ t_1 := x1 \cdot x1 + 1\\ t_2 := \frac{\left(t\_0 + 2 \cdot x2\right) - x1}{t\_1}\\ t_3 := x1 + \left(\left(x1 + \left(\left(t\_1 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(t\_2 \cdot 4 - 6\right)\right) + t\_0 \cdot t\_2\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right) + 3 \cdot \frac{\left(t\_0 - 2 \cdot x2\right) - x1}{t\_1}\right)\\ \mathbf{if}\;t\_3 \leq \infty:\\ \;\;\;\;t\_3\\ \mathbf{else}:\\ \;\;\;\;\left(x1 \cdot x1\right) \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* x1 (* x1 3.0)))
        (t_1 (+ (* x1 x1) 1.0))
        (t_2 (/ (- (+ t_0 (* 2.0 x2)) x1) t_1))
        (t_3
         (+
          x1
          (+
           (+
            x1
            (+
             (+
              (*
               t_1
               (+
                (* (* (* x1 2.0) t_2) (- t_2 3.0))
                (* (* x1 x1) (- (* t_2 4.0) 6.0))))
              (* t_0 t_2))
             (* x1 (* x1 x1))))
           (* 3.0 (/ (- (- t_0 (* 2.0 x2)) x1) t_1))))))
   (if (<= t_3 INFINITY)
     t_3
     (*
      (* x1 x1)
      (+ 9.0 (+ (* 4.0 (- (* 2.0 x2) 3.0)) (* x1 (- (* x1 6.0) 3.0))))))))
double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = (x1 * x1) + 1.0;
	double t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	double t_3 = x1 + ((x1 + (((t_1 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((t_2 * 4.0) - 6.0)))) + (t_0 * t_2)) + (x1 * (x1 * x1)))) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)));
	double tmp;
	if (t_3 <= ((double) INFINITY)) {
		tmp = t_3;
	} else {
		tmp = (x1 * x1) * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))));
	}
	return tmp;
}
public static double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = (x1 * x1) + 1.0;
	double t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	double t_3 = x1 + ((x1 + (((t_1 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((t_2 * 4.0) - 6.0)))) + (t_0 * t_2)) + (x1 * (x1 * x1)))) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)));
	double tmp;
	if (t_3 <= Double.POSITIVE_INFINITY) {
		tmp = t_3;
	} else {
		tmp = (x1 * x1) * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))));
	}
	return tmp;
}
def code(x1, x2):
	t_0 = x1 * (x1 * 3.0)
	t_1 = (x1 * x1) + 1.0
	t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1
	t_3 = x1 + ((x1 + (((t_1 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((t_2 * 4.0) - 6.0)))) + (t_0 * t_2)) + (x1 * (x1 * x1)))) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)))
	tmp = 0
	if t_3 <= math.inf:
		tmp = t_3
	else:
		tmp = (x1 * x1) * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))))
	return tmp
function code(x1, x2)
	t_0 = Float64(x1 * Float64(x1 * 3.0))
	t_1 = Float64(Float64(x1 * x1) + 1.0)
	t_2 = Float64(Float64(Float64(t_0 + Float64(2.0 * x2)) - x1) / t_1)
	t_3 = Float64(x1 + Float64(Float64(x1 + Float64(Float64(Float64(t_1 * Float64(Float64(Float64(Float64(x1 * 2.0) * t_2) * Float64(t_2 - 3.0)) + Float64(Float64(x1 * x1) * Float64(Float64(t_2 * 4.0) - 6.0)))) + Float64(t_0 * t_2)) + Float64(x1 * Float64(x1 * x1)))) + Float64(3.0 * Float64(Float64(Float64(t_0 - Float64(2.0 * x2)) - x1) / t_1))))
	tmp = 0.0
	if (t_3 <= Inf)
		tmp = t_3;
	else
		tmp = Float64(Float64(x1 * x1) * Float64(9.0 + Float64(Float64(4.0 * Float64(Float64(2.0 * x2) - 3.0)) + Float64(x1 * Float64(Float64(x1 * 6.0) - 3.0)))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = x1 * (x1 * 3.0);
	t_1 = (x1 * x1) + 1.0;
	t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	t_3 = x1 + ((x1 + (((t_1 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((t_2 * 4.0) - 6.0)))) + (t_0 * t_2)) + (x1 * (x1 * x1)))) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)));
	tmp = 0.0;
	if (t_3 <= Inf)
		tmp = t_3;
	else
		tmp = (x1 * x1) * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$0 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(x1 + N[(N[(x1 + N[(N[(N[(t$95$1 * N[(N[(N[(N[(x1 * 2.0), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(t$95$2 - 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * N[(N[(t$95$2 * 4.0), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(3.0 * N[(N[(N[(t$95$0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, Infinity], t$95$3, N[(N[(x1 * x1), $MachinePrecision] * N[(9.0 + N[(N[(4.0 * N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(N[(x1 * 6.0), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 \cdot \left(x1 \cdot 3\right)\\
t_1 := x1 \cdot x1 + 1\\
t_2 := \frac{\left(t\_0 + 2 \cdot x2\right) - x1}{t\_1}\\
t_3 := x1 + \left(\left(x1 + \left(\left(t\_1 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(t\_2 \cdot 4 - 6\right)\right) + t\_0 \cdot t\_2\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right) + 3 \cdot \frac{\left(t\_0 - 2 \cdot x2\right) - x1}{t\_1}\right)\\
\mathbf{if}\;t\_3 \leq \infty:\\
\;\;\;\;t\_3\\

\mathbf{else}:\\
\;\;\;\;\left(x1 \cdot x1\right) \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x1 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 (+.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) x1) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64)))) (-.f64 (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))) #s(literal 3 binary64))) (*.f64 (*.f64 x1 x1) (-.f64 (*.f64 #s(literal 4 binary64) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64)))) #s(literal 6 binary64)))) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))) (*.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))))) (*.f64 (*.f64 x1 x1) x1)) x1) (*.f64 #s(literal 3 binary64) (/.f64 (-.f64 (-.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64)))))) < +inf.0

    1. Initial program 99.4%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Add Preprocessing

    if +inf.0 < (+.f64 x1 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 (+.f64 (*.f64 (*.f64 (*.f64 #s(literal 2 binary64) x1) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64)))) (-.f64 (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))) #s(literal 3 binary64))) (*.f64 (*.f64 x1 x1) (-.f64 (*.f64 #s(literal 4 binary64) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64)))) #s(literal 6 binary64)))) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))) (*.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))))) (*.f64 (*.f64 x1 x1) x1)) x1) (*.f64 #s(literal 3 binary64) (/.f64 (-.f64 (-.f64 (*.f64 (*.f64 #s(literal 3 binary64) x1) x1) (*.f64 #s(literal 2 binary64) x2)) x1) (+.f64 (*.f64 x1 x1) #s(literal 1 binary64))))))

    1. Initial program 0.0%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified0.0%

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

      \[\leadsto \color{blue}{{x1}^{4} \cdot \left(6 + -1 \cdot \frac{3 + -1 \cdot \frac{9 + 4 \cdot \left(2 \cdot x2 - 3\right)}{x1}}{x1}\right)} \]
    5. Taylor expanded in x1 around 0 100.0%

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

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(6 \cdot x1 - 3\right)\right)\right) \]
    7. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(6 \cdot x1 - 3\right)\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.6%

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

Alternative 3: 98.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot x1 + 1\\ t_1 := x1 \cdot \left(x1 \cdot 3\right)\\ t_2 := \frac{\left(t\_1 + 2 \cdot x2\right) - x1}{t\_0}\\ \mathbf{if}\;x1 \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\ \mathbf{elif}\;x1 \leq 10^{+147}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(t\_1 - 2 \cdot x2\right) - x1}{t\_0} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(t\_0 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(t\_2 \cdot 4 - 6\right)\right) + 3 \cdot t\_1\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (+ (* x1 x1) 1.0))
        (t_1 (* x1 (* x1 3.0)))
        (t_2 (/ (- (+ t_1 (* 2.0 x2)) x1) t_0)))
   (if (<= x1 -5.5e+102)
     (+ (* x2 -6.0) (* x1 (+ (* x1 (+ 9.0 (* x1 -19.0))) -1.0)))
     (if (<= x1 1e+147)
       (+
        x1
        (+
         (* 3.0 (/ (- (- t_1 (* 2.0 x2)) x1) t_0))
         (+
          x1
          (+
           (* x1 (* x1 x1))
           (+
            (*
             t_0
             (+
              (* (* (* x1 2.0) t_2) (- t_2 3.0))
              (* (* x1 x1) (- (* t_2 4.0) 6.0))))
            (* 3.0 t_1))))))
       (* x1 (+ (* x1 9.0) -1.0))))))
double code(double x1, double x2) {
	double t_0 = (x1 * x1) + 1.0;
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0;
	double tmp;
	if (x1 <= -5.5e+102) {
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	} else if (x1 <= 1e+147) {
		tmp = x1 + ((3.0 * (((t_1 - (2.0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((t_0 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((t_2 * 4.0) - 6.0)))) + (3.0 * t_1)))));
	} else {
		tmp = x1 * ((x1 * 9.0) + -1.0);
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = (x1 * x1) + 1.0d0
    t_1 = x1 * (x1 * 3.0d0)
    t_2 = ((t_1 + (2.0d0 * x2)) - x1) / t_0
    if (x1 <= (-5.5d+102)) then
        tmp = (x2 * (-6.0d0)) + (x1 * ((x1 * (9.0d0 + (x1 * (-19.0d0)))) + (-1.0d0)))
    else if (x1 <= 1d+147) then
        tmp = x1 + ((3.0d0 * (((t_1 - (2.0d0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((t_0 * ((((x1 * 2.0d0) * t_2) * (t_2 - 3.0d0)) + ((x1 * x1) * ((t_2 * 4.0d0) - 6.0d0)))) + (3.0d0 * t_1)))))
    else
        tmp = x1 * ((x1 * 9.0d0) + (-1.0d0))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = (x1 * x1) + 1.0;
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0;
	double tmp;
	if (x1 <= -5.5e+102) {
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	} else if (x1 <= 1e+147) {
		tmp = x1 + ((3.0 * (((t_1 - (2.0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((t_0 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((t_2 * 4.0) - 6.0)))) + (3.0 * t_1)))));
	} else {
		tmp = x1 * ((x1 * 9.0) + -1.0);
	}
	return tmp;
}
def code(x1, x2):
	t_0 = (x1 * x1) + 1.0
	t_1 = x1 * (x1 * 3.0)
	t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0
	tmp = 0
	if x1 <= -5.5e+102:
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0))
	elif x1 <= 1e+147:
		tmp = x1 + ((3.0 * (((t_1 - (2.0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((t_0 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((t_2 * 4.0) - 6.0)))) + (3.0 * t_1)))))
	else:
		tmp = x1 * ((x1 * 9.0) + -1.0)
	return tmp
function code(x1, x2)
	t_0 = Float64(Float64(x1 * x1) + 1.0)
	t_1 = Float64(x1 * Float64(x1 * 3.0))
	t_2 = Float64(Float64(Float64(t_1 + Float64(2.0 * x2)) - x1) / t_0)
	tmp = 0.0
	if (x1 <= -5.5e+102)
		tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(Float64(x1 * Float64(9.0 + Float64(x1 * -19.0))) + -1.0)));
	elseif (x1 <= 1e+147)
		tmp = Float64(x1 + Float64(Float64(3.0 * Float64(Float64(Float64(t_1 - Float64(2.0 * x2)) - x1) / t_0)) + Float64(x1 + Float64(Float64(x1 * Float64(x1 * x1)) + Float64(Float64(t_0 * Float64(Float64(Float64(Float64(x1 * 2.0) * t_2) * Float64(t_2 - 3.0)) + Float64(Float64(x1 * x1) * Float64(Float64(t_2 * 4.0) - 6.0)))) + Float64(3.0 * t_1))))));
	else
		tmp = Float64(x1 * Float64(Float64(x1 * 9.0) + -1.0));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = (x1 * x1) + 1.0;
	t_1 = x1 * (x1 * 3.0);
	t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0;
	tmp = 0.0;
	if (x1 <= -5.5e+102)
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	elseif (x1 <= 1e+147)
		tmp = x1 + ((3.0 * (((t_1 - (2.0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((t_0 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((t_2 * 4.0) - 6.0)))) + (3.0 * t_1)))));
	else
		tmp = x1 * ((x1 * 9.0) + -1.0);
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$1 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[x1, -5.5e+102], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(N[(x1 * N[(9.0 + N[(x1 * -19.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1e+147], N[(x1 + N[(N[(3.0 * N[(N[(N[(t$95$1 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] + N[(x1 + N[(N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$0 * N[(N[(N[(N[(x1 * 2.0), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(t$95$2 - 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * N[(N[(t$95$2 * 4.0), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(3.0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x1 * N[(N[(x1 * 9.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 \cdot x1 + 1\\
t_1 := x1 \cdot \left(x1 \cdot 3\right)\\
t_2 := \frac{\left(t\_1 + 2 \cdot x2\right) - x1}{t\_0}\\
\mathbf{if}\;x1 \leq -5.5 \cdot 10^{+102}:\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\

\mathbf{elif}\;x1 \leq 10^{+147}:\\
\;\;\;\;x1 + \left(3 \cdot \frac{\left(t\_1 - 2 \cdot x2\right) - x1}{t\_0} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(t\_0 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(t\_2 \cdot 4 - 6\right)\right) + 3 \cdot t\_1\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -5.49999999999999981e102

    1. Initial program 0.0%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified16.1%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 71.4%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + \left(8 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + 2 \cdot \left(\left(1 + \left(-3 \cdot \left(3 + -2 \cdot x2\right) + 2 \cdot \left(x2 \cdot \left(3 - 2 \cdot x2\right)\right)\right)\right) - -2 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right)\right)\right) - 3\right)\right)\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + -19 \cdot x1\right)} - 1\right) \]
    6. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto -6 \cdot x2 + x1 \cdot \left(x1 \cdot \left(9 + \color{blue}{x1 \cdot -19}\right) - 1\right) \]
    7. Simplified100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + x1 \cdot -19\right)} - 1\right) \]

    if -5.49999999999999981e102 < x1 < 9.9999999999999998e146

    1. Initial program 99.4%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x1 around inf 99.1%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \color{blue}{3}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]

    if 9.9999999999999998e146 < x1

    1. Initial program 0.0%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified0.0%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 69.0%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \color{blue}{9}\right) - 1\right) \]
    6. Taylor expanded in x2 around 0 100.0%

      \[\leadsto \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right) + x2 \cdot \left(\left(-12 \cdot x1 + 8 \cdot \left(x1 \cdot x2\right)\right) - 6\right)} \]
    7. Taylor expanded in x2 around 0 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\ \mathbf{elif}\;x1 \leq 10^{+147}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(\left(x1 \cdot x1 + 1\right) \cdot \left(\left(\left(x1 \cdot 2\right) \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} \cdot 4 - 6\right)\right) + 3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 96.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot x1 + 1\\ t_1 := x1 \cdot \left(x1 \cdot 3\right)\\ t_2 := \frac{\left(t\_1 + 2 \cdot x2\right) - x1}{t\_0}\\ \mathbf{if}\;x1 \leq -2 \cdot 10^{+93}:\\ \;\;\;\;\left(x1 \cdot x1\right) \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 10^{+147}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(t\_1 - 2 \cdot x2\right) - x1}{t\_0} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(t\_1 \cdot t\_2 + t\_0 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot 6\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (+ (* x1 x1) 1.0))
        (t_1 (* x1 (* x1 3.0)))
        (t_2 (/ (- (+ t_1 (* 2.0 x2)) x1) t_0)))
   (if (<= x1 -2e+93)
     (*
      (* x1 x1)
      (+ 9.0 (+ (* 4.0 (- (* 2.0 x2) 3.0)) (* x1 (- (* x1 6.0) 3.0)))))
     (if (<= x1 1e+147)
       (+
        x1
        (+
         (* 3.0 (/ (- (- t_1 (* 2.0 x2)) x1) t_0))
         (+
          x1
          (+
           (* x1 (* x1 x1))
           (+
            (* t_1 t_2)
            (*
             t_0
             (+ (* (* (* x1 2.0) t_2) (- t_2 3.0)) (* (* x1 x1) 6.0))))))))
       (* x1 (+ (* x1 9.0) -1.0))))))
double code(double x1, double x2) {
	double t_0 = (x1 * x1) + 1.0;
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0;
	double tmp;
	if (x1 <= -2e+93) {
		tmp = (x1 * x1) * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))));
	} else if (x1 <= 1e+147) {
		tmp = x1 + ((3.0 * (((t_1 - (2.0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((t_1 * t_2) + (t_0 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * 6.0)))))));
	} else {
		tmp = x1 * ((x1 * 9.0) + -1.0);
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = (x1 * x1) + 1.0d0
    t_1 = x1 * (x1 * 3.0d0)
    t_2 = ((t_1 + (2.0d0 * x2)) - x1) / t_0
    if (x1 <= (-2d+93)) then
        tmp = (x1 * x1) * (9.0d0 + ((4.0d0 * ((2.0d0 * x2) - 3.0d0)) + (x1 * ((x1 * 6.0d0) - 3.0d0))))
    else if (x1 <= 1d+147) then
        tmp = x1 + ((3.0d0 * (((t_1 - (2.0d0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((t_1 * t_2) + (t_0 * ((((x1 * 2.0d0) * t_2) * (t_2 - 3.0d0)) + ((x1 * x1) * 6.0d0)))))))
    else
        tmp = x1 * ((x1 * 9.0d0) + (-1.0d0))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = (x1 * x1) + 1.0;
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0;
	double tmp;
	if (x1 <= -2e+93) {
		tmp = (x1 * x1) * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))));
	} else if (x1 <= 1e+147) {
		tmp = x1 + ((3.0 * (((t_1 - (2.0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((t_1 * t_2) + (t_0 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * 6.0)))))));
	} else {
		tmp = x1 * ((x1 * 9.0) + -1.0);
	}
	return tmp;
}
def code(x1, x2):
	t_0 = (x1 * x1) + 1.0
	t_1 = x1 * (x1 * 3.0)
	t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0
	tmp = 0
	if x1 <= -2e+93:
		tmp = (x1 * x1) * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))))
	elif x1 <= 1e+147:
		tmp = x1 + ((3.0 * (((t_1 - (2.0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((t_1 * t_2) + (t_0 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * 6.0)))))))
	else:
		tmp = x1 * ((x1 * 9.0) + -1.0)
	return tmp
function code(x1, x2)
	t_0 = Float64(Float64(x1 * x1) + 1.0)
	t_1 = Float64(x1 * Float64(x1 * 3.0))
	t_2 = Float64(Float64(Float64(t_1 + Float64(2.0 * x2)) - x1) / t_0)
	tmp = 0.0
	if (x1 <= -2e+93)
		tmp = Float64(Float64(x1 * x1) * Float64(9.0 + Float64(Float64(4.0 * Float64(Float64(2.0 * x2) - 3.0)) + Float64(x1 * Float64(Float64(x1 * 6.0) - 3.0)))));
	elseif (x1 <= 1e+147)
		tmp = Float64(x1 + Float64(Float64(3.0 * Float64(Float64(Float64(t_1 - Float64(2.0 * x2)) - x1) / t_0)) + Float64(x1 + Float64(Float64(x1 * Float64(x1 * x1)) + Float64(Float64(t_1 * t_2) + Float64(t_0 * Float64(Float64(Float64(Float64(x1 * 2.0) * t_2) * Float64(t_2 - 3.0)) + Float64(Float64(x1 * x1) * 6.0))))))));
	else
		tmp = Float64(x1 * Float64(Float64(x1 * 9.0) + -1.0));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = (x1 * x1) + 1.0;
	t_1 = x1 * (x1 * 3.0);
	t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0;
	tmp = 0.0;
	if (x1 <= -2e+93)
		tmp = (x1 * x1) * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))));
	elseif (x1 <= 1e+147)
		tmp = x1 + ((3.0 * (((t_1 - (2.0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((t_1 * t_2) + (t_0 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * 6.0)))))));
	else
		tmp = x1 * ((x1 * 9.0) + -1.0);
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$1 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[x1, -2e+93], N[(N[(x1 * x1), $MachinePrecision] * N[(9.0 + N[(N[(4.0 * N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(N[(x1 * 6.0), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1e+147], N[(x1 + N[(N[(3.0 * N[(N[(N[(t$95$1 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] + N[(x1 + N[(N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 * t$95$2), $MachinePrecision] + N[(t$95$0 * N[(N[(N[(N[(x1 * 2.0), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(t$95$2 - 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x1 * N[(N[(x1 * 9.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 \cdot x1 + 1\\
t_1 := x1 \cdot \left(x1 \cdot 3\right)\\
t_2 := \frac{\left(t\_1 + 2 \cdot x2\right) - x1}{t\_0}\\
\mathbf{if}\;x1 \leq -2 \cdot 10^{+93}:\\
\;\;\;\;\left(x1 \cdot x1\right) \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\\

\mathbf{elif}\;x1 \leq 10^{+147}:\\
\;\;\;\;x1 + \left(3 \cdot \frac{\left(t\_1 - 2 \cdot x2\right) - x1}{t\_0} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(t\_1 \cdot t\_2 + t\_0 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot 6\right)\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -2.00000000000000009e93

    1. Initial program 1.8%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified1.8%

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

      \[\leadsto \color{blue}{{x1}^{4} \cdot \left(6 + -1 \cdot \frac{3 + -1 \cdot \frac{9 + 4 \cdot \left(2 \cdot x2 - 3\right)}{x1}}{x1}\right)} \]
    5. Taylor expanded in x1 around 0 100.0%

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

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(6 \cdot x1 - 3\right)\right)\right) \]
    7. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(6 \cdot x1 - 3\right)\right)\right) \]

    if -2.00000000000000009e93 < x1 < 9.9999999999999998e146

    1. Initial program 99.4%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x1 around inf 97.9%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \color{blue}{3} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]

    if 9.9999999999999998e146 < x1

    1. Initial program 0.0%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified0.0%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 69.0%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \color{blue}{9}\right) - 1\right) \]
    6. Taylor expanded in x2 around 0 100.0%

      \[\leadsto \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right) + x2 \cdot \left(\left(-12 \cdot x1 + 8 \cdot \left(x1 \cdot x2\right)\right) - 6\right)} \]
    7. Taylor expanded in x2 around 0 100.0%

      \[\leadsto \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification98.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -2 \cdot 10^{+93}:\\ \;\;\;\;\left(x1 \cdot x1\right) \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 10^{+147}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(\left(x1 \cdot \left(x1 \cdot 3\right)\right) \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} + \left(x1 \cdot x1 + 1\right) \cdot \left(\left(\left(x1 \cdot 2\right) \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot 6\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 95.5% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot x1 + 1\\ t_1 := x1 \cdot \left(x1 \cdot 3\right)\\ t_2 := \frac{\left(t\_1 + 2 \cdot x2\right) - x1}{t\_0}\\ \mathbf{if}\;x1 \leq -5 \cdot 10^{+102}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\ \mathbf{elif}\;x1 \leq 5 \cdot 10^{+102}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(t\_1 - 2 \cdot x2\right) - x1}{t\_0} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot t\_1 + t\_0 \cdot \left(\left(x1 \cdot x1\right) \cdot \left(t\_2 \cdot 4 - 6\right) + \left(t\_2 - 3\right) \cdot \left(\left(x1 \cdot 2\right) \cdot \left(2 \cdot x2 - x1\right)\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(x1 \cdot 3 + 9\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (+ (* x1 x1) 1.0))
        (t_1 (* x1 (* x1 3.0)))
        (t_2 (/ (- (+ t_1 (* 2.0 x2)) x1) t_0)))
   (if (<= x1 -5e+102)
     (+ (* x2 -6.0) (* x1 (+ (* x1 (+ 9.0 (* x1 -19.0))) -1.0)))
     (if (<= x1 5e+102)
       (+
        x1
        (+
         (* 3.0 (/ (- (- t_1 (* 2.0 x2)) x1) t_0))
         (+
          x1
          (+
           (* x1 (* x1 x1))
           (+
            (* 3.0 t_1)
            (*
             t_0
             (+
              (* (* x1 x1) (- (* t_2 4.0) 6.0))
              (* (- t_2 3.0) (* (* x1 2.0) (- (* 2.0 x2) x1))))))))))
       (+ (* x2 -6.0) (* x1 (+ -1.0 (* x1 (+ (* x1 3.0) 9.0)))))))))
double code(double x1, double x2) {
	double t_0 = (x1 * x1) + 1.0;
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0;
	double tmp;
	if (x1 <= -5e+102) {
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	} else if (x1 <= 5e+102) {
		tmp = x1 + ((3.0 * (((t_1 - (2.0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_1) + (t_0 * (((x1 * x1) * ((t_2 * 4.0) - 6.0)) + ((t_2 - 3.0) * ((x1 * 2.0) * ((2.0 * x2) - x1)))))))));
	} else {
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))));
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = (x1 * x1) + 1.0d0
    t_1 = x1 * (x1 * 3.0d0)
    t_2 = ((t_1 + (2.0d0 * x2)) - x1) / t_0
    if (x1 <= (-5d+102)) then
        tmp = (x2 * (-6.0d0)) + (x1 * ((x1 * (9.0d0 + (x1 * (-19.0d0)))) + (-1.0d0)))
    else if (x1 <= 5d+102) then
        tmp = x1 + ((3.0d0 * (((t_1 - (2.0d0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((3.0d0 * t_1) + (t_0 * (((x1 * x1) * ((t_2 * 4.0d0) - 6.0d0)) + ((t_2 - 3.0d0) * ((x1 * 2.0d0) * ((2.0d0 * x2) - x1)))))))))
    else
        tmp = (x2 * (-6.0d0)) + (x1 * ((-1.0d0) + (x1 * ((x1 * 3.0d0) + 9.0d0))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = (x1 * x1) + 1.0;
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0;
	double tmp;
	if (x1 <= -5e+102) {
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	} else if (x1 <= 5e+102) {
		tmp = x1 + ((3.0 * (((t_1 - (2.0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_1) + (t_0 * (((x1 * x1) * ((t_2 * 4.0) - 6.0)) + ((t_2 - 3.0) * ((x1 * 2.0) * ((2.0 * x2) - x1)))))))));
	} else {
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))));
	}
	return tmp;
}
def code(x1, x2):
	t_0 = (x1 * x1) + 1.0
	t_1 = x1 * (x1 * 3.0)
	t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0
	tmp = 0
	if x1 <= -5e+102:
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0))
	elif x1 <= 5e+102:
		tmp = x1 + ((3.0 * (((t_1 - (2.0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_1) + (t_0 * (((x1 * x1) * ((t_2 * 4.0) - 6.0)) + ((t_2 - 3.0) * ((x1 * 2.0) * ((2.0 * x2) - x1)))))))))
	else:
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))))
	return tmp
function code(x1, x2)
	t_0 = Float64(Float64(x1 * x1) + 1.0)
	t_1 = Float64(x1 * Float64(x1 * 3.0))
	t_2 = Float64(Float64(Float64(t_1 + Float64(2.0 * x2)) - x1) / t_0)
	tmp = 0.0
	if (x1 <= -5e+102)
		tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(Float64(x1 * Float64(9.0 + Float64(x1 * -19.0))) + -1.0)));
	elseif (x1 <= 5e+102)
		tmp = Float64(x1 + Float64(Float64(3.0 * Float64(Float64(Float64(t_1 - Float64(2.0 * x2)) - x1) / t_0)) + Float64(x1 + Float64(Float64(x1 * Float64(x1 * x1)) + Float64(Float64(3.0 * t_1) + Float64(t_0 * Float64(Float64(Float64(x1 * x1) * Float64(Float64(t_2 * 4.0) - 6.0)) + Float64(Float64(t_2 - 3.0) * Float64(Float64(x1 * 2.0) * Float64(Float64(2.0 * x2) - x1))))))))));
	else
		tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(-1.0 + Float64(x1 * Float64(Float64(x1 * 3.0) + 9.0)))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = (x1 * x1) + 1.0;
	t_1 = x1 * (x1 * 3.0);
	t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0;
	tmp = 0.0;
	if (x1 <= -5e+102)
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	elseif (x1 <= 5e+102)
		tmp = x1 + ((3.0 * (((t_1 - (2.0 * x2)) - x1) / t_0)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_1) + (t_0 * (((x1 * x1) * ((t_2 * 4.0) - 6.0)) + ((t_2 - 3.0) * ((x1 * 2.0) * ((2.0 * x2) - x1)))))))));
	else
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$1 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[x1, -5e+102], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(N[(x1 * N[(9.0 + N[(x1 * -19.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 5e+102], N[(x1 + N[(N[(3.0 * N[(N[(N[(t$95$1 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] + N[(x1 + N[(N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + N[(N[(3.0 * t$95$1), $MachinePrecision] + N[(t$95$0 * N[(N[(N[(x1 * x1), $MachinePrecision] * N[(N[(t$95$2 * 4.0), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - 3.0), $MachinePrecision] * N[(N[(x1 * 2.0), $MachinePrecision] * N[(N[(2.0 * x2), $MachinePrecision] - x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(-1.0 + N[(x1 * N[(N[(x1 * 3.0), $MachinePrecision] + 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 \cdot x1 + 1\\
t_1 := x1 \cdot \left(x1 \cdot 3\right)\\
t_2 := \frac{\left(t\_1 + 2 \cdot x2\right) - x1}{t\_0}\\
\mathbf{if}\;x1 \leq -5 \cdot 10^{+102}:\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\

\mathbf{elif}\;x1 \leq 5 \cdot 10^{+102}:\\
\;\;\;\;x1 + \left(3 \cdot \frac{\left(t\_1 - 2 \cdot x2\right) - x1}{t\_0} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot t\_1 + t\_0 \cdot \left(\left(x1 \cdot x1\right) \cdot \left(t\_2 \cdot 4 - 6\right) + \left(t\_2 - 3\right) \cdot \left(\left(x1 \cdot 2\right) \cdot \left(2 \cdot x2 - x1\right)\right)\right)\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(x1 \cdot 3 + 9\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -5e102

    1. Initial program 0.0%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified16.1%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 71.4%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + \left(8 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + 2 \cdot \left(\left(1 + \left(-3 \cdot \left(3 + -2 \cdot x2\right) + 2 \cdot \left(x2 \cdot \left(3 - 2 \cdot x2\right)\right)\right)\right) - -2 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right)\right)\right) - 3\right)\right)\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + -19 \cdot x1\right)} - 1\right) \]
    6. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto -6 \cdot x2 + x1 \cdot \left(x1 \cdot \left(9 + \color{blue}{x1 \cdot -19}\right) - 1\right) \]
    7. Simplified100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + x1 \cdot -19\right)} - 1\right) \]

    if -5e102 < x1 < 5e102

    1. Initial program 99.4%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x1 around 0 95.9%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \color{blue}{\left(-1 \cdot x1 + 2 \cdot x2\right)}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    4. Taylor expanded in x1 around inf 95.6%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \left(-1 \cdot x1 + 2 \cdot x2\right)\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \color{blue}{3}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]

    if 5e102 < x1

    1. Initial program 23.7%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified23.7%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right), \left(x1 \cdot \left(2 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right) \cdot \left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right), \mathsf{fma}\left(3 \cdot \left(x1 \cdot x1\right), \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 11.1%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(x1 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)}\right) \]
    5. Step-by-step derivation
      1. associate-*r*11.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \color{blue}{\left(\left(x1 \cdot x2\right) \cdot \left(2 \cdot x2 - 3\right)\right)}\right) \]
      2. fmm-def11.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \color{blue}{\mathsf{fma}\left(2, x2, -3\right)}\right)\right) \]
      3. metadata-eval11.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, \color{blue}{-3}\right)\right)\right) \]
    6. Simplified11.1%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, -3\right)\right)}\right) \]
    7. Taylor expanded in x1 around 0 92.1%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) + x1 \cdot \left(3 \cdot x1 + 3 \cdot \left(3 - -2 \cdot x2\right)\right)\right) - 1\right)} \]
    8. Taylor expanded in x2 around 0 100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + 3 \cdot x1\right)} - 1\right) \]
    9. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto -6 \cdot x2 + x1 \cdot \left(x1 \cdot \left(9 + \color{blue}{x1 \cdot 3}\right) - 1\right) \]
    10. Simplified100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + x1 \cdot 3\right)} - 1\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification97.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -5 \cdot 10^{+102}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\ \mathbf{elif}\;x1 \leq 5 \cdot 10^{+102}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left(x1 \cdot x1 + 1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} \cdot 4 - 6\right) + \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) \cdot \left(\left(x1 \cdot 2\right) \cdot \left(2 \cdot x2 - x1\right)\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(x1 \cdot 3 + 9\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 96.0% accurate, 4.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq -2.52 \cdot 10^{+14} \lor \neg \left(x1 \leq 11500\right):\\ \;\;\;\;\left(x1 \cdot x1\right) \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right) + x2 \cdot \left(x1 \cdot \left(x2 \cdot 8 - 12\right) - 6\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (or (<= x1 -2.52e+14) (not (<= x1 11500.0)))
   (*
    (* x1 x1)
    (+ 9.0 (+ (* 4.0 (- (* 2.0 x2) 3.0)) (* x1 (- (* x1 6.0) 3.0)))))
   (+ (* x1 (+ (* x1 9.0) -1.0)) (* x2 (- (* x1 (- (* x2 8.0) 12.0)) 6.0)))))
double code(double x1, double x2) {
	double tmp;
	if ((x1 <= -2.52e+14) || !(x1 <= 11500.0)) {
		tmp = (x1 * x1) * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))));
	} else {
		tmp = (x1 * ((x1 * 9.0) + -1.0)) + (x2 * ((x1 * ((x2 * 8.0) - 12.0)) - 6.0));
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if ((x1 <= (-2.52d+14)) .or. (.not. (x1 <= 11500.0d0))) then
        tmp = (x1 * x1) * (9.0d0 + ((4.0d0 * ((2.0d0 * x2) - 3.0d0)) + (x1 * ((x1 * 6.0d0) - 3.0d0))))
    else
        tmp = (x1 * ((x1 * 9.0d0) + (-1.0d0))) + (x2 * ((x1 * ((x2 * 8.0d0) - 12.0d0)) - 6.0d0))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if ((x1 <= -2.52e+14) || !(x1 <= 11500.0)) {
		tmp = (x1 * x1) * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))));
	} else {
		tmp = (x1 * ((x1 * 9.0) + -1.0)) + (x2 * ((x1 * ((x2 * 8.0) - 12.0)) - 6.0));
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if (x1 <= -2.52e+14) or not (x1 <= 11500.0):
		tmp = (x1 * x1) * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))))
	else:
		tmp = (x1 * ((x1 * 9.0) + -1.0)) + (x2 * ((x1 * ((x2 * 8.0) - 12.0)) - 6.0))
	return tmp
function code(x1, x2)
	tmp = 0.0
	if ((x1 <= -2.52e+14) || !(x1 <= 11500.0))
		tmp = Float64(Float64(x1 * x1) * Float64(9.0 + Float64(Float64(4.0 * Float64(Float64(2.0 * x2) - 3.0)) + Float64(x1 * Float64(Float64(x1 * 6.0) - 3.0)))));
	else
		tmp = Float64(Float64(x1 * Float64(Float64(x1 * 9.0) + -1.0)) + Float64(x2 * Float64(Float64(x1 * Float64(Float64(x2 * 8.0) - 12.0)) - 6.0)));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if ((x1 <= -2.52e+14) || ~((x1 <= 11500.0)))
		tmp = (x1 * x1) * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))));
	else
		tmp = (x1 * ((x1 * 9.0) + -1.0)) + (x2 * ((x1 * ((x2 * 8.0) - 12.0)) - 6.0));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[Or[LessEqual[x1, -2.52e+14], N[Not[LessEqual[x1, 11500.0]], $MachinePrecision]], N[(N[(x1 * x1), $MachinePrecision] * N[(9.0 + N[(N[(4.0 * N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(N[(x1 * 6.0), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x1 * N[(N[(x1 * 9.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + N[(x2 * N[(N[(x1 * N[(N[(x2 * 8.0), $MachinePrecision] - 12.0), $MachinePrecision]), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -2.52 \cdot 10^{+14} \lor \neg \left(x1 \leq 11500\right):\\
\;\;\;\;\left(x1 \cdot x1\right) \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right) + x2 \cdot \left(x1 \cdot \left(x2 \cdot 8 - 12\right) - 6\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -2.52e14 or 11500 < x1

    1. Initial program 36.4%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified36.4%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right), \left(x1 \cdot \left(2 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right) \cdot \left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right), \mathsf{fma}\left(3 \cdot \left(x1 \cdot x1\right), \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around -inf 93.2%

      \[\leadsto \color{blue}{{x1}^{4} \cdot \left(6 + -1 \cdot \frac{3 + -1 \cdot \frac{9 + 4 \cdot \left(2 \cdot x2 - 3\right)}{x1}}{x1}\right)} \]
    5. Taylor expanded in x1 around 0 93.2%

      \[\leadsto \color{blue}{{x1}^{2} \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(6 \cdot x1 - 3\right)\right)\right)} \]
    6. Step-by-step derivation
      1. unpow293.2%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(6 \cdot x1 - 3\right)\right)\right) \]
    7. Applied egg-rr93.2%

      \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(6 \cdot x1 - 3\right)\right)\right) \]

    if -2.52e14 < x1 < 11500

    1. Initial program 99.4%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified88.9%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 87.5%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 87.5%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \color{blue}{9}\right) - 1\right) \]
    6. Taylor expanded in x2 around 0 98.4%

      \[\leadsto \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right) + x2 \cdot \left(\left(-12 \cdot x1 + 8 \cdot \left(x1 \cdot x2\right)\right) - 6\right)} \]
    7. Taylor expanded in x1 around 0 98.4%

      \[\leadsto x1 \cdot \left(9 \cdot x1 - 1\right) + x2 \cdot \left(\color{blue}{x1 \cdot \left(8 \cdot x2 - 12\right)} - 6\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification95.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -2.52 \cdot 10^{+14} \lor \neg \left(x1 \leq 11500\right):\\ \;\;\;\;\left(x1 \cdot x1\right) \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right) + x2 \cdot \left(x1 \cdot \left(x2 \cdot 8 - 12\right) - 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 75.3% accurate, 4.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot \left(2 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\ \mathbf{if}\;x2 \leq -9.1 \cdot 10^{+223}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x2 \leq 5 \cdot 10^{-52}:\\ \;\;\;\;x2 \cdot \left(\frac{x1 \cdot \left(x1 \cdot 9 + -1\right)}{x2} - 6\right)\\ \mathbf{elif}\;x2 \leq 8.6 \cdot 10^{+227}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(9 + x2 \cdot 12\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* x1 (+ 2.0 (* 4.0 (* x2 (- (* 2.0 x2) 3.0)))))))
   (if (<= x2 -9.1e+223)
     t_0
     (if (<= x2 5e-52)
       (* x2 (- (/ (* x1 (+ (* x1 9.0) -1.0)) x2) 6.0))
       (if (<= x2 8.6e+227)
         (+ (* x2 -6.0) (* x1 (+ -1.0 (* x1 (+ 9.0 (* x2 12.0))))))
         t_0)))))
double code(double x1, double x2) {
	double t_0 = x1 * (2.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0))));
	double tmp;
	if (x2 <= -9.1e+223) {
		tmp = t_0;
	} else if (x2 <= 5e-52) {
		tmp = x2 * (((x1 * ((x1 * 9.0) + -1.0)) / x2) - 6.0);
	} else if (x2 <= 8.6e+227) {
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * (9.0 + (x2 * 12.0)))));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x1 * (2.0d0 + (4.0d0 * (x2 * ((2.0d0 * x2) - 3.0d0))))
    if (x2 <= (-9.1d+223)) then
        tmp = t_0
    else if (x2 <= 5d-52) then
        tmp = x2 * (((x1 * ((x1 * 9.0d0) + (-1.0d0))) / x2) - 6.0d0)
    else if (x2 <= 8.6d+227) then
        tmp = (x2 * (-6.0d0)) + (x1 * ((-1.0d0) + (x1 * (9.0d0 + (x2 * 12.0d0)))))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = x1 * (2.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0))));
	double tmp;
	if (x2 <= -9.1e+223) {
		tmp = t_0;
	} else if (x2 <= 5e-52) {
		tmp = x2 * (((x1 * ((x1 * 9.0) + -1.0)) / x2) - 6.0);
	} else if (x2 <= 8.6e+227) {
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * (9.0 + (x2 * 12.0)))));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x1, x2):
	t_0 = x1 * (2.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0))))
	tmp = 0
	if x2 <= -9.1e+223:
		tmp = t_0
	elif x2 <= 5e-52:
		tmp = x2 * (((x1 * ((x1 * 9.0) + -1.0)) / x2) - 6.0)
	elif x2 <= 8.6e+227:
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * (9.0 + (x2 * 12.0)))))
	else:
		tmp = t_0
	return tmp
function code(x1, x2)
	t_0 = Float64(x1 * Float64(2.0 + Float64(4.0 * Float64(x2 * Float64(Float64(2.0 * x2) - 3.0)))))
	tmp = 0.0
	if (x2 <= -9.1e+223)
		tmp = t_0;
	elseif (x2 <= 5e-52)
		tmp = Float64(x2 * Float64(Float64(Float64(x1 * Float64(Float64(x1 * 9.0) + -1.0)) / x2) - 6.0));
	elseif (x2 <= 8.6e+227)
		tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(-1.0 + Float64(x1 * Float64(9.0 + Float64(x2 * 12.0))))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = x1 * (2.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0))));
	tmp = 0.0;
	if (x2 <= -9.1e+223)
		tmp = t_0;
	elseif (x2 <= 5e-52)
		tmp = x2 * (((x1 * ((x1 * 9.0) + -1.0)) / x2) - 6.0);
	elseif (x2 <= 8.6e+227)
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * (9.0 + (x2 * 12.0)))));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(x1 * N[(2.0 + N[(4.0 * N[(x2 * N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x2, -9.1e+223], t$95$0, If[LessEqual[x2, 5e-52], N[(x2 * N[(N[(N[(x1 * N[(N[(x1 * 9.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] / x2), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x2, 8.6e+227], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(-1.0 + N[(x1 * N[(9.0 + N[(x2 * 12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 \cdot \left(2 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\
\mathbf{if}\;x2 \leq -9.1 \cdot 10^{+223}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x2 \leq 5 \cdot 10^{-52}:\\
\;\;\;\;x2 \cdot \left(\frac{x1 \cdot \left(x1 \cdot 9 + -1\right)}{x2} - 6\right)\\

\mathbf{elif}\;x2 \leq 8.6 \cdot 10^{+227}:\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(9 + x2 \cdot 12\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x2 < -9.10000000000000036e223 or 8.6e227 < x2

    1. Initial program 79.3%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified79.4%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right), \left(x1 \cdot \left(2 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right) \cdot \left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right), \mathsf{fma}\left(3 \cdot \left(x1 \cdot x1\right), \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 65.4%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(x1 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)}\right) \]
    5. Step-by-step derivation
      1. associate-*r*79.4%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \color{blue}{\left(\left(x1 \cdot x2\right) \cdot \left(2 \cdot x2 - 3\right)\right)}\right) \]
      2. fmm-def79.4%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \color{blue}{\mathsf{fma}\left(2, x2, -3\right)}\right)\right) \]
      3. metadata-eval79.4%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, \color{blue}{-3}\right)\right)\right) \]
    6. Simplified79.4%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, -3\right)\right)}\right) \]
    7. Taylor expanded in x1 around inf 77.1%

      \[\leadsto \color{blue}{x1 \cdot \left(2 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)} \]

    if -9.10000000000000036e223 < x2 < 5e-52

    1. Initial program 66.1%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified65.3%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 66.7%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 75.8%

      \[\leadsto -6 \cdot x2 + \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right)} \]
    6. Taylor expanded in x2 around inf 81.1%

      \[\leadsto \color{blue}{x2 \cdot \left(\frac{x1 \cdot \left(9 \cdot x1 - 1\right)}{x2} - 6\right)} \]

    if 5e-52 < x2 < 8.6e227

    1. Initial program 60.2%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified63.7%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 74.1%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 77.2%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{\left(9 \cdot x1 + x2 \cdot \left(\left(8 \cdot x2 + 12 \cdot x1\right) - 12\right)\right)} - 1\right) \]
    6. Taylor expanded in x1 around inf 73.5%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + 12 \cdot x2\right)} - 1\right) \]
    7. Step-by-step derivation
      1. *-commutative73.5%

        \[\leadsto -6 \cdot x2 + x1 \cdot \left(x1 \cdot \left(9 + \color{blue}{x2 \cdot 12}\right) - 1\right) \]
    8. Simplified73.5%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + x2 \cdot 12\right)} - 1\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification78.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x2 \leq -9.1 \cdot 10^{+223}:\\ \;\;\;\;x1 \cdot \left(2 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\ \mathbf{elif}\;x2 \leq 5 \cdot 10^{-52}:\\ \;\;\;\;x2 \cdot \left(\frac{x1 \cdot \left(x1 \cdot 9 + -1\right)}{x2} - 6\right)\\ \mathbf{elif}\;x2 \leq 8.6 \cdot 10^{+227}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(9 + x2 \cdot 12\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(2 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 87.5% accurate, 4.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq -1.08 \cdot 10^{+102}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\ \mathbf{elif}\;x1 \leq 1.9 \cdot 10^{+95}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right) + x2 \cdot \left(x1 \cdot \left(x2 \cdot 8 - 12\right) - 6\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(x1 \cdot 3 + 9\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (<= x1 -1.08e+102)
   (+ (* x2 -6.0) (* x1 (+ (* x1 (+ 9.0 (* x1 -19.0))) -1.0)))
   (if (<= x1 1.9e+95)
     (+ (* x1 (+ (* x1 9.0) -1.0)) (* x2 (- (* x1 (- (* x2 8.0) 12.0)) 6.0)))
     (+ (* x2 -6.0) (* x1 (+ -1.0 (* x1 (+ (* x1 3.0) 9.0))))))))
double code(double x1, double x2) {
	double tmp;
	if (x1 <= -1.08e+102) {
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	} else if (x1 <= 1.9e+95) {
		tmp = (x1 * ((x1 * 9.0) + -1.0)) + (x2 * ((x1 * ((x2 * 8.0) - 12.0)) - 6.0));
	} else {
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))));
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if (x1 <= (-1.08d+102)) then
        tmp = (x2 * (-6.0d0)) + (x1 * ((x1 * (9.0d0 + (x1 * (-19.0d0)))) + (-1.0d0)))
    else if (x1 <= 1.9d+95) then
        tmp = (x1 * ((x1 * 9.0d0) + (-1.0d0))) + (x2 * ((x1 * ((x2 * 8.0d0) - 12.0d0)) - 6.0d0))
    else
        tmp = (x2 * (-6.0d0)) + (x1 * ((-1.0d0) + (x1 * ((x1 * 3.0d0) + 9.0d0))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if (x1 <= -1.08e+102) {
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	} else if (x1 <= 1.9e+95) {
		tmp = (x1 * ((x1 * 9.0) + -1.0)) + (x2 * ((x1 * ((x2 * 8.0) - 12.0)) - 6.0));
	} else {
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))));
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if x1 <= -1.08e+102:
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0))
	elif x1 <= 1.9e+95:
		tmp = (x1 * ((x1 * 9.0) + -1.0)) + (x2 * ((x1 * ((x2 * 8.0) - 12.0)) - 6.0))
	else:
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))))
	return tmp
function code(x1, x2)
	tmp = 0.0
	if (x1 <= -1.08e+102)
		tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(Float64(x1 * Float64(9.0 + Float64(x1 * -19.0))) + -1.0)));
	elseif (x1 <= 1.9e+95)
		tmp = Float64(Float64(x1 * Float64(Float64(x1 * 9.0) + -1.0)) + Float64(x2 * Float64(Float64(x1 * Float64(Float64(x2 * 8.0) - 12.0)) - 6.0)));
	else
		tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(-1.0 + Float64(x1 * Float64(Float64(x1 * 3.0) + 9.0)))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if (x1 <= -1.08e+102)
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	elseif (x1 <= 1.9e+95)
		tmp = (x1 * ((x1 * 9.0) + -1.0)) + (x2 * ((x1 * ((x2 * 8.0) - 12.0)) - 6.0));
	else
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[LessEqual[x1, -1.08e+102], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(N[(x1 * N[(9.0 + N[(x1 * -19.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1.9e+95], N[(N[(x1 * N[(N[(x1 * 9.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + N[(x2 * N[(N[(x1 * N[(N[(x2 * 8.0), $MachinePrecision] - 12.0), $MachinePrecision]), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(-1.0 + N[(x1 * N[(N[(x1 * 3.0), $MachinePrecision] + 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -1.08 \cdot 10^{+102}:\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\

\mathbf{elif}\;x1 \leq 1.9 \cdot 10^{+95}:\\
\;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right) + x2 \cdot \left(x1 \cdot \left(x2 \cdot 8 - 12\right) - 6\right)\\

\mathbf{else}:\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(x1 \cdot 3 + 9\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -1.08000000000000002e102

    1. Initial program 0.0%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified16.1%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 71.4%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + \left(8 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + 2 \cdot \left(\left(1 + \left(-3 \cdot \left(3 + -2 \cdot x2\right) + 2 \cdot \left(x2 \cdot \left(3 - 2 \cdot x2\right)\right)\right)\right) - -2 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right)\right)\right) - 3\right)\right)\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + -19 \cdot x1\right)} - 1\right) \]
    6. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto -6 \cdot x2 + x1 \cdot \left(x1 \cdot \left(9 + \color{blue}{x1 \cdot -19}\right) - 1\right) \]
    7. Simplified100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + x1 \cdot -19\right)} - 1\right) \]

    if -1.08000000000000002e102 < x1 < 1.9e95

    1. Initial program 99.4%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified89.0%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 74.0%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 75.2%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \color{blue}{9}\right) - 1\right) \]
    6. Taylor expanded in x2 around 0 83.4%

      \[\leadsto \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right) + x2 \cdot \left(\left(-12 \cdot x1 + 8 \cdot \left(x1 \cdot x2\right)\right) - 6\right)} \]
    7. Taylor expanded in x1 around 0 83.4%

      \[\leadsto x1 \cdot \left(9 \cdot x1 - 1\right) + x2 \cdot \left(\color{blue}{x1 \cdot \left(8 \cdot x2 - 12\right)} - 6\right) \]

    if 1.9e95 < x1

    1. Initial program 25.6%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified25.6%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right), \left(x1 \cdot \left(2 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right) \cdot \left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right), \mathsf{fma}\left(3 \cdot \left(x1 \cdot x1\right), \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 11.0%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(x1 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)}\right) \]
    5. Step-by-step derivation
      1. associate-*r*11.0%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \color{blue}{\left(\left(x1 \cdot x2\right) \cdot \left(2 \cdot x2 - 3\right)\right)}\right) \]
      2. fmm-def11.0%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \color{blue}{\mathsf{fma}\left(2, x2, -3\right)}\right)\right) \]
      3. metadata-eval11.0%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, \color{blue}{-3}\right)\right)\right) \]
    6. Simplified11.0%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, -3\right)\right)}\right) \]
    7. Taylor expanded in x1 around 0 90.0%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) + x1 \cdot \left(3 \cdot x1 + 3 \cdot \left(3 - -2 \cdot x2\right)\right)\right) - 1\right)} \]
    8. Taylor expanded in x2 around 0 97.7%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + 3 \cdot x1\right)} - 1\right) \]
    9. Step-by-step derivation
      1. *-commutative97.7%

        \[\leadsto -6 \cdot x2 + x1 \cdot \left(x1 \cdot \left(9 + \color{blue}{x1 \cdot 3}\right) - 1\right) \]
    10. Simplified97.7%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + x1 \cdot 3\right)} - 1\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.08 \cdot 10^{+102}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\ \mathbf{elif}\;x1 \leq 1.9 \cdot 10^{+95}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right) + x2 \cdot \left(x1 \cdot \left(x2 \cdot 8 - 12\right) - 6\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(x1 \cdot 3 + 9\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 87.5% accurate, 4.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq -1.72 \cdot 10^{+102}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\ \mathbf{elif}\;x1 \leq 1.25 \cdot 10^{+96}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right) + x2 \cdot \left(x2 \cdot \left(x1 \cdot 8\right) - 6\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(x1 \cdot 3 + 9\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (<= x1 -1.72e+102)
   (+ (* x2 -6.0) (* x1 (+ (* x1 (+ 9.0 (* x1 -19.0))) -1.0)))
   (if (<= x1 1.25e+96)
     (+ (* x1 (+ (* x1 9.0) -1.0)) (* x2 (- (* x2 (* x1 8.0)) 6.0)))
     (+ (* x2 -6.0) (* x1 (+ -1.0 (* x1 (+ (* x1 3.0) 9.0))))))))
double code(double x1, double x2) {
	double tmp;
	if (x1 <= -1.72e+102) {
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	} else if (x1 <= 1.25e+96) {
		tmp = (x1 * ((x1 * 9.0) + -1.0)) + (x2 * ((x2 * (x1 * 8.0)) - 6.0));
	} else {
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))));
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if (x1 <= (-1.72d+102)) then
        tmp = (x2 * (-6.0d0)) + (x1 * ((x1 * (9.0d0 + (x1 * (-19.0d0)))) + (-1.0d0)))
    else if (x1 <= 1.25d+96) then
        tmp = (x1 * ((x1 * 9.0d0) + (-1.0d0))) + (x2 * ((x2 * (x1 * 8.0d0)) - 6.0d0))
    else
        tmp = (x2 * (-6.0d0)) + (x1 * ((-1.0d0) + (x1 * ((x1 * 3.0d0) + 9.0d0))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if (x1 <= -1.72e+102) {
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	} else if (x1 <= 1.25e+96) {
		tmp = (x1 * ((x1 * 9.0) + -1.0)) + (x2 * ((x2 * (x1 * 8.0)) - 6.0));
	} else {
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))));
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if x1 <= -1.72e+102:
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0))
	elif x1 <= 1.25e+96:
		tmp = (x1 * ((x1 * 9.0) + -1.0)) + (x2 * ((x2 * (x1 * 8.0)) - 6.0))
	else:
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))))
	return tmp
function code(x1, x2)
	tmp = 0.0
	if (x1 <= -1.72e+102)
		tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(Float64(x1 * Float64(9.0 + Float64(x1 * -19.0))) + -1.0)));
	elseif (x1 <= 1.25e+96)
		tmp = Float64(Float64(x1 * Float64(Float64(x1 * 9.0) + -1.0)) + Float64(x2 * Float64(Float64(x2 * Float64(x1 * 8.0)) - 6.0)));
	else
		tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(-1.0 + Float64(x1 * Float64(Float64(x1 * 3.0) + 9.0)))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if (x1 <= -1.72e+102)
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	elseif (x1 <= 1.25e+96)
		tmp = (x1 * ((x1 * 9.0) + -1.0)) + (x2 * ((x2 * (x1 * 8.0)) - 6.0));
	else
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[LessEqual[x1, -1.72e+102], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(N[(x1 * N[(9.0 + N[(x1 * -19.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1.25e+96], N[(N[(x1 * N[(N[(x1 * 9.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + N[(x2 * N[(N[(x2 * N[(x1 * 8.0), $MachinePrecision]), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(-1.0 + N[(x1 * N[(N[(x1 * 3.0), $MachinePrecision] + 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -1.72 \cdot 10^{+102}:\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\

\mathbf{elif}\;x1 \leq 1.25 \cdot 10^{+96}:\\
\;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right) + x2 \cdot \left(x2 \cdot \left(x1 \cdot 8\right) - 6\right)\\

\mathbf{else}:\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(x1 \cdot 3 + 9\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -1.72e102

    1. Initial program 0.0%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified16.1%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 71.4%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + \left(8 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + 2 \cdot \left(\left(1 + \left(-3 \cdot \left(3 + -2 \cdot x2\right) + 2 \cdot \left(x2 \cdot \left(3 - 2 \cdot x2\right)\right)\right)\right) - -2 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right)\right)\right) - 3\right)\right)\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + -19 \cdot x1\right)} - 1\right) \]
    6. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto -6 \cdot x2 + x1 \cdot \left(x1 \cdot \left(9 + \color{blue}{x1 \cdot -19}\right) - 1\right) \]
    7. Simplified100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + x1 \cdot -19\right)} - 1\right) \]

    if -1.72e102 < x1 < 1.2500000000000001e96

    1. Initial program 99.4%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified89.0%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 74.0%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 75.2%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \color{blue}{9}\right) - 1\right) \]
    6. Taylor expanded in x2 around 0 83.4%

      \[\leadsto \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right) + x2 \cdot \left(\left(-12 \cdot x1 + 8 \cdot \left(x1 \cdot x2\right)\right) - 6\right)} \]
    7. Taylor expanded in x2 around inf 83.2%

      \[\leadsto x1 \cdot \left(9 \cdot x1 - 1\right) + x2 \cdot \left(\color{blue}{8 \cdot \left(x1 \cdot x2\right)} - 6\right) \]
    8. Step-by-step derivation
      1. associate-*r*83.2%

        \[\leadsto x1 \cdot \left(9 \cdot x1 - 1\right) + x2 \cdot \left(\color{blue}{\left(8 \cdot x1\right) \cdot x2} - 6\right) \]
      2. *-commutative83.2%

        \[\leadsto x1 \cdot \left(9 \cdot x1 - 1\right) + x2 \cdot \left(\color{blue}{\left(x1 \cdot 8\right)} \cdot x2 - 6\right) \]
    9. Simplified83.2%

      \[\leadsto x1 \cdot \left(9 \cdot x1 - 1\right) + x2 \cdot \left(\color{blue}{\left(x1 \cdot 8\right) \cdot x2} - 6\right) \]

    if 1.2500000000000001e96 < x1

    1. Initial program 25.6%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified25.6%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right), \left(x1 \cdot \left(2 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right) \cdot \left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right), \mathsf{fma}\left(3 \cdot \left(x1 \cdot x1\right), \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 11.0%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(x1 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)}\right) \]
    5. Step-by-step derivation
      1. associate-*r*11.0%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \color{blue}{\left(\left(x1 \cdot x2\right) \cdot \left(2 \cdot x2 - 3\right)\right)}\right) \]
      2. fmm-def11.0%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \color{blue}{\mathsf{fma}\left(2, x2, -3\right)}\right)\right) \]
      3. metadata-eval11.0%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, \color{blue}{-3}\right)\right)\right) \]
    6. Simplified11.0%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, -3\right)\right)}\right) \]
    7. Taylor expanded in x1 around 0 90.0%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) + x1 \cdot \left(3 \cdot x1 + 3 \cdot \left(3 - -2 \cdot x2\right)\right)\right) - 1\right)} \]
    8. Taylor expanded in x2 around 0 97.7%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + 3 \cdot x1\right)} - 1\right) \]
    9. Step-by-step derivation
      1. *-commutative97.7%

        \[\leadsto -6 \cdot x2 + x1 \cdot \left(x1 \cdot \left(9 + \color{blue}{x1 \cdot 3}\right) - 1\right) \]
    10. Simplified97.7%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + x1 \cdot 3\right)} - 1\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.72 \cdot 10^{+102}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\ \mathbf{elif}\;x1 \leq 1.25 \cdot 10^{+96}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right) + x2 \cdot \left(x2 \cdot \left(x1 \cdot 8\right) - 6\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(x1 \cdot 3 + 9\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 81.4% accurate, 5.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq -1.92 \cdot 10^{+99}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\ \mathbf{elif}\;x1 \leq 1.25 \cdot 10^{+96}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x2 \cdot \left(x2 \cdot 8 - 12\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(x1 \cdot 3 + 9\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (<= x1 -1.92e+99)
   (+ (* x2 -6.0) (* x1 (+ (* x1 (+ 9.0 (* x1 -19.0))) -1.0)))
   (if (<= x1 1.25e+96)
     (+ (* x2 -6.0) (* x1 (+ -1.0 (* x2 (- (* x2 8.0) 12.0)))))
     (+ (* x2 -6.0) (* x1 (+ -1.0 (* x1 (+ (* x1 3.0) 9.0))))))))
double code(double x1, double x2) {
	double tmp;
	if (x1 <= -1.92e+99) {
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	} else if (x1 <= 1.25e+96) {
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x2 * ((x2 * 8.0) - 12.0))));
	} else {
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))));
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if (x1 <= (-1.92d+99)) then
        tmp = (x2 * (-6.0d0)) + (x1 * ((x1 * (9.0d0 + (x1 * (-19.0d0)))) + (-1.0d0)))
    else if (x1 <= 1.25d+96) then
        tmp = (x2 * (-6.0d0)) + (x1 * ((-1.0d0) + (x2 * ((x2 * 8.0d0) - 12.0d0))))
    else
        tmp = (x2 * (-6.0d0)) + (x1 * ((-1.0d0) + (x1 * ((x1 * 3.0d0) + 9.0d0))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if (x1 <= -1.92e+99) {
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	} else if (x1 <= 1.25e+96) {
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x2 * ((x2 * 8.0) - 12.0))));
	} else {
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))));
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if x1 <= -1.92e+99:
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0))
	elif x1 <= 1.25e+96:
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x2 * ((x2 * 8.0) - 12.0))))
	else:
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))))
	return tmp
function code(x1, x2)
	tmp = 0.0
	if (x1 <= -1.92e+99)
		tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(Float64(x1 * Float64(9.0 + Float64(x1 * -19.0))) + -1.0)));
	elseif (x1 <= 1.25e+96)
		tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(-1.0 + Float64(x2 * Float64(Float64(x2 * 8.0) - 12.0)))));
	else
		tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(-1.0 + Float64(x1 * Float64(Float64(x1 * 3.0) + 9.0)))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if (x1 <= -1.92e+99)
		tmp = (x2 * -6.0) + (x1 * ((x1 * (9.0 + (x1 * -19.0))) + -1.0));
	elseif (x1 <= 1.25e+96)
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x2 * ((x2 * 8.0) - 12.0))));
	else
		tmp = (x2 * -6.0) + (x1 * (-1.0 + (x1 * ((x1 * 3.0) + 9.0))));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[LessEqual[x1, -1.92e+99], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(N[(x1 * N[(9.0 + N[(x1 * -19.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1.25e+96], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(-1.0 + N[(x2 * N[(N[(x2 * 8.0), $MachinePrecision] - 12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(-1.0 + N[(x1 * N[(N[(x1 * 3.0), $MachinePrecision] + 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -1.92 \cdot 10^{+99}:\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\

\mathbf{elif}\;x1 \leq 1.25 \cdot 10^{+96}:\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x2 \cdot \left(x2 \cdot 8 - 12\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(x1 \cdot 3 + 9\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -1.9199999999999999e99

    1. Initial program 0.0%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified16.1%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 71.4%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + \left(8 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + 2 \cdot \left(\left(1 + \left(-3 \cdot \left(3 + -2 \cdot x2\right) + 2 \cdot \left(x2 \cdot \left(3 - 2 \cdot x2\right)\right)\right)\right) - -2 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right)\right)\right) - 3\right)\right)\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + -19 \cdot x1\right)} - 1\right) \]
    6. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto -6 \cdot x2 + x1 \cdot \left(x1 \cdot \left(9 + \color{blue}{x1 \cdot -19}\right) - 1\right) \]
    7. Simplified100.0%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + x1 \cdot -19\right)} - 1\right) \]

    if -1.9199999999999999e99 < x1 < 1.2500000000000001e96

    1. Initial program 99.4%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified89.0%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 74.0%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 75.2%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{\left(9 \cdot x1 + x2 \cdot \left(\left(8 \cdot x2 + 12 \cdot x1\right) - 12\right)\right)} - 1\right) \]
    6. Taylor expanded in x1 around 0 74.6%

      \[\leadsto -6 \cdot x2 + \color{blue}{x1 \cdot \left(x2 \cdot \left(8 \cdot x2 - 12\right) - 1\right)} \]

    if 1.2500000000000001e96 < x1

    1. Initial program 25.6%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified25.6%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right), \left(x1 \cdot \left(2 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right) \cdot \left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right), \mathsf{fma}\left(3 \cdot \left(x1 \cdot x1\right), \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 11.0%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(x1 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)}\right) \]
    5. Step-by-step derivation
      1. associate-*r*11.0%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \color{blue}{\left(\left(x1 \cdot x2\right) \cdot \left(2 \cdot x2 - 3\right)\right)}\right) \]
      2. fmm-def11.0%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \color{blue}{\mathsf{fma}\left(2, x2, -3\right)}\right)\right) \]
      3. metadata-eval11.0%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, \color{blue}{-3}\right)\right)\right) \]
    6. Simplified11.0%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, -3\right)\right)}\right) \]
    7. Taylor expanded in x1 around 0 90.0%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) + x1 \cdot \left(3 \cdot x1 + 3 \cdot \left(3 - -2 \cdot x2\right)\right)\right) - 1\right)} \]
    8. Taylor expanded in x2 around 0 97.7%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + 3 \cdot x1\right)} - 1\right) \]
    9. Step-by-step derivation
      1. *-commutative97.7%

        \[\leadsto -6 \cdot x2 + x1 \cdot \left(x1 \cdot \left(9 + \color{blue}{x1 \cdot 3}\right) - 1\right) \]
    10. Simplified97.7%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\color{blue}{x1 \cdot \left(9 + x1 \cdot 3\right)} - 1\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification83.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.92 \cdot 10^{+99}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot \left(9 + x1 \cdot -19\right) + -1\right)\\ \mathbf{elif}\;x1 \leq 1.25 \cdot 10^{+96}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x2 \cdot \left(x2 \cdot 8 - 12\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + x1 \cdot \left(x1 \cdot 3 + 9\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 74.1% accurate, 5.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x2 \leq -8.3 \cdot 10^{+223} \lor \neg \left(x2 \leq 2.75 \cdot 10^{+184}\right):\\ \;\;\;\;x1 \cdot \left(2 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot \left(\frac{x1 \cdot \left(x1 \cdot 9 + -1\right)}{x2} - 6\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (or (<= x2 -8.3e+223) (not (<= x2 2.75e+184)))
   (* x1 (+ 2.0 (* 4.0 (* x2 (- (* 2.0 x2) 3.0)))))
   (* x2 (- (/ (* x1 (+ (* x1 9.0) -1.0)) x2) 6.0))))
double code(double x1, double x2) {
	double tmp;
	if ((x2 <= -8.3e+223) || !(x2 <= 2.75e+184)) {
		tmp = x1 * (2.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0))));
	} else {
		tmp = x2 * (((x1 * ((x1 * 9.0) + -1.0)) / x2) - 6.0);
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if ((x2 <= (-8.3d+223)) .or. (.not. (x2 <= 2.75d+184))) then
        tmp = x1 * (2.0d0 + (4.0d0 * (x2 * ((2.0d0 * x2) - 3.0d0))))
    else
        tmp = x2 * (((x1 * ((x1 * 9.0d0) + (-1.0d0))) / x2) - 6.0d0)
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if ((x2 <= -8.3e+223) || !(x2 <= 2.75e+184)) {
		tmp = x1 * (2.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0))));
	} else {
		tmp = x2 * (((x1 * ((x1 * 9.0) + -1.0)) / x2) - 6.0);
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if (x2 <= -8.3e+223) or not (x2 <= 2.75e+184):
		tmp = x1 * (2.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0))))
	else:
		tmp = x2 * (((x1 * ((x1 * 9.0) + -1.0)) / x2) - 6.0)
	return tmp
function code(x1, x2)
	tmp = 0.0
	if ((x2 <= -8.3e+223) || !(x2 <= 2.75e+184))
		tmp = Float64(x1 * Float64(2.0 + Float64(4.0 * Float64(x2 * Float64(Float64(2.0 * x2) - 3.0)))));
	else
		tmp = Float64(x2 * Float64(Float64(Float64(x1 * Float64(Float64(x1 * 9.0) + -1.0)) / x2) - 6.0));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if ((x2 <= -8.3e+223) || ~((x2 <= 2.75e+184)))
		tmp = x1 * (2.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0))));
	else
		tmp = x2 * (((x1 * ((x1 * 9.0) + -1.0)) / x2) - 6.0);
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[Or[LessEqual[x2, -8.3e+223], N[Not[LessEqual[x2, 2.75e+184]], $MachinePrecision]], N[(x1 * N[(2.0 + N[(4.0 * N[(x2 * N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x2 * N[(N[(N[(x1 * N[(N[(x1 * 9.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] / x2), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x2 \leq -8.3 \cdot 10^{+223} \lor \neg \left(x2 \leq 2.75 \cdot 10^{+184}\right):\\
\;\;\;\;x1 \cdot \left(2 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x2 \cdot \left(\frac{x1 \cdot \left(x1 \cdot 9 + -1\right)}{x2} - 6\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x2 < -8.29999999999999981e223 or 2.7500000000000001e184 < x2

    1. Initial program 76.6%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified76.7%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right), \left(x1 \cdot \left(2 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right) \cdot \left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right), \mathsf{fma}\left(3 \cdot \left(x1 \cdot x1\right), \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 61.1%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(x1 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)}\right) \]
    5. Step-by-step derivation
      1. associate-*r*76.7%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \color{blue}{\left(\left(x1 \cdot x2\right) \cdot \left(2 \cdot x2 - 3\right)\right)}\right) \]
      2. fmm-def76.7%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \color{blue}{\mathsf{fma}\left(2, x2, -3\right)}\right)\right) \]
      3. metadata-eval76.7%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, \color{blue}{-3}\right)\right)\right) \]
    6. Simplified76.7%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, -3\right)\right)}\right) \]
    7. Taylor expanded in x1 around inf 72.8%

      \[\leadsto \color{blue}{x1 \cdot \left(2 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)} \]

    if -8.29999999999999981e223 < x2 < 2.7500000000000001e184

    1. Initial program 64.3%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified65.7%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 69.3%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 73.1%

      \[\leadsto -6 \cdot x2 + \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right)} \]
    6. Taylor expanded in x2 around inf 77.0%

      \[\leadsto \color{blue}{x2 \cdot \left(\frac{x1 \cdot \left(9 \cdot x1 - 1\right)}{x2} - 6\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x2 \leq -8.3 \cdot 10^{+223} \lor \neg \left(x2 \leq 2.75 \cdot 10^{+184}\right):\\ \;\;\;\;x1 \cdot \left(2 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot \left(\frac{x1 \cdot \left(x1 \cdot 9 + -1\right)}{x2} - 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 69.5% accurate, 5.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x2 \leq -9.5 \cdot 10^{+223} \lor \neg \left(x2 \leq 4.1 \cdot 10^{+184}\right):\\ \;\;\;\;x1 \cdot \left(2 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot 9 + -1\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (or (<= x2 -9.5e+223) (not (<= x2 4.1e+184)))
   (* x1 (+ 2.0 (* 4.0 (* x2 (- (* 2.0 x2) 3.0)))))
   (+ (* x2 -6.0) (* x1 (+ (* x1 9.0) -1.0)))))
double code(double x1, double x2) {
	double tmp;
	if ((x2 <= -9.5e+223) || !(x2 <= 4.1e+184)) {
		tmp = x1 * (2.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0))));
	} else {
		tmp = (x2 * -6.0) + (x1 * ((x1 * 9.0) + -1.0));
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if ((x2 <= (-9.5d+223)) .or. (.not. (x2 <= 4.1d+184))) then
        tmp = x1 * (2.0d0 + (4.0d0 * (x2 * ((2.0d0 * x2) - 3.0d0))))
    else
        tmp = (x2 * (-6.0d0)) + (x1 * ((x1 * 9.0d0) + (-1.0d0)))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if ((x2 <= -9.5e+223) || !(x2 <= 4.1e+184)) {
		tmp = x1 * (2.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0))));
	} else {
		tmp = (x2 * -6.0) + (x1 * ((x1 * 9.0) + -1.0));
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if (x2 <= -9.5e+223) or not (x2 <= 4.1e+184):
		tmp = x1 * (2.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0))))
	else:
		tmp = (x2 * -6.0) + (x1 * ((x1 * 9.0) + -1.0))
	return tmp
function code(x1, x2)
	tmp = 0.0
	if ((x2 <= -9.5e+223) || !(x2 <= 4.1e+184))
		tmp = Float64(x1 * Float64(2.0 + Float64(4.0 * Float64(x2 * Float64(Float64(2.0 * x2) - 3.0)))));
	else
		tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(Float64(x1 * 9.0) + -1.0)));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if ((x2 <= -9.5e+223) || ~((x2 <= 4.1e+184)))
		tmp = x1 * (2.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0))));
	else
		tmp = (x2 * -6.0) + (x1 * ((x1 * 9.0) + -1.0));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[Or[LessEqual[x2, -9.5e+223], N[Not[LessEqual[x2, 4.1e+184]], $MachinePrecision]], N[(x1 * N[(2.0 + N[(4.0 * N[(x2 * N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(N[(x1 * 9.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x2 \leq -9.5 \cdot 10^{+223} \lor \neg \left(x2 \leq 4.1 \cdot 10^{+184}\right):\\
\;\;\;\;x1 \cdot \left(2 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot 9 + -1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x2 < -9.50000000000000064e223 or 4.0999999999999997e184 < x2

    1. Initial program 76.6%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified76.7%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right), \left(x1 \cdot \left(2 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right) \cdot \left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right), \mathsf{fma}\left(3 \cdot \left(x1 \cdot x1\right), \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 61.1%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(x1 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)}\right) \]
    5. Step-by-step derivation
      1. associate-*r*76.7%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \color{blue}{\left(\left(x1 \cdot x2\right) \cdot \left(2 \cdot x2 - 3\right)\right)}\right) \]
      2. fmm-def76.7%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \color{blue}{\mathsf{fma}\left(2, x2, -3\right)}\right)\right) \]
      3. metadata-eval76.7%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + 4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, \color{blue}{-3}\right)\right)\right) \]
    6. Simplified76.7%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \color{blue}{4 \cdot \left(\left(x1 \cdot x2\right) \cdot \mathsf{fma}\left(2, x2, -3\right)\right)}\right) \]
    7. Taylor expanded in x1 around inf 72.8%

      \[\leadsto \color{blue}{x1 \cdot \left(2 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)} \]

    if -9.50000000000000064e223 < x2 < 4.0999999999999997e184

    1. Initial program 64.3%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified65.7%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 69.3%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 73.1%

      \[\leadsto -6 \cdot x2 + \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification73.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x2 \leq -9.5 \cdot 10^{+223} \lor \neg \left(x2 \leq 4.1 \cdot 10^{+184}\right):\\ \;\;\;\;x1 \cdot \left(2 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(x1 \cdot 9 + -1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 64.9% accurate, 7.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq -4.5 \cdot 10^{+153} \lor \neg \left(x1 \leq 5.8 \cdot 10^{-42}\right):\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot \left(\left(-6\right) - \frac{x1}{x2}\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (or (<= x1 -4.5e+153) (not (<= x1 5.8e-42)))
   (* x1 (+ (* x1 9.0) -1.0))
   (* x2 (- (- 6.0) (/ x1 x2)))))
double code(double x1, double x2) {
	double tmp;
	if ((x1 <= -4.5e+153) || !(x1 <= 5.8e-42)) {
		tmp = x1 * ((x1 * 9.0) + -1.0);
	} else {
		tmp = x2 * (-6.0 - (x1 / x2));
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if ((x1 <= (-4.5d+153)) .or. (.not. (x1 <= 5.8d-42))) then
        tmp = x1 * ((x1 * 9.0d0) + (-1.0d0))
    else
        tmp = x2 * (-6.0d0 - (x1 / x2))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if ((x1 <= -4.5e+153) || !(x1 <= 5.8e-42)) {
		tmp = x1 * ((x1 * 9.0) + -1.0);
	} else {
		tmp = x2 * (-6.0 - (x1 / x2));
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if (x1 <= -4.5e+153) or not (x1 <= 5.8e-42):
		tmp = x1 * ((x1 * 9.0) + -1.0)
	else:
		tmp = x2 * (-6.0 - (x1 / x2))
	return tmp
function code(x1, x2)
	tmp = 0.0
	if ((x1 <= -4.5e+153) || !(x1 <= 5.8e-42))
		tmp = Float64(x1 * Float64(Float64(x1 * 9.0) + -1.0));
	else
		tmp = Float64(x2 * Float64(Float64(-6.0) - Float64(x1 / x2)));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if ((x1 <= -4.5e+153) || ~((x1 <= 5.8e-42)))
		tmp = x1 * ((x1 * 9.0) + -1.0);
	else
		tmp = x2 * (-6.0 - (x1 / x2));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[Or[LessEqual[x1, -4.5e+153], N[Not[LessEqual[x1, 5.8e-42]], $MachinePrecision]], N[(x1 * N[(N[(x1 * 9.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(x2 * N[((-6.0) - N[(x1 / x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -4.5 \cdot 10^{+153} \lor \neg \left(x1 \leq 5.8 \cdot 10^{-42}\right):\\
\;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right)\\

\mathbf{else}:\\
\;\;\;\;x2 \cdot \left(\left(-6\right) - \frac{x1}{x2}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -4.5000000000000001e153 or 5.8000000000000006e-42 < x1

    1. Initial program 33.1%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified31.5%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 59.8%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 69.5%

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

      \[\leadsto \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right) + x2 \cdot \left(\left(-12 \cdot x1 + 8 \cdot \left(x1 \cdot x2\right)\right) - 6\right)} \]
    7. Taylor expanded in x2 around 0 72.6%

      \[\leadsto \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right)} \]

    if -4.5000000000000001e153 < x1 < 5.8000000000000006e-42

    1. Initial program 93.1%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified89.0%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 74.5%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 61.8%

      \[\leadsto -6 \cdot x2 + \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right)} \]
    6. Taylor expanded in x1 around 0 61.2%

      \[\leadsto \color{blue}{-6 \cdot x2 + -1 \cdot x1} \]
    7. Step-by-step derivation
      1. *-commutative61.2%

        \[\leadsto \color{blue}{x2 \cdot -6} + -1 \cdot x1 \]
      2. mul-1-neg61.2%

        \[\leadsto x2 \cdot -6 + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg61.2%

        \[\leadsto \color{blue}{x2 \cdot -6 - x1} \]
    8. Simplified61.2%

      \[\leadsto \color{blue}{x2 \cdot -6 - x1} \]
    9. Taylor expanded in x2 around -inf 64.6%

      \[\leadsto \color{blue}{-1 \cdot \left(x2 \cdot \left(6 + \frac{x1}{x2}\right)\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg64.6%

        \[\leadsto \color{blue}{-x2 \cdot \left(6 + \frac{x1}{x2}\right)} \]
      2. distribute-rgt-neg-in64.6%

        \[\leadsto \color{blue}{x2 \cdot \left(-\left(6 + \frac{x1}{x2}\right)\right)} \]
      3. +-commutative64.6%

        \[\leadsto x2 \cdot \left(-\color{blue}{\left(\frac{x1}{x2} + 6\right)}\right) \]
    11. Simplified64.6%

      \[\leadsto \color{blue}{x2 \cdot \left(-\left(\frac{x1}{x2} + 6\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification68.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -4.5 \cdot 10^{+153} \lor \neg \left(x1 \leq 5.8 \cdot 10^{-42}\right):\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot \left(\left(-6\right) - \frac{x1}{x2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 63.9% accurate, 7.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq -3.8 \cdot 10^{+48} \lor \neg \left(x1 \leq 5.8 \cdot 10^{-42}\right):\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6 - x1\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (or (<= x1 -3.8e+48) (not (<= x1 5.8e-42)))
   (* x1 (+ (* x1 9.0) -1.0))
   (- (* x2 -6.0) x1)))
double code(double x1, double x2) {
	double tmp;
	if ((x1 <= -3.8e+48) || !(x1 <= 5.8e-42)) {
		tmp = x1 * ((x1 * 9.0) + -1.0);
	} else {
		tmp = (x2 * -6.0) - x1;
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if ((x1 <= (-3.8d+48)) .or. (.not. (x1 <= 5.8d-42))) then
        tmp = x1 * ((x1 * 9.0d0) + (-1.0d0))
    else
        tmp = (x2 * (-6.0d0)) - x1
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if ((x1 <= -3.8e+48) || !(x1 <= 5.8e-42)) {
		tmp = x1 * ((x1 * 9.0) + -1.0);
	} else {
		tmp = (x2 * -6.0) - x1;
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if (x1 <= -3.8e+48) or not (x1 <= 5.8e-42):
		tmp = x1 * ((x1 * 9.0) + -1.0)
	else:
		tmp = (x2 * -6.0) - x1
	return tmp
function code(x1, x2)
	tmp = 0.0
	if ((x1 <= -3.8e+48) || !(x1 <= 5.8e-42))
		tmp = Float64(x1 * Float64(Float64(x1 * 9.0) + -1.0));
	else
		tmp = Float64(Float64(x2 * -6.0) - x1);
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if ((x1 <= -3.8e+48) || ~((x1 <= 5.8e-42)))
		tmp = x1 * ((x1 * 9.0) + -1.0);
	else
		tmp = (x2 * -6.0) - x1;
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[Or[LessEqual[x1, -3.8e+48], N[Not[LessEqual[x1, 5.8e-42]], $MachinePrecision]], N[(x1 * N[(N[(x1 * 9.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x2 * -6.0), $MachinePrecision] - x1), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -3.8 \cdot 10^{+48} \lor \neg \left(x1 \leq 5.8 \cdot 10^{-42}\right):\\
\;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right)\\

\mathbf{else}:\\
\;\;\;\;x2 \cdot -6 - x1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -3.8e48 or 5.8000000000000006e-42 < x1

    1. Initial program 36.8%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified41.4%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 54.7%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 61.5%

      \[\leadsto -6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \color{blue}{9}\right) - 1\right) \]
    6. Taylor expanded in x2 around 0 54.0%

      \[\leadsto \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right) + x2 \cdot \left(\left(-12 \cdot x1 + 8 \cdot \left(x1 \cdot x2\right)\right) - 6\right)} \]
    7. Taylor expanded in x2 around 0 62.2%

      \[\leadsto \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right)} \]

    if -3.8e48 < x1 < 5.8000000000000006e-42

    1. Initial program 99.4%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified87.9%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 82.7%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 71.4%

      \[\leadsto -6 \cdot x2 + \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right)} \]
    6. Taylor expanded in x1 around 0 71.2%

      \[\leadsto \color{blue}{-6 \cdot x2 + -1 \cdot x1} \]
    7. Step-by-step derivation
      1. *-commutative71.2%

        \[\leadsto \color{blue}{x2 \cdot -6} + -1 \cdot x1 \]
      2. mul-1-neg71.2%

        \[\leadsto x2 \cdot -6 + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg71.2%

        \[\leadsto \color{blue}{x2 \cdot -6 - x1} \]
    8. Simplified71.2%

      \[\leadsto \color{blue}{x2 \cdot -6 - x1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -3.8 \cdot 10^{+48} \lor \neg \left(x1 \leq 5.8 \cdot 10^{-42}\right):\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9 + -1\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6 - x1\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 32.3% accurate, 9.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x2 \leq -2.25 \cdot 10^{-179} \lor \neg \left(x2 \leq 1.15 \cdot 10^{-152}\right):\\ \;\;\;\;x2 \cdot -6\\ \mathbf{else}:\\ \;\;\;\;-x1\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (or (<= x2 -2.25e-179) (not (<= x2 1.15e-152))) (* x2 -6.0) (- x1)))
double code(double x1, double x2) {
	double tmp;
	if ((x2 <= -2.25e-179) || !(x2 <= 1.15e-152)) {
		tmp = x2 * -6.0;
	} else {
		tmp = -x1;
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if ((x2 <= (-2.25d-179)) .or. (.not. (x2 <= 1.15d-152))) then
        tmp = x2 * (-6.0d0)
    else
        tmp = -x1
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if ((x2 <= -2.25e-179) || !(x2 <= 1.15e-152)) {
		tmp = x2 * -6.0;
	} else {
		tmp = -x1;
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if (x2 <= -2.25e-179) or not (x2 <= 1.15e-152):
		tmp = x2 * -6.0
	else:
		tmp = -x1
	return tmp
function code(x1, x2)
	tmp = 0.0
	if ((x2 <= -2.25e-179) || !(x2 <= 1.15e-152))
		tmp = Float64(x2 * -6.0);
	else
		tmp = Float64(-x1);
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if ((x2 <= -2.25e-179) || ~((x2 <= 1.15e-152)))
		tmp = x2 * -6.0;
	else
		tmp = -x1;
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[Or[LessEqual[x2, -2.25e-179], N[Not[LessEqual[x2, 1.15e-152]], $MachinePrecision]], N[(x2 * -6.0), $MachinePrecision], (-x1)]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x2 \leq -2.25 \cdot 10^{-179} \lor \neg \left(x2 \leq 1.15 \cdot 10^{-152}\right):\\
\;\;\;\;x2 \cdot -6\\

\mathbf{else}:\\
\;\;\;\;-x1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x2 < -2.24999999999999996e-179 or 1.1500000000000001e-152 < x2

    1. Initial program 64.6%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified64.7%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right), \left(x1 \cdot \left(2 \cdot \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right)\right) \cdot \left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right), \mathsf{fma}\left(3 \cdot \left(x1 \cdot x1\right), \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 29.5%

      \[\leadsto \color{blue}{-6 \cdot x2} \]

    if -2.24999999999999996e-179 < x2 < 1.1500000000000001e-152

    1. Initial program 72.6%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Simplified78.6%

      \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
    3. Add Preprocessing
    4. Taylor expanded in x1 around 0 72.1%

      \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
    5. Taylor expanded in x2 around 0 72.1%

      \[\leadsto -6 \cdot x2 + \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right)} \]
    6. Taylor expanded in x1 around 0 50.7%

      \[\leadsto \color{blue}{-6 \cdot x2 + -1 \cdot x1} \]
    7. Step-by-step derivation
      1. *-commutative50.7%

        \[\leadsto \color{blue}{x2 \cdot -6} + -1 \cdot x1 \]
      2. mul-1-neg50.7%

        \[\leadsto x2 \cdot -6 + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg50.7%

        \[\leadsto \color{blue}{x2 \cdot -6 - x1} \]
    8. Simplified50.7%

      \[\leadsto \color{blue}{x2 \cdot -6 - x1} \]
    9. Taylor expanded in x2 around 0 41.2%

      \[\leadsto \color{blue}{-1 \cdot x1} \]
    10. Step-by-step derivation
      1. neg-mul-141.2%

        \[\leadsto \color{blue}{-x1} \]
    11. Simplified41.2%

      \[\leadsto \color{blue}{-x1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification32.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x2 \leq -2.25 \cdot 10^{-179} \lor \neg \left(x2 \leq 1.15 \cdot 10^{-152}\right):\\ \;\;\;\;x2 \cdot -6\\ \mathbf{else}:\\ \;\;\;\;-x1\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 64.2% accurate, 11.5× speedup?

\[\begin{array}{l} \\ x2 \cdot -6 + x1 \cdot \left(x1 \cdot 9 + -1\right) \end{array} \]
(FPCore (x1 x2) :precision binary64 (+ (* x2 -6.0) (* x1 (+ (* x1 9.0) -1.0))))
double code(double x1, double x2) {
	return (x2 * -6.0) + (x1 * ((x1 * 9.0) + -1.0));
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    code = (x2 * (-6.0d0)) + (x1 * ((x1 * 9.0d0) + (-1.0d0)))
end function
public static double code(double x1, double x2) {
	return (x2 * -6.0) + (x1 * ((x1 * 9.0) + -1.0));
}
def code(x1, x2):
	return (x2 * -6.0) + (x1 * ((x1 * 9.0) + -1.0))
function code(x1, x2)
	return Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(Float64(x1 * 9.0) + -1.0)))
end
function tmp = code(x1, x2)
	tmp = (x2 * -6.0) + (x1 * ((x1 * 9.0) + -1.0));
end
code[x1_, x2_] := N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(N[(x1 * 9.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x2 \cdot -6 + x1 \cdot \left(x1 \cdot 9 + -1\right)
\end{array}
Derivation
  1. Initial program 66.4%

    \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
  2. Simplified63.4%

    \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in x1 around 0 68.0%

    \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
  5. Taylor expanded in x2 around 0 66.5%

    \[\leadsto -6 \cdot x2 + \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right)} \]
  6. Final simplification66.5%

    \[\leadsto x2 \cdot -6 + x1 \cdot \left(x1 \cdot 9 + -1\right) \]
  7. Add Preprocessing

Alternative 17: 39.3% accurate, 25.4× speedup?

\[\begin{array}{l} \\ x2 \cdot -6 - x1 \end{array} \]
(FPCore (x1 x2) :precision binary64 (- (* x2 -6.0) x1))
double code(double x1, double x2) {
	return (x2 * -6.0) - x1;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    code = (x2 * (-6.0d0)) - x1
end function
public static double code(double x1, double x2) {
	return (x2 * -6.0) - x1;
}
def code(x1, x2):
	return (x2 * -6.0) - x1
function code(x1, x2)
	return Float64(Float64(x2 * -6.0) - x1)
end
function tmp = code(x1, x2)
	tmp = (x2 * -6.0) - x1;
end
code[x1_, x2_] := N[(N[(x2 * -6.0), $MachinePrecision] - x1), $MachinePrecision]
\begin{array}{l}

\\
x2 \cdot -6 - x1
\end{array}
Derivation
  1. Initial program 66.4%

    \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
  2. Simplified63.4%

    \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in x1 around 0 68.0%

    \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
  5. Taylor expanded in x2 around 0 66.5%

    \[\leadsto -6 \cdot x2 + \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right)} \]
  6. Taylor expanded in x1 around 0 37.4%

    \[\leadsto \color{blue}{-6 \cdot x2 + -1 \cdot x1} \]
  7. Step-by-step derivation
    1. *-commutative37.4%

      \[\leadsto \color{blue}{x2 \cdot -6} + -1 \cdot x1 \]
    2. mul-1-neg37.4%

      \[\leadsto x2 \cdot -6 + \color{blue}{\left(-x1\right)} \]
    3. unsub-neg37.4%

      \[\leadsto \color{blue}{x2 \cdot -6 - x1} \]
  8. Simplified37.4%

    \[\leadsto \color{blue}{x2 \cdot -6 - x1} \]
  9. Add Preprocessing

Alternative 18: 14.4% accurate, 63.5× speedup?

\[\begin{array}{l} \\ -x1 \end{array} \]
(FPCore (x1 x2) :precision binary64 (- x1))
double code(double x1, double x2) {
	return -x1;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    code = -x1
end function
public static double code(double x1, double x2) {
	return -x1;
}
def code(x1, x2):
	return -x1
function code(x1, x2)
	return Float64(-x1)
end
function tmp = code(x1, x2)
	tmp = -x1;
end
code[x1_, x2_] := (-x1)
\begin{array}{l}

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

    \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
  2. Simplified63.4%

    \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 3 \cdot \frac{x1 \cdot \left(x1 \cdot \left(3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 \cdot \left(2 \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right) + x1 \cdot \mathsf{fma}\left(\frac{3 \cdot \left(x1 \cdot x1\right) - \mathsf{fma}\left(x2, -2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right)\right) + x1\right)\right)} \]
  3. Add Preprocessing
  4. Taylor expanded in x1 around 0 68.0%

    \[\leadsto \color{blue}{-6 \cdot x2 + x1 \cdot \left(\left(-4 \cdot \left(x2 \cdot \left(3 + -2 \cdot x2\right)\right) + x1 \cdot \left(\left(2 \cdot \left(3 + -4 \cdot x2\right) + \left(3 \cdot \left(3 - -2 \cdot x2\right) + \left(6 \cdot x2 + 8 \cdot x2\right)\right)\right) - 6\right)\right) - 1\right)} \]
  5. Taylor expanded in x2 around 0 66.5%

    \[\leadsto -6 \cdot x2 + \color{blue}{x1 \cdot \left(9 \cdot x1 - 1\right)} \]
  6. Taylor expanded in x1 around 0 37.4%

    \[\leadsto \color{blue}{-6 \cdot x2 + -1 \cdot x1} \]
  7. Step-by-step derivation
    1. *-commutative37.4%

      \[\leadsto \color{blue}{x2 \cdot -6} + -1 \cdot x1 \]
    2. mul-1-neg37.4%

      \[\leadsto x2 \cdot -6 + \color{blue}{\left(-x1\right)} \]
    3. unsub-neg37.4%

      \[\leadsto \color{blue}{x2 \cdot -6 - x1} \]
  8. Simplified37.4%

    \[\leadsto \color{blue}{x2 \cdot -6 - x1} \]
  9. Taylor expanded in x2 around 0 13.9%

    \[\leadsto \color{blue}{-1 \cdot x1} \]
  10. Step-by-step derivation
    1. neg-mul-113.9%

      \[\leadsto \color{blue}{-x1} \]
  11. Simplified13.9%

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

Reproduce

?
herbie shell --seed 2024152 
(FPCore (x1 x2)
  :name "Rosa's FloatVsDoubleBenchmark"
  :precision binary64
  (+ x1 (+ (+ (+ (+ (* (+ (* (* (* 2.0 x1) (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))) (- (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)) 3.0)) (* (* x1 x1) (- (* 4.0 (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))) 6.0))) (+ (* x1 x1) 1.0)) (* (* (* 3.0 x1) x1) (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)))) (* (* x1 x1) x1)) x1) (* 3.0 (/ (- (- (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))))))