Rosa's FloatVsDoubleBenchmark

Percentage Accurate: 70.7% → 99.5%
Time: 49.2s
Alternatives: 20
Speedup: 4.4×

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 20 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.7% 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.5% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(x1, x1 \cdot 3, \mathsf{fma}\left(2, x2, -x1\right)\right)\\ \mathbf{if}\;x1 \leq -5 \cdot 10^{+153}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{elif}\;x1 \leq 5 \cdot 10^{+102}:\\ \;\;\;\;x1 + \mathsf{fma}\left(3, \frac{x1 \cdot \left(x1 \cdot 3\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(x1, x1 \cdot \frac{t_0}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{3}}, \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 + \left(x1 \cdot \left(x1 \cdot -6\right) + \frac{t_0}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(x1 \cdot \left(-6 + \frac{t_0}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{2}}\right) + \left(x1 \cdot x1\right) \cdot 4\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \mathsf{fma}\left(3, x2 \cdot -2, \mathsf{fma}\left(x1, x1 \cdot 9 - 3, \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 + 2 \cdot \left(\left(x2 \cdot 4 - 6\right) \cdot \left(x1 \cdot x2\right)\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (fma x1 (* x1 3.0) (fma 2.0 x2 (- x1)))))
   (if (<= x1 -5e+153)
     (+ x1 (* x1 (* x1 9.0)))
     (if (<= x1 5e+102)
       (+
        x1
        (fma
         3.0
         (/ (- (* x1 (* x1 3.0)) (fma 2.0 x2 x1)) (fma x1 x1 1.0))
         (fma
          x1
          (* x1 (/ t_0 (/ (fma x1 x1 1.0) 3.0)))
          (*
           (fma x1 x1 1.0)
           (+
            x1
            (+
             (* x1 (* x1 -6.0))
             (*
              (/ t_0 (fma x1 x1 1.0))
              (+
               (* x1 (+ -6.0 (/ t_0 (/ (fma x1 x1 1.0) 2.0))))
               (* (* x1 x1) 4.0)))))))))
       (+
        x1
        (fma
         3.0
         (* x2 -2.0)
         (fma
          x1
          (- (* x1 9.0) 3.0)
          (*
           (fma x1 x1 1.0)
           (+ x1 (* 2.0 (* (- (* x2 4.0) 6.0) (* x1 x2))))))))))))
double code(double x1, double x2) {
	double t_0 = fma(x1, (x1 * 3.0), fma(2.0, x2, -x1));
	double tmp;
	if (x1 <= -5e+153) {
		tmp = x1 + (x1 * (x1 * 9.0));
	} else if (x1 <= 5e+102) {
		tmp = x1 + fma(3.0, (((x1 * (x1 * 3.0)) - fma(2.0, x2, x1)) / fma(x1, x1, 1.0)), fma(x1, (x1 * (t_0 / (fma(x1, x1, 1.0) / 3.0))), (fma(x1, x1, 1.0) * (x1 + ((x1 * (x1 * -6.0)) + ((t_0 / fma(x1, x1, 1.0)) * ((x1 * (-6.0 + (t_0 / (fma(x1, x1, 1.0) / 2.0)))) + ((x1 * x1) * 4.0))))))));
	} else {
		tmp = x1 + fma(3.0, (x2 * -2.0), fma(x1, ((x1 * 9.0) - 3.0), (fma(x1, x1, 1.0) * (x1 + (2.0 * (((x2 * 4.0) - 6.0) * (x1 * x2)))))));
	}
	return tmp;
}
function code(x1, x2)
	t_0 = fma(x1, Float64(x1 * 3.0), fma(2.0, x2, Float64(-x1)))
	tmp = 0.0
	if (x1 <= -5e+153)
		tmp = Float64(x1 + Float64(x1 * Float64(x1 * 9.0)));
	elseif (x1 <= 5e+102)
		tmp = Float64(x1 + fma(3.0, Float64(Float64(Float64(x1 * Float64(x1 * 3.0)) - fma(2.0, x2, x1)) / fma(x1, x1, 1.0)), fma(x1, Float64(x1 * Float64(t_0 / Float64(fma(x1, x1, 1.0) / 3.0))), Float64(fma(x1, x1, 1.0) * Float64(x1 + Float64(Float64(x1 * Float64(x1 * -6.0)) + Float64(Float64(t_0 / fma(x1, x1, 1.0)) * Float64(Float64(x1 * Float64(-6.0 + Float64(t_0 / Float64(fma(x1, x1, 1.0) / 2.0)))) + Float64(Float64(x1 * x1) * 4.0)))))))));
	else
		tmp = Float64(x1 + fma(3.0, Float64(x2 * -2.0), fma(x1, Float64(Float64(x1 * 9.0) - 3.0), Float64(fma(x1, x1, 1.0) * Float64(x1 + Float64(2.0 * Float64(Float64(Float64(x2 * 4.0) - 6.0) * Float64(x1 * x2))))))));
	end
	return tmp
end
code[x1_, x2_] := Block[{t$95$0 = N[(x1 * N[(x1 * 3.0), $MachinePrecision] + N[(2.0 * x2 + (-x1)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x1, -5e+153], N[(x1 + N[(x1 * N[(x1 * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 5e+102], N[(x1 + N[(3.0 * N[(N[(N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision] - N[(2.0 * x2 + x1), $MachinePrecision]), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(x1 * N[(t$95$0 / N[(N[(x1 * x1 + 1.0), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1 + 1.0), $MachinePrecision] * N[(x1 + N[(N[(x1 * N[(x1 * -6.0), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$0 / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(x1 * N[(-6.0 + N[(t$95$0 / N[(N[(x1 * x1 + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x1 + N[(3.0 * N[(x2 * -2.0), $MachinePrecision] + N[(x1 * N[(N[(x1 * 9.0), $MachinePrecision] - 3.0), $MachinePrecision] + N[(N[(x1 * x1 + 1.0), $MachinePrecision] * N[(x1 + N[(2.0 * N[(N[(N[(x2 * 4.0), $MachinePrecision] - 6.0), $MachinePrecision] * N[(x1 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x1, x1 \cdot 3, \mathsf{fma}\left(2, x2, -x1\right)\right)\\
\mathbf{if}\;x1 \leq -5 \cdot 10^{+153}:\\
\;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\

\mathbf{elif}\;x1 \leq 5 \cdot 10^{+102}:\\
\;\;\;\;x1 + \mathsf{fma}\left(3, \frac{x1 \cdot \left(x1 \cdot 3\right) - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(x1, x1 \cdot \frac{t_0}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{3}}, \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 + \left(x1 \cdot \left(x1 \cdot -6\right) + \frac{t_0}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(x1 \cdot \left(-6 + \frac{t_0}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{2}}\right) + \left(x1 \cdot x1\right) \cdot 4\right)\right)\right)\right)\right)\\

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


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

    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. Taylor expanded in x1 around 0 0.0%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow2100.0%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*100.0%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified100.0%

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

    if -5.00000000000000018e153 < x1 < 5e102

    1. Initial program 91.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. Simplified99.7%

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

    if 5e102 < x1

    1. Initial program 17.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. Simplified17.4%

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

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

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

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

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

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

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

Alternative 2: 98.8% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;x1 \leq -2 \cdot 10^{+104}:\\
\;\;\;\;x1 + \left(\left(x1 + 6 \cdot {x1}^{4}\right) + t_2\right)\\

\mathbf{elif}\;x1 \leq 6 \cdot 10^{+102}:\\
\;\;\;\;x1 + \left(t_2 + \left(x1 + \left(\left(t_1 \cdot \left(\left(t_3 \cdot \left(x1 \cdot 2\right)\right) \cdot \left(t_3 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot t_3 - 6\right)\right) + t_0 \cdot t_3\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x1 < -3.9999999999999999e156

    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. Taylor expanded in x1 around 0 0.0%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow2100.0%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*100.0%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified100.0%

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

    if -3.9999999999999999e156 < x1 < -2e104

    1. Initial program 6.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. Taylor expanded in x1 around inf 93.3%

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

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

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

    if -2e104 < x1 < 5.9999999999999996e102

    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) \]

    if 5.9999999999999996e102 < x1

    1. Initial program 17.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. Simplified17.4%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -4 \cdot 10^{+156}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{elif}\;x1 \leq -2 \cdot 10^{+104}:\\ \;\;\;\;x1 + \left(\left(x1 + 6 \cdot {x1}^{4}\right) + 3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1}\right)\\ \mathbf{elif}\;x1 \leq 6 \cdot 10^{+102}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(\left(\left(1 + x1 \cdot x1\right) \cdot \left(\left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} \cdot \left(x1 \cdot 2\right)\right) \cdot \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 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}{1 + x1 \cdot x1}\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \mathsf{fma}\left(3, x2 \cdot -2, \mathsf{fma}\left(x1, x1 \cdot 9 - 3, \mathsf{fma}\left(x1, x1, 1\right) \cdot \left(x1 + 2 \cdot \left(\left(x2 \cdot 4 - 6\right) \cdot \left(x1 \cdot x2\right)\right)\right)\right)\right)\\ \end{array} \]

Alternative 3: 95.6% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\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 2 x1) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 3 x1) x1) (*.f64 2 x2)) x1) (+.f64 (*.f64 x1 x1) 1))) (-.f64 (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 3 x1) x1) (*.f64 2 x2)) x1) (+.f64 (*.f64 x1 x1) 1)) 3)) (*.f64 (*.f64 x1 x1) (-.f64 (*.f64 4 (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 3 x1) x1) (*.f64 2 x2)) x1) (+.f64 (*.f64 x1 x1) 1))) 6))) (+.f64 (*.f64 x1 x1) 1)) (*.f64 (*.f64 (*.f64 3 x1) x1) (/.f64 (-.f64 (+.f64 (*.f64 (*.f64 3 x1) x1) (*.f64 2 x2)) x1) (+.f64 (*.f64 x1 x1) 1)))) (*.f64 (*.f64 x1 x1) x1)) x1) (*.f64 3 (/.f64 (-.f64 (-.f64 (*.f64 (*.f64 3 x1) x1) (*.f64 2 x2)) x1) (+.f64 (*.f64 x1 x1) 1))))) < +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) \]

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

    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. Taylor expanded in x1 around 0 0.0%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative83.7%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow283.7%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*83.7%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified83.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(\left(\left(1 + x1 \cdot x1\right) \cdot \left(\left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} \cdot \left(x1 \cdot 2\right)\right) \cdot \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 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}{1 + x1 \cdot x1}\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right)\right) \leq \infty:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(\left(\left(1 + x1 \cdot x1\right) \cdot \left(\left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} \cdot \left(x1 \cdot 2\right)\right) \cdot \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 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}{1 + x1 \cdot x1}\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \end{array} \]

Alternative 4: 98.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot \left(x1 \cdot 9\right)\\ t_1 := x1 \cdot \left(x1 \cdot 3\right)\\ t_2 := 1 + x1 \cdot x1\\ t_3 := 3 \cdot \frac{\left(t_1 - 2 \cdot x2\right) - x1}{t_2}\\ t_4 := \frac{\left(t_1 + 2 \cdot x2\right) - x1}{t_2}\\ \mathbf{if}\;x1 \leq -4 \cdot 10^{+156}:\\ \;\;\;\;x1 + t_0\\ \mathbf{elif}\;x1 \leq -5 \cdot 10^{+102}:\\ \;\;\;\;x1 + \left(\left(x1 + 6 \cdot {x1}^{4}\right) + t_3\right)\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;x1 + \left(t_3 + \left(x1 + \left(\left(t_2 \cdot \left(\left(t_4 \cdot \left(x1 \cdot 2\right)\right) \cdot \left(t_4 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot t_4 - 6\right)\right) + t_1 \cdot t_4\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(t_0 + x2 \cdot -6\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* x1 (* x1 9.0)))
        (t_1 (* x1 (* x1 3.0)))
        (t_2 (+ 1.0 (* x1 x1)))
        (t_3 (* 3.0 (/ (- (- t_1 (* 2.0 x2)) x1) t_2)))
        (t_4 (/ (- (+ t_1 (* 2.0 x2)) x1) t_2)))
   (if (<= x1 -4e+156)
     (+ x1 t_0)
     (if (<= x1 -5e+102)
       (+ x1 (+ (+ x1 (* 6.0 (pow x1 4.0))) t_3))
       (if (<= x1 1.8e+137)
         (+
          x1
          (+
           t_3
           (+
            x1
            (+
             (+
              (*
               t_2
               (+
                (* (* t_4 (* x1 2.0)) (- t_4 3.0))
                (* (* x1 x1) (- (* 4.0 t_4) 6.0))))
              (* t_1 t_4))
             (* x1 (* x1 x1))))))
         (+
          x1
          (+
           (* x1 (- (* 4.0 (* x2 (- (* 2.0 x2) 3.0))) 2.0))
           (+ t_0 (* x2 -6.0)))))))))
double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 9.0);
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = 1.0 + (x1 * x1);
	double t_3 = 3.0 * (((t_1 - (2.0 * x2)) - x1) / t_2);
	double t_4 = ((t_1 + (2.0 * x2)) - x1) / t_2;
	double tmp;
	if (x1 <= -4e+156) {
		tmp = x1 + t_0;
	} else if (x1 <= -5e+102) {
		tmp = x1 + ((x1 + (6.0 * pow(x1, 4.0))) + t_3);
	} else if (x1 <= 1.8e+137) {
		tmp = x1 + (t_3 + (x1 + (((t_2 * (((t_4 * (x1 * 2.0)) * (t_4 - 3.0)) + ((x1 * x1) * ((4.0 * t_4) - 6.0)))) + (t_1 * t_4)) + (x1 * (x1 * x1)))));
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * ((2.0 * x2) - 3.0))) - 2.0)) + (t_0 + (x2 * -6.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) :: t_3
    real(8) :: t_4
    real(8) :: tmp
    t_0 = x1 * (x1 * 9.0d0)
    t_1 = x1 * (x1 * 3.0d0)
    t_2 = 1.0d0 + (x1 * x1)
    t_3 = 3.0d0 * (((t_1 - (2.0d0 * x2)) - x1) / t_2)
    t_4 = ((t_1 + (2.0d0 * x2)) - x1) / t_2
    if (x1 <= (-4d+156)) then
        tmp = x1 + t_0
    else if (x1 <= (-5d+102)) then
        tmp = x1 + ((x1 + (6.0d0 * (x1 ** 4.0d0))) + t_3)
    else if (x1 <= 1.8d+137) then
        tmp = x1 + (t_3 + (x1 + (((t_2 * (((t_4 * (x1 * 2.0d0)) * (t_4 - 3.0d0)) + ((x1 * x1) * ((4.0d0 * t_4) - 6.0d0)))) + (t_1 * t_4)) + (x1 * (x1 * x1)))))
    else
        tmp = x1 + ((x1 * ((4.0d0 * (x2 * ((2.0d0 * x2) - 3.0d0))) - 2.0d0)) + (t_0 + (x2 * (-6.0d0))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 9.0);
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = 1.0 + (x1 * x1);
	double t_3 = 3.0 * (((t_1 - (2.0 * x2)) - x1) / t_2);
	double t_4 = ((t_1 + (2.0 * x2)) - x1) / t_2;
	double tmp;
	if (x1 <= -4e+156) {
		tmp = x1 + t_0;
	} else if (x1 <= -5e+102) {
		tmp = x1 + ((x1 + (6.0 * Math.pow(x1, 4.0))) + t_3);
	} else if (x1 <= 1.8e+137) {
		tmp = x1 + (t_3 + (x1 + (((t_2 * (((t_4 * (x1 * 2.0)) * (t_4 - 3.0)) + ((x1 * x1) * ((4.0 * t_4) - 6.0)))) + (t_1 * t_4)) + (x1 * (x1 * x1)))));
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * ((2.0 * x2) - 3.0))) - 2.0)) + (t_0 + (x2 * -6.0)));
	}
	return tmp;
}
def code(x1, x2):
	t_0 = x1 * (x1 * 9.0)
	t_1 = x1 * (x1 * 3.0)
	t_2 = 1.0 + (x1 * x1)
	t_3 = 3.0 * (((t_1 - (2.0 * x2)) - x1) / t_2)
	t_4 = ((t_1 + (2.0 * x2)) - x1) / t_2
	tmp = 0
	if x1 <= -4e+156:
		tmp = x1 + t_0
	elif x1 <= -5e+102:
		tmp = x1 + ((x1 + (6.0 * math.pow(x1, 4.0))) + t_3)
	elif x1 <= 1.8e+137:
		tmp = x1 + (t_3 + (x1 + (((t_2 * (((t_4 * (x1 * 2.0)) * (t_4 - 3.0)) + ((x1 * x1) * ((4.0 * t_4) - 6.0)))) + (t_1 * t_4)) + (x1 * (x1 * x1)))))
	else:
		tmp = x1 + ((x1 * ((4.0 * (x2 * ((2.0 * x2) - 3.0))) - 2.0)) + (t_0 + (x2 * -6.0)))
	return tmp
function code(x1, x2)
	t_0 = Float64(x1 * Float64(x1 * 9.0))
	t_1 = Float64(x1 * Float64(x1 * 3.0))
	t_2 = Float64(1.0 + Float64(x1 * x1))
	t_3 = Float64(3.0 * Float64(Float64(Float64(t_1 - Float64(2.0 * x2)) - x1) / t_2))
	t_4 = Float64(Float64(Float64(t_1 + Float64(2.0 * x2)) - x1) / t_2)
	tmp = 0.0
	if (x1 <= -4e+156)
		tmp = Float64(x1 + t_0);
	elseif (x1 <= -5e+102)
		tmp = Float64(x1 + Float64(Float64(x1 + Float64(6.0 * (x1 ^ 4.0))) + t_3));
	elseif (x1 <= 1.8e+137)
		tmp = Float64(x1 + Float64(t_3 + Float64(x1 + Float64(Float64(Float64(t_2 * Float64(Float64(Float64(t_4 * Float64(x1 * 2.0)) * Float64(t_4 - 3.0)) + Float64(Float64(x1 * x1) * Float64(Float64(4.0 * t_4) - 6.0)))) + Float64(t_1 * t_4)) + Float64(x1 * Float64(x1 * x1))))));
	else
		tmp = Float64(x1 + Float64(Float64(x1 * Float64(Float64(4.0 * Float64(x2 * Float64(Float64(2.0 * x2) - 3.0))) - 2.0)) + Float64(t_0 + Float64(x2 * -6.0))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = x1 * (x1 * 9.0);
	t_1 = x1 * (x1 * 3.0);
	t_2 = 1.0 + (x1 * x1);
	t_3 = 3.0 * (((t_1 - (2.0 * x2)) - x1) / t_2);
	t_4 = ((t_1 + (2.0 * x2)) - x1) / t_2;
	tmp = 0.0;
	if (x1 <= -4e+156)
		tmp = x1 + t_0;
	elseif (x1 <= -5e+102)
		tmp = x1 + ((x1 + (6.0 * (x1 ^ 4.0))) + t_3);
	elseif (x1 <= 1.8e+137)
		tmp = x1 + (t_3 + (x1 + (((t_2 * (((t_4 * (x1 * 2.0)) * (t_4 - 3.0)) + ((x1 * x1) * ((4.0 * t_4) - 6.0)))) + (t_1 * t_4)) + (x1 * (x1 * x1)))));
	else
		tmp = x1 + ((x1 * ((4.0 * (x2 * ((2.0 * x2) - 3.0))) - 2.0)) + (t_0 + (x2 * -6.0)));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(x1 * N[(x1 * 9.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(3.0 * N[(N[(N[(t$95$1 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(t$95$1 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$2), $MachinePrecision]}, If[LessEqual[x1, -4e+156], N[(x1 + t$95$0), $MachinePrecision], If[LessEqual[x1, -5e+102], N[(x1 + N[(N[(x1 + N[(6.0 * N[Power[x1, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1.8e+137], N[(x1 + N[(t$95$3 + N[(x1 + N[(N[(N[(t$95$2 * N[(N[(N[(t$95$4 * N[(x1 * 2.0), $MachinePrecision]), $MachinePrecision] * N[(t$95$4 - 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * N[(N[(4.0 * t$95$4), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x1 + N[(N[(x1 * N[(N[(4.0 * N[(x2 * N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 + N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x1 \leq -5 \cdot 10^{+102}:\\
\;\;\;\;x1 + \left(\left(x1 + 6 \cdot {x1}^{4}\right) + t_3\right)\\

\mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\
\;\;\;\;x1 + \left(t_3 + \left(x1 + \left(\left(t_2 \cdot \left(\left(t_4 \cdot \left(x1 \cdot 2\right)\right) \cdot \left(t_4 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot t_4 - 6\right)\right) + t_1 \cdot t_4\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x1 < -3.9999999999999999e156

    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. Taylor expanded in x1 around 0 0.0%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow2100.0%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*100.0%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified100.0%

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

    if -3.9999999999999999e156 < x1 < -5e102

    1. Initial program 6.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. Taylor expanded in x1 around inf 93.3%

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

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

      \[\leadsto x1 + \left(\left(\color{blue}{{x1}^{4} \cdot 6} + 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.8e137

    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) \]

    if 1.8e137 < x1

    1. Initial program 7.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. Taylor expanded in x1 around 0 7.3%

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

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

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

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

        \[\leadsto x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(-6 \cdot x2 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right)\right) \]
      3. associate-*l*100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -4 \cdot 10^{+156}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{elif}\;x1 \leq -5 \cdot 10^{+102}:\\ \;\;\;\;x1 + \left(\left(x1 + 6 \cdot {x1}^{4}\right) + 3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1}\right)\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(\left(\left(1 + x1 \cdot x1\right) \cdot \left(\left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} \cdot \left(x1 \cdot 2\right)\right) \cdot \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 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}{1 + x1 \cdot x1}\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(x1 \cdot \left(x1 \cdot 9\right) + x2 \cdot -6\right)\right)\\ \end{array} \]

Alternative 5: 93.9% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_0 := x1 \cdot \left(x1 \cdot 9\right)\\
t_1 := 1 + x1 \cdot x1\\
t_2 := x1 \cdot \left(x1 \cdot 3\right)\\
t_3 := \frac{\left(t_2 + 2 \cdot x2\right) - x1}{t_1}\\
\mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\
\;\;\;\;x1 + t_0\\

\mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\
\;\;\;\;x1 + \left(3 \cdot \frac{\left(t_2 - 2 \cdot x2\right) - x1}{t_1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(t_1 \cdot \left(\left(t_3 \cdot \left(x1 \cdot 2\right)\right) \cdot \left(t_3 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot t_3 - 6\right)\right) + 3 \cdot t_2\right)\right)\right)\right)\\

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


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

    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. Taylor expanded in x1 around 0 0.0%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative77.2%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow277.2%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*77.2%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified77.2%

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

    if -1.59999999999999987e135 < x1 < 1.8e137

    1. Initial program 96.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. Taylor expanded in x1 around inf 95.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 \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 1.8e137 < x1

    1. Initial program 7.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. Taylor expanded in x1 around 0 7.3%

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

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

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

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

        \[\leadsto x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(-6 \cdot x2 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right)\right) \]
      3. associate-*l*100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(\left(1 + x1 \cdot x1\right) \cdot \left(\left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} \cdot \left(x1 \cdot 2\right)\right) \cdot \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 6\right)\right) + 3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(x1 \cdot \left(x1 \cdot 9\right) + x2 \cdot -6\right)\right)\\ \end{array} \]

Alternative 6: 90.5% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot \left(x1 \cdot 3\right)\\ t_1 := 1 + x1 \cdot x1\\ t_2 := x1 \cdot \left(x1 \cdot 9\right)\\ t_3 := \frac{\left(t_0 + 2 \cdot x2\right) - x1}{t_1}\\ \mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\ \;\;\;\;x1 + t_2\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(t_0 - 2 \cdot x2\right) - x1}{t_1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot t_0 + t_1 \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot t_3 - 6\right) + \left(t_3 - 3\right) \cdot \left(\left(2 \cdot x2 - x1\right) \cdot \left(x1 \cdot 2\right)\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(t_2 + x2 \cdot -6\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* x1 (* x1 3.0)))
        (t_1 (+ 1.0 (* x1 x1)))
        (t_2 (* x1 (* x1 9.0)))
        (t_3 (/ (- (+ t_0 (* 2.0 x2)) x1) t_1)))
   (if (<= x1 -1.6e+135)
     (+ x1 t_2)
     (if (<= x1 1.8e+137)
       (+
        x1
        (+
         (* 3.0 (/ (- (- t_0 (* 2.0 x2)) x1) t_1))
         (+
          x1
          (+
           (* x1 (* x1 x1))
           (+
            (* 3.0 t_0)
            (*
             t_1
             (+
              (* (* x1 x1) (- (* 4.0 t_3) 6.0))
              (* (- t_3 3.0) (* (- (* 2.0 x2) x1) (* x1 2.0))))))))))
       (+
        x1
        (+
         (* x1 (- (* 4.0 (* x2 (- (* 2.0 x2) 3.0))) 2.0))
         (+ t_2 (* x2 -6.0))))))))
double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = 1.0 + (x1 * x1);
	double t_2 = x1 * (x1 * 9.0);
	double t_3 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	double tmp;
	if (x1 <= -1.6e+135) {
		tmp = x1 + t_2;
	} else if (x1 <= 1.8e+137) {
		tmp = x1 + ((3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_1 * (((x1 * x1) * ((4.0 * t_3) - 6.0)) + ((t_3 - 3.0) * (((2.0 * x2) - x1) * (x1 * 2.0)))))))));
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * ((2.0 * x2) - 3.0))) - 2.0)) + (t_2 + (x2 * -6.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) :: t_3
    real(8) :: tmp
    t_0 = x1 * (x1 * 3.0d0)
    t_1 = 1.0d0 + (x1 * x1)
    t_2 = x1 * (x1 * 9.0d0)
    t_3 = ((t_0 + (2.0d0 * x2)) - x1) / t_1
    if (x1 <= (-1.6d+135)) then
        tmp = x1 + t_2
    else if (x1 <= 1.8d+137) then
        tmp = x1 + ((3.0d0 * (((t_0 - (2.0d0 * x2)) - x1) / t_1)) + (x1 + ((x1 * (x1 * x1)) + ((3.0d0 * t_0) + (t_1 * (((x1 * x1) * ((4.0d0 * t_3) - 6.0d0)) + ((t_3 - 3.0d0) * (((2.0d0 * x2) - x1) * (x1 * 2.0d0)))))))))
    else
        tmp = x1 + ((x1 * ((4.0d0 * (x2 * ((2.0d0 * x2) - 3.0d0))) - 2.0d0)) + (t_2 + (x2 * (-6.0d0))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = 1.0 + (x1 * x1);
	double t_2 = x1 * (x1 * 9.0);
	double t_3 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	double tmp;
	if (x1 <= -1.6e+135) {
		tmp = x1 + t_2;
	} else if (x1 <= 1.8e+137) {
		tmp = x1 + ((3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_1 * (((x1 * x1) * ((4.0 * t_3) - 6.0)) + ((t_3 - 3.0) * (((2.0 * x2) - x1) * (x1 * 2.0)))))))));
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * ((2.0 * x2) - 3.0))) - 2.0)) + (t_2 + (x2 * -6.0)));
	}
	return tmp;
}
def code(x1, x2):
	t_0 = x1 * (x1 * 3.0)
	t_1 = 1.0 + (x1 * x1)
	t_2 = x1 * (x1 * 9.0)
	t_3 = ((t_0 + (2.0 * x2)) - x1) / t_1
	tmp = 0
	if x1 <= -1.6e+135:
		tmp = x1 + t_2
	elif x1 <= 1.8e+137:
		tmp = x1 + ((3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_1 * (((x1 * x1) * ((4.0 * t_3) - 6.0)) + ((t_3 - 3.0) * (((2.0 * x2) - x1) * (x1 * 2.0)))))))))
	else:
		tmp = x1 + ((x1 * ((4.0 * (x2 * ((2.0 * x2) - 3.0))) - 2.0)) + (t_2 + (x2 * -6.0)))
	return tmp
function code(x1, x2)
	t_0 = Float64(x1 * Float64(x1 * 3.0))
	t_1 = Float64(1.0 + Float64(x1 * x1))
	t_2 = Float64(x1 * Float64(x1 * 9.0))
	t_3 = Float64(Float64(Float64(t_0 + Float64(2.0 * x2)) - x1) / t_1)
	tmp = 0.0
	if (x1 <= -1.6e+135)
		tmp = Float64(x1 + t_2);
	elseif (x1 <= 1.8e+137)
		tmp = Float64(x1 + Float64(Float64(3.0 * Float64(Float64(Float64(t_0 - Float64(2.0 * x2)) - x1) / t_1)) + Float64(x1 + Float64(Float64(x1 * Float64(x1 * x1)) + Float64(Float64(3.0 * t_0) + Float64(t_1 * Float64(Float64(Float64(x1 * x1) * Float64(Float64(4.0 * t_3) - 6.0)) + Float64(Float64(t_3 - 3.0) * Float64(Float64(Float64(2.0 * x2) - x1) * Float64(x1 * 2.0))))))))));
	else
		tmp = Float64(x1 + Float64(Float64(x1 * Float64(Float64(4.0 * Float64(x2 * Float64(Float64(2.0 * x2) - 3.0))) - 2.0)) + Float64(t_2 + Float64(x2 * -6.0))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = x1 * (x1 * 3.0);
	t_1 = 1.0 + (x1 * x1);
	t_2 = x1 * (x1 * 9.0);
	t_3 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	tmp = 0.0;
	if (x1 <= -1.6e+135)
		tmp = x1 + t_2;
	elseif (x1 <= 1.8e+137)
		tmp = x1 + ((3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_1 * (((x1 * x1) * ((4.0 * t_3) - 6.0)) + ((t_3 - 3.0) * (((2.0 * x2) - x1) * (x1 * 2.0)))))))));
	else
		tmp = x1 + ((x1 * ((4.0 * (x2 * ((2.0 * x2) - 3.0))) - 2.0)) + (t_2 + (x2 * -6.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[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x1 * N[(x1 * 9.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(t$95$0 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[x1, -1.6e+135], N[(x1 + t$95$2), $MachinePrecision], If[LessEqual[x1, 1.8e+137], N[(x1 + N[(N[(3.0 * N[(N[(N[(t$95$0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(x1 + N[(N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + N[(N[(3.0 * t$95$0), $MachinePrecision] + N[(t$95$1 * N[(N[(N[(x1 * x1), $MachinePrecision] * N[(N[(4.0 * t$95$3), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$3 - 3.0), $MachinePrecision] * N[(N[(N[(2.0 * x2), $MachinePrecision] - x1), $MachinePrecision] * N[(x1 * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x1 + N[(N[(x1 * N[(N[(4.0 * N[(x2 * N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 \cdot \left(x1 \cdot 3\right)\\
t_1 := 1 + x1 \cdot x1\\
t_2 := x1 \cdot \left(x1 \cdot 9\right)\\
t_3 := \frac{\left(t_0 + 2 \cdot x2\right) - x1}{t_1}\\
\mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\
\;\;\;\;x1 + t_2\\

\mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\
\;\;\;\;x1 + \left(3 \cdot \frac{\left(t_0 - 2 \cdot x2\right) - x1}{t_1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot t_0 + t_1 \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot t_3 - 6\right) + \left(t_3 - 3\right) \cdot \left(\left(2 \cdot x2 - x1\right) \cdot \left(x1 \cdot 2\right)\right)\right)\right)\right)\right)\right)\\

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


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

    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. Taylor expanded in x1 around 0 0.0%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative77.2%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow277.2%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*77.2%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified77.2%

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

    if -1.59999999999999987e135 < x1 < 1.8e137

    1. Initial program 96.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. Taylor expanded in x1 around 0 93.0%

      \[\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) \]
    3. Taylor expanded in x1 around inf 92.8%

      \[\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 1.8e137 < x1

    1. Initial program 7.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. Taylor expanded in x1 around 0 7.3%

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

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

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

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

        \[\leadsto x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(-6 \cdot x2 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right)\right) \]
      3. associate-*l*100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left(1 + x1 \cdot x1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 6\right) + \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 3\right) \cdot \left(\left(2 \cdot x2 - x1\right) \cdot \left(x1 \cdot 2\right)\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(x1 \cdot \left(x1 \cdot 9\right) + x2 \cdot -6\right)\right)\\ \end{array} \]

Alternative 7: 89.6% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot \left(x1 \cdot 3\right)\\ t_1 := x1 \cdot \left(x1 \cdot 9\right)\\ t_2 := 1 + x1 \cdot x1\\ t_3 := 2 \cdot x2 - 3\\ \mathbf{if}\;x1 \leq -1.65 \cdot 10^{+135}:\\ \;\;\;\;x1 + t_1\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(t_0 - 2 \cdot x2\right) - x1}{t_2} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot t_0 + t_2 \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(t_0 + 2 \cdot x2\right) - x1}{t_2} - 6\right) + 4 \cdot \left(x2 \cdot \left(x1 \cdot t_3\right)\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot t_3\right) - 2\right) + \left(t_1 + x2 \cdot -6\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* x1 (* x1 3.0)))
        (t_1 (* x1 (* x1 9.0)))
        (t_2 (+ 1.0 (* x1 x1)))
        (t_3 (- (* 2.0 x2) 3.0)))
   (if (<= x1 -1.65e+135)
     (+ x1 t_1)
     (if (<= x1 1.8e+137)
       (+
        x1
        (+
         (* 3.0 (/ (- (- t_0 (* 2.0 x2)) x1) t_2))
         (+
          x1
          (+
           (* x1 (* x1 x1))
           (+
            (* 3.0 t_0)
            (*
             t_2
             (+
              (* (* x1 x1) (- (* 4.0 (/ (- (+ t_0 (* 2.0 x2)) x1) t_2)) 6.0))
              (* 4.0 (* x2 (* x1 t_3))))))))))
       (+ x1 (+ (* x1 (- (* 4.0 (* x2 t_3)) 2.0)) (+ t_1 (* x2 -6.0))))))))
double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = x1 * (x1 * 9.0);
	double t_2 = 1.0 + (x1 * x1);
	double t_3 = (2.0 * x2) - 3.0;
	double tmp;
	if (x1 <= -1.65e+135) {
		tmp = x1 + t_1;
	} else if (x1 <= 1.8e+137) {
		tmp = x1 + ((3.0 * (((t_0 - (2.0 * x2)) - x1) / t_2)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_2 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_2)) - 6.0)) + (4.0 * (x2 * (x1 * t_3)))))))));
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_3)) - 2.0)) + (t_1 + (x2 * -6.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) :: t_3
    real(8) :: tmp
    t_0 = x1 * (x1 * 3.0d0)
    t_1 = x1 * (x1 * 9.0d0)
    t_2 = 1.0d0 + (x1 * x1)
    t_3 = (2.0d0 * x2) - 3.0d0
    if (x1 <= (-1.65d+135)) then
        tmp = x1 + t_1
    else if (x1 <= 1.8d+137) then
        tmp = x1 + ((3.0d0 * (((t_0 - (2.0d0 * x2)) - x1) / t_2)) + (x1 + ((x1 * (x1 * x1)) + ((3.0d0 * t_0) + (t_2 * (((x1 * x1) * ((4.0d0 * (((t_0 + (2.0d0 * x2)) - x1) / t_2)) - 6.0d0)) + (4.0d0 * (x2 * (x1 * t_3)))))))))
    else
        tmp = x1 + ((x1 * ((4.0d0 * (x2 * t_3)) - 2.0d0)) + (t_1 + (x2 * (-6.0d0))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = x1 * (x1 * 9.0);
	double t_2 = 1.0 + (x1 * x1);
	double t_3 = (2.0 * x2) - 3.0;
	double tmp;
	if (x1 <= -1.65e+135) {
		tmp = x1 + t_1;
	} else if (x1 <= 1.8e+137) {
		tmp = x1 + ((3.0 * (((t_0 - (2.0 * x2)) - x1) / t_2)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_2 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_2)) - 6.0)) + (4.0 * (x2 * (x1 * t_3)))))))));
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_3)) - 2.0)) + (t_1 + (x2 * -6.0)));
	}
	return tmp;
}
def code(x1, x2):
	t_0 = x1 * (x1 * 3.0)
	t_1 = x1 * (x1 * 9.0)
	t_2 = 1.0 + (x1 * x1)
	t_3 = (2.0 * x2) - 3.0
	tmp = 0
	if x1 <= -1.65e+135:
		tmp = x1 + t_1
	elif x1 <= 1.8e+137:
		tmp = x1 + ((3.0 * (((t_0 - (2.0 * x2)) - x1) / t_2)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_2 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_2)) - 6.0)) + (4.0 * (x2 * (x1 * t_3)))))))))
	else:
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_3)) - 2.0)) + (t_1 + (x2 * -6.0)))
	return tmp
function code(x1, x2)
	t_0 = Float64(x1 * Float64(x1 * 3.0))
	t_1 = Float64(x1 * Float64(x1 * 9.0))
	t_2 = Float64(1.0 + Float64(x1 * x1))
	t_3 = Float64(Float64(2.0 * x2) - 3.0)
	tmp = 0.0
	if (x1 <= -1.65e+135)
		tmp = Float64(x1 + t_1);
	elseif (x1 <= 1.8e+137)
		tmp = Float64(x1 + Float64(Float64(3.0 * Float64(Float64(Float64(t_0 - Float64(2.0 * x2)) - x1) / t_2)) + Float64(x1 + Float64(Float64(x1 * Float64(x1 * x1)) + Float64(Float64(3.0 * t_0) + Float64(t_2 * Float64(Float64(Float64(x1 * x1) * Float64(Float64(4.0 * Float64(Float64(Float64(t_0 + Float64(2.0 * x2)) - x1) / t_2)) - 6.0)) + Float64(4.0 * Float64(x2 * Float64(x1 * t_3))))))))));
	else
		tmp = Float64(x1 + Float64(Float64(x1 * Float64(Float64(4.0 * Float64(x2 * t_3)) - 2.0)) + Float64(t_1 + Float64(x2 * -6.0))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = x1 * (x1 * 3.0);
	t_1 = x1 * (x1 * 9.0);
	t_2 = 1.0 + (x1 * x1);
	t_3 = (2.0 * x2) - 3.0;
	tmp = 0.0;
	if (x1 <= -1.65e+135)
		tmp = x1 + t_1;
	elseif (x1 <= 1.8e+137)
		tmp = x1 + ((3.0 * (((t_0 - (2.0 * x2)) - x1) / t_2)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_2 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_2)) - 6.0)) + (4.0 * (x2 * (x1 * t_3)))))))));
	else
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_3)) - 2.0)) + (t_1 + (x2 * -6.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[(x1 * N[(x1 * 9.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]}, If[LessEqual[x1, -1.65e+135], N[(x1 + t$95$1), $MachinePrecision], If[LessEqual[x1, 1.8e+137], N[(x1 + N[(N[(3.0 * N[(N[(N[(t$95$0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] + N[(x1 + N[(N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + N[(N[(3.0 * t$95$0), $MachinePrecision] + N[(t$95$2 * N[(N[(N[(x1 * x1), $MachinePrecision] * N[(N[(4.0 * N[(N[(N[(t$95$0 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision] + N[(4.0 * N[(x2 * N[(x1 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x1 + N[(N[(x1 * N[(N[(4.0 * N[(x2 * t$95$3), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 \cdot \left(x1 \cdot 3\right)\\
t_1 := x1 \cdot \left(x1 \cdot 9\right)\\
t_2 := 1 + x1 \cdot x1\\
t_3 := 2 \cdot x2 - 3\\
\mathbf{if}\;x1 \leq -1.65 \cdot 10^{+135}:\\
\;\;\;\;x1 + t_1\\

\mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\
\;\;\;\;x1 + \left(3 \cdot \frac{\left(t_0 - 2 \cdot x2\right) - x1}{t_2} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot t_0 + t_2 \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(t_0 + 2 \cdot x2\right) - x1}{t_2} - 6\right) + 4 \cdot \left(x2 \cdot \left(x1 \cdot t_3\right)\right)\right)\right)\right)\right)\right)\\

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


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

    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. Taylor expanded in x1 around 0 0.0%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative77.2%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow277.2%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*77.2%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified77.2%

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

    if -1.65e135 < x1 < 1.8e137

    1. Initial program 96.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. Taylor expanded in x1 around 0 93.0%

      \[\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) \]
    3. Taylor expanded in x1 around inf 92.8%

      \[\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) \]
    4. Taylor expanded in x1 around 0 92.6%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\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 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 1.8e137 < x1

    1. Initial program 7.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. Taylor expanded in x1 around 0 7.3%

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

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

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

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

        \[\leadsto x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(-6 \cdot x2 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right)\right) \]
      3. associate-*l*100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.65 \cdot 10^{+135}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left(1 + x1 \cdot x1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 6\right) + 4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(x1 \cdot \left(x1 \cdot 9\right) + x2 \cdot -6\right)\right)\\ \end{array} \]

Alternative 8: 90.3% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot \left(x1 \cdot 3\right)\\ t_1 := 2 \cdot x2 - 3\\ t_2 := x1 \cdot \left(x1 \cdot 9\right)\\ t_3 := 1 + x1 \cdot x1\\ t_4 := 3 \cdot \frac{\left(t_0 - 2 \cdot x2\right) - x1}{t_3}\\ t_5 := x1 + \left(t_4 + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot t_0 + t_3 \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(t_0 + 2 \cdot x2\right) - x1}{t_3} - 6\right) + x1 \cdot 2\right)\right)\right)\right)\right)\\ \mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\ \;\;\;\;x1 + t_2\\ \mathbf{elif}\;x1 \leq -40:\\ \;\;\;\;t_5\\ \mathbf{elif}\;x1 \leq 14500:\\ \;\;\;\;x1 + \left(t_4 + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot t_1\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;t_5\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot t_1\right) - 2\right) + \left(t_2 + x2 \cdot -6\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* x1 (* x1 3.0)))
        (t_1 (- (* 2.0 x2) 3.0))
        (t_2 (* x1 (* x1 9.0)))
        (t_3 (+ 1.0 (* x1 x1)))
        (t_4 (* 3.0 (/ (- (- t_0 (* 2.0 x2)) x1) t_3)))
        (t_5
         (+
          x1
          (+
           t_4
           (+
            x1
            (+
             (* x1 (* x1 x1))
             (+
              (* 3.0 t_0)
              (*
               t_3
               (+
                (* (* x1 x1) (- (* 4.0 (/ (- (+ t_0 (* 2.0 x2)) x1) t_3)) 6.0))
                (* x1 2.0))))))))))
   (if (<= x1 -1.6e+135)
     (+ x1 t_2)
     (if (<= x1 -40.0)
       t_5
       (if (<= x1 14500.0)
         (+ x1 (+ t_4 (+ x1 (* 4.0 (* x2 (* x1 t_1))))))
         (if (<= x1 1.8e+137)
           t_5
           (+
            x1
            (+ (* x1 (- (* 4.0 (* x2 t_1)) 2.0)) (+ t_2 (* x2 -6.0))))))))))
double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = (2.0 * x2) - 3.0;
	double t_2 = x1 * (x1 * 9.0);
	double t_3 = 1.0 + (x1 * x1);
	double t_4 = 3.0 * (((t_0 - (2.0 * x2)) - x1) / t_3);
	double t_5 = x1 + (t_4 + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_3 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_3)) - 6.0)) + (x1 * 2.0)))))));
	double tmp;
	if (x1 <= -1.6e+135) {
		tmp = x1 + t_2;
	} else if (x1 <= -40.0) {
		tmp = t_5;
	} else if (x1 <= 14500.0) {
		tmp = x1 + (t_4 + (x1 + (4.0 * (x2 * (x1 * t_1)))));
	} else if (x1 <= 1.8e+137) {
		tmp = t_5;
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_1)) - 2.0)) + (t_2 + (x2 * -6.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) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_0 = x1 * (x1 * 3.0d0)
    t_1 = (2.0d0 * x2) - 3.0d0
    t_2 = x1 * (x1 * 9.0d0)
    t_3 = 1.0d0 + (x1 * x1)
    t_4 = 3.0d0 * (((t_0 - (2.0d0 * x2)) - x1) / t_3)
    t_5 = x1 + (t_4 + (x1 + ((x1 * (x1 * x1)) + ((3.0d0 * t_0) + (t_3 * (((x1 * x1) * ((4.0d0 * (((t_0 + (2.0d0 * x2)) - x1) / t_3)) - 6.0d0)) + (x1 * 2.0d0)))))))
    if (x1 <= (-1.6d+135)) then
        tmp = x1 + t_2
    else if (x1 <= (-40.0d0)) then
        tmp = t_5
    else if (x1 <= 14500.0d0) then
        tmp = x1 + (t_4 + (x1 + (4.0d0 * (x2 * (x1 * t_1)))))
    else if (x1 <= 1.8d+137) then
        tmp = t_5
    else
        tmp = x1 + ((x1 * ((4.0d0 * (x2 * t_1)) - 2.0d0)) + (t_2 + (x2 * (-6.0d0))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = (2.0 * x2) - 3.0;
	double t_2 = x1 * (x1 * 9.0);
	double t_3 = 1.0 + (x1 * x1);
	double t_4 = 3.0 * (((t_0 - (2.0 * x2)) - x1) / t_3);
	double t_5 = x1 + (t_4 + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_3 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_3)) - 6.0)) + (x1 * 2.0)))))));
	double tmp;
	if (x1 <= -1.6e+135) {
		tmp = x1 + t_2;
	} else if (x1 <= -40.0) {
		tmp = t_5;
	} else if (x1 <= 14500.0) {
		tmp = x1 + (t_4 + (x1 + (4.0 * (x2 * (x1 * t_1)))));
	} else if (x1 <= 1.8e+137) {
		tmp = t_5;
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_1)) - 2.0)) + (t_2 + (x2 * -6.0)));
	}
	return tmp;
}
def code(x1, x2):
	t_0 = x1 * (x1 * 3.0)
	t_1 = (2.0 * x2) - 3.0
	t_2 = x1 * (x1 * 9.0)
	t_3 = 1.0 + (x1 * x1)
	t_4 = 3.0 * (((t_0 - (2.0 * x2)) - x1) / t_3)
	t_5 = x1 + (t_4 + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_3 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_3)) - 6.0)) + (x1 * 2.0)))))))
	tmp = 0
	if x1 <= -1.6e+135:
		tmp = x1 + t_2
	elif x1 <= -40.0:
		tmp = t_5
	elif x1 <= 14500.0:
		tmp = x1 + (t_4 + (x1 + (4.0 * (x2 * (x1 * t_1)))))
	elif x1 <= 1.8e+137:
		tmp = t_5
	else:
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_1)) - 2.0)) + (t_2 + (x2 * -6.0)))
	return tmp
function code(x1, x2)
	t_0 = Float64(x1 * Float64(x1 * 3.0))
	t_1 = Float64(Float64(2.0 * x2) - 3.0)
	t_2 = Float64(x1 * Float64(x1 * 9.0))
	t_3 = Float64(1.0 + Float64(x1 * x1))
	t_4 = Float64(3.0 * Float64(Float64(Float64(t_0 - Float64(2.0 * x2)) - x1) / t_3))
	t_5 = Float64(x1 + Float64(t_4 + Float64(x1 + Float64(Float64(x1 * Float64(x1 * x1)) + Float64(Float64(3.0 * t_0) + Float64(t_3 * Float64(Float64(Float64(x1 * x1) * Float64(Float64(4.0 * Float64(Float64(Float64(t_0 + Float64(2.0 * x2)) - x1) / t_3)) - 6.0)) + Float64(x1 * 2.0))))))))
	tmp = 0.0
	if (x1 <= -1.6e+135)
		tmp = Float64(x1 + t_2);
	elseif (x1 <= -40.0)
		tmp = t_5;
	elseif (x1 <= 14500.0)
		tmp = Float64(x1 + Float64(t_4 + Float64(x1 + Float64(4.0 * Float64(x2 * Float64(x1 * t_1))))));
	elseif (x1 <= 1.8e+137)
		tmp = t_5;
	else
		tmp = Float64(x1 + Float64(Float64(x1 * Float64(Float64(4.0 * Float64(x2 * t_1)) - 2.0)) + Float64(t_2 + Float64(x2 * -6.0))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = x1 * (x1 * 3.0);
	t_1 = (2.0 * x2) - 3.0;
	t_2 = x1 * (x1 * 9.0);
	t_3 = 1.0 + (x1 * x1);
	t_4 = 3.0 * (((t_0 - (2.0 * x2)) - x1) / t_3);
	t_5 = x1 + (t_4 + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_3 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_3)) - 6.0)) + (x1 * 2.0)))))));
	tmp = 0.0;
	if (x1 <= -1.6e+135)
		tmp = x1 + t_2;
	elseif (x1 <= -40.0)
		tmp = t_5;
	elseif (x1 <= 14500.0)
		tmp = x1 + (t_4 + (x1 + (4.0 * (x2 * (x1 * t_1)))));
	elseif (x1 <= 1.8e+137)
		tmp = t_5;
	else
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_1)) - 2.0)) + (t_2 + (x2 * -6.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[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]}, Block[{t$95$2 = N[(x1 * N[(x1 * 9.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(3.0 * N[(N[(N[(t$95$0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(x1 + N[(t$95$4 + N[(x1 + N[(N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + N[(N[(3.0 * t$95$0), $MachinePrecision] + N[(t$95$3 * N[(N[(N[(x1 * x1), $MachinePrecision] * N[(N[(4.0 * N[(N[(N[(t$95$0 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision] + N[(x1 * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x1, -1.6e+135], N[(x1 + t$95$2), $MachinePrecision], If[LessEqual[x1, -40.0], t$95$5, If[LessEqual[x1, 14500.0], N[(x1 + N[(t$95$4 + N[(x1 + N[(4.0 * N[(x2 * N[(x1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1.8e+137], t$95$5, N[(x1 + N[(N[(x1 * N[(N[(4.0 * N[(x2 * t$95$1), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 \cdot \left(x1 \cdot 3\right)\\
t_1 := 2 \cdot x2 - 3\\
t_2 := x1 \cdot \left(x1 \cdot 9\right)\\
t_3 := 1 + x1 \cdot x1\\
t_4 := 3 \cdot \frac{\left(t_0 - 2 \cdot x2\right) - x1}{t_3}\\
t_5 := x1 + \left(t_4 + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot t_0 + t_3 \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(t_0 + 2 \cdot x2\right) - x1}{t_3} - 6\right) + x1 \cdot 2\right)\right)\right)\right)\right)\\
\mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\
\;\;\;\;x1 + t_2\\

\mathbf{elif}\;x1 \leq -40:\\
\;\;\;\;t_5\\

\mathbf{elif}\;x1 \leq 14500:\\
\;\;\;\;x1 + \left(t_4 + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot t_1\right)\right)\right)\right)\\

\mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\
\;\;\;\;t_5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x1 < -1.59999999999999987e135

    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. Taylor expanded in x1 around 0 0.0%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative77.2%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow277.2%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*77.2%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified77.2%

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

    if -1.59999999999999987e135 < x1 < -40 or 14500 < x1 < 1.8e137

    1. Initial program 89.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. Taylor expanded in x1 around 0 77.2%

      \[\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) \]
    3. Taylor expanded in x1 around inf 82.1%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{2 \cdot x1} + \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. Step-by-step derivation
      1. *-commutative82.1%

        \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{x1 \cdot 2} + \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) \]
    5. Simplified82.1%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{x1 \cdot 2} + \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) \]
    6. Taylor expanded in x1 around inf 82.1%

      \[\leadsto x1 + \left(\left(\left(\left(\left(x1 \cdot 2 + \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 -40 < x1 < 14500

    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. Taylor expanded in x1 around 0 98.8%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\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 1.8e137 < x1

    1. Initial program 7.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. Taylor expanded in x1 around 0 7.3%

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

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

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

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

        \[\leadsto x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(-6 \cdot x2 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right)\right) \]
      3. associate-*l*100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{elif}\;x1 \leq -40:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left(1 + x1 \cdot x1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 6\right) + x1 \cdot 2\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 14500:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left(1 + x1 \cdot x1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 6\right) + x1 \cdot 2\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(x1 \cdot \left(x1 \cdot 9\right) + x2 \cdot -6\right)\right)\\ \end{array} \]

Alternative 9: 89.9% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot \left(x1 \cdot 3\right)\\ t_1 := 2 \cdot x2 - 3\\ t_2 := x1 \cdot \left(x1 \cdot 9\right)\\ t_3 := 1 + x1 \cdot x1\\ t_4 := t_3 \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(t_0 + 2 \cdot x2\right) - x1}{t_3} - 6\right) + x1 \cdot 2\right)\\ t_5 := x1 \cdot \left(x1 \cdot x1\right)\\ t_6 := 3 \cdot \frac{\left(t_0 - 2 \cdot x2\right) - x1}{t_3}\\ \mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\ \;\;\;\;x1 + t_2\\ \mathbf{elif}\;x1 \leq -140:\\ \;\;\;\;x1 + \left(t_6 + \left(x1 + \left(t_5 + \left(t_4 + t_0 \cdot \left(2 \cdot x2\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 14000:\\ \;\;\;\;x1 + \left(t_6 + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot t_1\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;x1 + \left(t_6 + \left(x1 + \left(t_5 + \left(3 \cdot t_0 + t_4\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot t_1\right) - 2\right) + \left(t_2 + x2 \cdot -6\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* x1 (* x1 3.0)))
        (t_1 (- (* 2.0 x2) 3.0))
        (t_2 (* x1 (* x1 9.0)))
        (t_3 (+ 1.0 (* x1 x1)))
        (t_4
         (*
          t_3
          (+
           (* (* x1 x1) (- (* 4.0 (/ (- (+ t_0 (* 2.0 x2)) x1) t_3)) 6.0))
           (* x1 2.0))))
        (t_5 (* x1 (* x1 x1)))
        (t_6 (* 3.0 (/ (- (- t_0 (* 2.0 x2)) x1) t_3))))
   (if (<= x1 -1.6e+135)
     (+ x1 t_2)
     (if (<= x1 -140.0)
       (+ x1 (+ t_6 (+ x1 (+ t_5 (+ t_4 (* t_0 (* 2.0 x2)))))))
       (if (<= x1 14000.0)
         (+ x1 (+ t_6 (+ x1 (* 4.0 (* x2 (* x1 t_1))))))
         (if (<= x1 1.8e+137)
           (+ x1 (+ t_6 (+ x1 (+ t_5 (+ (* 3.0 t_0) t_4)))))
           (+
            x1
            (+ (* x1 (- (* 4.0 (* x2 t_1)) 2.0)) (+ t_2 (* x2 -6.0))))))))))
double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = (2.0 * x2) - 3.0;
	double t_2 = x1 * (x1 * 9.0);
	double t_3 = 1.0 + (x1 * x1);
	double t_4 = t_3 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_3)) - 6.0)) + (x1 * 2.0));
	double t_5 = x1 * (x1 * x1);
	double t_6 = 3.0 * (((t_0 - (2.0 * x2)) - x1) / t_3);
	double tmp;
	if (x1 <= -1.6e+135) {
		tmp = x1 + t_2;
	} else if (x1 <= -140.0) {
		tmp = x1 + (t_6 + (x1 + (t_5 + (t_4 + (t_0 * (2.0 * x2))))));
	} else if (x1 <= 14000.0) {
		tmp = x1 + (t_6 + (x1 + (4.0 * (x2 * (x1 * t_1)))));
	} else if (x1 <= 1.8e+137) {
		tmp = x1 + (t_6 + (x1 + (t_5 + ((3.0 * t_0) + t_4))));
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_1)) - 2.0)) + (t_2 + (x2 * -6.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) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: t_6
    real(8) :: tmp
    t_0 = x1 * (x1 * 3.0d0)
    t_1 = (2.0d0 * x2) - 3.0d0
    t_2 = x1 * (x1 * 9.0d0)
    t_3 = 1.0d0 + (x1 * x1)
    t_4 = t_3 * (((x1 * x1) * ((4.0d0 * (((t_0 + (2.0d0 * x2)) - x1) / t_3)) - 6.0d0)) + (x1 * 2.0d0))
    t_5 = x1 * (x1 * x1)
    t_6 = 3.0d0 * (((t_0 - (2.0d0 * x2)) - x1) / t_3)
    if (x1 <= (-1.6d+135)) then
        tmp = x1 + t_2
    else if (x1 <= (-140.0d0)) then
        tmp = x1 + (t_6 + (x1 + (t_5 + (t_4 + (t_0 * (2.0d0 * x2))))))
    else if (x1 <= 14000.0d0) then
        tmp = x1 + (t_6 + (x1 + (4.0d0 * (x2 * (x1 * t_1)))))
    else if (x1 <= 1.8d+137) then
        tmp = x1 + (t_6 + (x1 + (t_5 + ((3.0d0 * t_0) + t_4))))
    else
        tmp = x1 + ((x1 * ((4.0d0 * (x2 * t_1)) - 2.0d0)) + (t_2 + (x2 * (-6.0d0))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = (2.0 * x2) - 3.0;
	double t_2 = x1 * (x1 * 9.0);
	double t_3 = 1.0 + (x1 * x1);
	double t_4 = t_3 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_3)) - 6.0)) + (x1 * 2.0));
	double t_5 = x1 * (x1 * x1);
	double t_6 = 3.0 * (((t_0 - (2.0 * x2)) - x1) / t_3);
	double tmp;
	if (x1 <= -1.6e+135) {
		tmp = x1 + t_2;
	} else if (x1 <= -140.0) {
		tmp = x1 + (t_6 + (x1 + (t_5 + (t_4 + (t_0 * (2.0 * x2))))));
	} else if (x1 <= 14000.0) {
		tmp = x1 + (t_6 + (x1 + (4.0 * (x2 * (x1 * t_1)))));
	} else if (x1 <= 1.8e+137) {
		tmp = x1 + (t_6 + (x1 + (t_5 + ((3.0 * t_0) + t_4))));
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_1)) - 2.0)) + (t_2 + (x2 * -6.0)));
	}
	return tmp;
}
def code(x1, x2):
	t_0 = x1 * (x1 * 3.0)
	t_1 = (2.0 * x2) - 3.0
	t_2 = x1 * (x1 * 9.0)
	t_3 = 1.0 + (x1 * x1)
	t_4 = t_3 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_3)) - 6.0)) + (x1 * 2.0))
	t_5 = x1 * (x1 * x1)
	t_6 = 3.0 * (((t_0 - (2.0 * x2)) - x1) / t_3)
	tmp = 0
	if x1 <= -1.6e+135:
		tmp = x1 + t_2
	elif x1 <= -140.0:
		tmp = x1 + (t_6 + (x1 + (t_5 + (t_4 + (t_0 * (2.0 * x2))))))
	elif x1 <= 14000.0:
		tmp = x1 + (t_6 + (x1 + (4.0 * (x2 * (x1 * t_1)))))
	elif x1 <= 1.8e+137:
		tmp = x1 + (t_6 + (x1 + (t_5 + ((3.0 * t_0) + t_4))))
	else:
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_1)) - 2.0)) + (t_2 + (x2 * -6.0)))
	return tmp
function code(x1, x2)
	t_0 = Float64(x1 * Float64(x1 * 3.0))
	t_1 = Float64(Float64(2.0 * x2) - 3.0)
	t_2 = Float64(x1 * Float64(x1 * 9.0))
	t_3 = Float64(1.0 + Float64(x1 * x1))
	t_4 = Float64(t_3 * Float64(Float64(Float64(x1 * x1) * Float64(Float64(4.0 * Float64(Float64(Float64(t_0 + Float64(2.0 * x2)) - x1) / t_3)) - 6.0)) + Float64(x1 * 2.0)))
	t_5 = Float64(x1 * Float64(x1 * x1))
	t_6 = Float64(3.0 * Float64(Float64(Float64(t_0 - Float64(2.0 * x2)) - x1) / t_3))
	tmp = 0.0
	if (x1 <= -1.6e+135)
		tmp = Float64(x1 + t_2);
	elseif (x1 <= -140.0)
		tmp = Float64(x1 + Float64(t_6 + Float64(x1 + Float64(t_5 + Float64(t_4 + Float64(t_0 * Float64(2.0 * x2)))))));
	elseif (x1 <= 14000.0)
		tmp = Float64(x1 + Float64(t_6 + Float64(x1 + Float64(4.0 * Float64(x2 * Float64(x1 * t_1))))));
	elseif (x1 <= 1.8e+137)
		tmp = Float64(x1 + Float64(t_6 + Float64(x1 + Float64(t_5 + Float64(Float64(3.0 * t_0) + t_4)))));
	else
		tmp = Float64(x1 + Float64(Float64(x1 * Float64(Float64(4.0 * Float64(x2 * t_1)) - 2.0)) + Float64(t_2 + Float64(x2 * -6.0))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = x1 * (x1 * 3.0);
	t_1 = (2.0 * x2) - 3.0;
	t_2 = x1 * (x1 * 9.0);
	t_3 = 1.0 + (x1 * x1);
	t_4 = t_3 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_3)) - 6.0)) + (x1 * 2.0));
	t_5 = x1 * (x1 * x1);
	t_6 = 3.0 * (((t_0 - (2.0 * x2)) - x1) / t_3);
	tmp = 0.0;
	if (x1 <= -1.6e+135)
		tmp = x1 + t_2;
	elseif (x1 <= -140.0)
		tmp = x1 + (t_6 + (x1 + (t_5 + (t_4 + (t_0 * (2.0 * x2))))));
	elseif (x1 <= 14000.0)
		tmp = x1 + (t_6 + (x1 + (4.0 * (x2 * (x1 * t_1)))));
	elseif (x1 <= 1.8e+137)
		tmp = x1 + (t_6 + (x1 + (t_5 + ((3.0 * t_0) + t_4))));
	else
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_1)) - 2.0)) + (t_2 + (x2 * -6.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[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]}, Block[{t$95$2 = N[(x1 * N[(x1 * 9.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * N[(N[(N[(x1 * x1), $MachinePrecision] * N[(N[(4.0 * N[(N[(N[(t$95$0 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision] + N[(x1 * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(3.0 * N[(N[(N[(t$95$0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x1, -1.6e+135], N[(x1 + t$95$2), $MachinePrecision], If[LessEqual[x1, -140.0], N[(x1 + N[(t$95$6 + N[(x1 + N[(t$95$5 + N[(t$95$4 + N[(t$95$0 * N[(2.0 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 14000.0], N[(x1 + N[(t$95$6 + N[(x1 + N[(4.0 * N[(x2 * N[(x1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1.8e+137], N[(x1 + N[(t$95$6 + N[(x1 + N[(t$95$5 + N[(N[(3.0 * t$95$0), $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x1 + N[(N[(x1 * N[(N[(4.0 * N[(x2 * t$95$1), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 \cdot \left(x1 \cdot 3\right)\\
t_1 := 2 \cdot x2 - 3\\
t_2 := x1 \cdot \left(x1 \cdot 9\right)\\
t_3 := 1 + x1 \cdot x1\\
t_4 := t_3 \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(t_0 + 2 \cdot x2\right) - x1}{t_3} - 6\right) + x1 \cdot 2\right)\\
t_5 := x1 \cdot \left(x1 \cdot x1\right)\\
t_6 := 3 \cdot \frac{\left(t_0 - 2 \cdot x2\right) - x1}{t_3}\\
\mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\
\;\;\;\;x1 + t_2\\

\mathbf{elif}\;x1 \leq -140:\\
\;\;\;\;x1 + \left(t_6 + \left(x1 + \left(t_5 + \left(t_4 + t_0 \cdot \left(2 \cdot x2\right)\right)\right)\right)\right)\\

\mathbf{elif}\;x1 \leq 14000:\\
\;\;\;\;x1 + \left(t_6 + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot t_1\right)\right)\right)\right)\\

\mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\
\;\;\;\;x1 + \left(t_6 + \left(x1 + \left(t_5 + \left(3 \cdot t_0 + t_4\right)\right)\right)\right)\\

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


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

    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. Taylor expanded in x1 around 0 0.0%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative77.2%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow277.2%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*77.2%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified77.2%

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

    if -1.59999999999999987e135 < x1 < -140

    1. Initial program 79.5%

      \[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. Taylor expanded in x1 around 0 70.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) \]
    3. Taylor expanded in x1 around inf 70.7%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{2 \cdot x1} + \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. Step-by-step derivation
      1. *-commutative70.7%

        \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{x1 \cdot 2} + \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) \]
    5. Simplified70.7%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{x1 \cdot 2} + \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) \]
    6. Taylor expanded in x1 around 0 70.7%

      \[\leadsto x1 + \left(\left(\left(\left(\left(x1 \cdot 2 + \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}{\left(2 \cdot x2\right)}\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 -140 < x1 < 14000

    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. Taylor expanded in x1 around 0 98.8%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\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 14000 < x1 < 1.8e137

    1. Initial program 99.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. Taylor expanded in x1 around 0 84.1%

      \[\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) \]
    3. Taylor expanded in x1 around inf 94.4%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{2 \cdot x1} + \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. Step-by-step derivation
      1. *-commutative94.4%

        \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{x1 \cdot 2} + \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) \]
    5. Simplified94.4%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{x1 \cdot 2} + \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) \]
    6. Taylor expanded in x1 around inf 94.4%

      \[\leadsto x1 + \left(\left(\left(\left(\left(x1 \cdot 2 + \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 1.8e137 < x1

    1. Initial program 7.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. Taylor expanded in x1 around 0 7.3%

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

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

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

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

        \[\leadsto x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(-6 \cdot x2 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right)\right) \]
      3. associate-*l*100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{elif}\;x1 \leq -140:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(\left(1 + x1 \cdot x1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 6\right) + x1 \cdot 2\right) + \left(x1 \cdot \left(x1 \cdot 3\right)\right) \cdot \left(2 \cdot x2\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 14000:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left(1 + x1 \cdot x1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 6\right) + x1 \cdot 2\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(x1 \cdot \left(x1 \cdot 9\right) + x2 \cdot -6\right)\right)\\ \end{array} \]

Alternative 10: 89.9% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot \left(x1 \cdot 3\right)\\ t_1 := 2 \cdot x2 - 3\\ t_2 := x1 \cdot \left(x1 \cdot 9\right)\\ t_3 := 1 + x1 \cdot x1\\ t_4 := t_3 \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(t_0 + 2 \cdot x2\right) - x1}{t_3} - 6\right) + x1 \cdot 2\right)\\ t_5 := x1 \cdot \left(x1 \cdot x1\right)\\ t_6 := 3 \cdot \frac{\left(t_0 - 2 \cdot x2\right) - x1}{t_3}\\ \mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\ \;\;\;\;x1 + t_2\\ \mathbf{elif}\;x1 \leq -25:\\ \;\;\;\;x1 + \left(t_6 + \left(x1 + \left(t_5 + \left(t_4 + t_0 \cdot \left(2 \cdot x2 - x1\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 7000:\\ \;\;\;\;x1 + \left(t_6 + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot t_1\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;x1 + \left(t_6 + \left(x1 + \left(t_5 + \left(3 \cdot t_0 + t_4\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot t_1\right) - 2\right) + \left(t_2 + x2 \cdot -6\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* x1 (* x1 3.0)))
        (t_1 (- (* 2.0 x2) 3.0))
        (t_2 (* x1 (* x1 9.0)))
        (t_3 (+ 1.0 (* x1 x1)))
        (t_4
         (*
          t_3
          (+
           (* (* x1 x1) (- (* 4.0 (/ (- (+ t_0 (* 2.0 x2)) x1) t_3)) 6.0))
           (* x1 2.0))))
        (t_5 (* x1 (* x1 x1)))
        (t_6 (* 3.0 (/ (- (- t_0 (* 2.0 x2)) x1) t_3))))
   (if (<= x1 -1.6e+135)
     (+ x1 t_2)
     (if (<= x1 -25.0)
       (+ x1 (+ t_6 (+ x1 (+ t_5 (+ t_4 (* t_0 (- (* 2.0 x2) x1)))))))
       (if (<= x1 7000.0)
         (+ x1 (+ t_6 (+ x1 (* 4.0 (* x2 (* x1 t_1))))))
         (if (<= x1 1.8e+137)
           (+ x1 (+ t_6 (+ x1 (+ t_5 (+ (* 3.0 t_0) t_4)))))
           (+
            x1
            (+ (* x1 (- (* 4.0 (* x2 t_1)) 2.0)) (+ t_2 (* x2 -6.0))))))))))
double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = (2.0 * x2) - 3.0;
	double t_2 = x1 * (x1 * 9.0);
	double t_3 = 1.0 + (x1 * x1);
	double t_4 = t_3 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_3)) - 6.0)) + (x1 * 2.0));
	double t_5 = x1 * (x1 * x1);
	double t_6 = 3.0 * (((t_0 - (2.0 * x2)) - x1) / t_3);
	double tmp;
	if (x1 <= -1.6e+135) {
		tmp = x1 + t_2;
	} else if (x1 <= -25.0) {
		tmp = x1 + (t_6 + (x1 + (t_5 + (t_4 + (t_0 * ((2.0 * x2) - x1))))));
	} else if (x1 <= 7000.0) {
		tmp = x1 + (t_6 + (x1 + (4.0 * (x2 * (x1 * t_1)))));
	} else if (x1 <= 1.8e+137) {
		tmp = x1 + (t_6 + (x1 + (t_5 + ((3.0 * t_0) + t_4))));
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_1)) - 2.0)) + (t_2 + (x2 * -6.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) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: t_6
    real(8) :: tmp
    t_0 = x1 * (x1 * 3.0d0)
    t_1 = (2.0d0 * x2) - 3.0d0
    t_2 = x1 * (x1 * 9.0d0)
    t_3 = 1.0d0 + (x1 * x1)
    t_4 = t_3 * (((x1 * x1) * ((4.0d0 * (((t_0 + (2.0d0 * x2)) - x1) / t_3)) - 6.0d0)) + (x1 * 2.0d0))
    t_5 = x1 * (x1 * x1)
    t_6 = 3.0d0 * (((t_0 - (2.0d0 * x2)) - x1) / t_3)
    if (x1 <= (-1.6d+135)) then
        tmp = x1 + t_2
    else if (x1 <= (-25.0d0)) then
        tmp = x1 + (t_6 + (x1 + (t_5 + (t_4 + (t_0 * ((2.0d0 * x2) - x1))))))
    else if (x1 <= 7000.0d0) then
        tmp = x1 + (t_6 + (x1 + (4.0d0 * (x2 * (x1 * t_1)))))
    else if (x1 <= 1.8d+137) then
        tmp = x1 + (t_6 + (x1 + (t_5 + ((3.0d0 * t_0) + t_4))))
    else
        tmp = x1 + ((x1 * ((4.0d0 * (x2 * t_1)) - 2.0d0)) + (t_2 + (x2 * (-6.0d0))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = (2.0 * x2) - 3.0;
	double t_2 = x1 * (x1 * 9.0);
	double t_3 = 1.0 + (x1 * x1);
	double t_4 = t_3 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_3)) - 6.0)) + (x1 * 2.0));
	double t_5 = x1 * (x1 * x1);
	double t_6 = 3.0 * (((t_0 - (2.0 * x2)) - x1) / t_3);
	double tmp;
	if (x1 <= -1.6e+135) {
		tmp = x1 + t_2;
	} else if (x1 <= -25.0) {
		tmp = x1 + (t_6 + (x1 + (t_5 + (t_4 + (t_0 * ((2.0 * x2) - x1))))));
	} else if (x1 <= 7000.0) {
		tmp = x1 + (t_6 + (x1 + (4.0 * (x2 * (x1 * t_1)))));
	} else if (x1 <= 1.8e+137) {
		tmp = x1 + (t_6 + (x1 + (t_5 + ((3.0 * t_0) + t_4))));
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_1)) - 2.0)) + (t_2 + (x2 * -6.0)));
	}
	return tmp;
}
def code(x1, x2):
	t_0 = x1 * (x1 * 3.0)
	t_1 = (2.0 * x2) - 3.0
	t_2 = x1 * (x1 * 9.0)
	t_3 = 1.0 + (x1 * x1)
	t_4 = t_3 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_3)) - 6.0)) + (x1 * 2.0))
	t_5 = x1 * (x1 * x1)
	t_6 = 3.0 * (((t_0 - (2.0 * x2)) - x1) / t_3)
	tmp = 0
	if x1 <= -1.6e+135:
		tmp = x1 + t_2
	elif x1 <= -25.0:
		tmp = x1 + (t_6 + (x1 + (t_5 + (t_4 + (t_0 * ((2.0 * x2) - x1))))))
	elif x1 <= 7000.0:
		tmp = x1 + (t_6 + (x1 + (4.0 * (x2 * (x1 * t_1)))))
	elif x1 <= 1.8e+137:
		tmp = x1 + (t_6 + (x1 + (t_5 + ((3.0 * t_0) + t_4))))
	else:
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_1)) - 2.0)) + (t_2 + (x2 * -6.0)))
	return tmp
function code(x1, x2)
	t_0 = Float64(x1 * Float64(x1 * 3.0))
	t_1 = Float64(Float64(2.0 * x2) - 3.0)
	t_2 = Float64(x1 * Float64(x1 * 9.0))
	t_3 = Float64(1.0 + Float64(x1 * x1))
	t_4 = Float64(t_3 * Float64(Float64(Float64(x1 * x1) * Float64(Float64(4.0 * Float64(Float64(Float64(t_0 + Float64(2.0 * x2)) - x1) / t_3)) - 6.0)) + Float64(x1 * 2.0)))
	t_5 = Float64(x1 * Float64(x1 * x1))
	t_6 = Float64(3.0 * Float64(Float64(Float64(t_0 - Float64(2.0 * x2)) - x1) / t_3))
	tmp = 0.0
	if (x1 <= -1.6e+135)
		tmp = Float64(x1 + t_2);
	elseif (x1 <= -25.0)
		tmp = Float64(x1 + Float64(t_6 + Float64(x1 + Float64(t_5 + Float64(t_4 + Float64(t_0 * Float64(Float64(2.0 * x2) - x1)))))));
	elseif (x1 <= 7000.0)
		tmp = Float64(x1 + Float64(t_6 + Float64(x1 + Float64(4.0 * Float64(x2 * Float64(x1 * t_1))))));
	elseif (x1 <= 1.8e+137)
		tmp = Float64(x1 + Float64(t_6 + Float64(x1 + Float64(t_5 + Float64(Float64(3.0 * t_0) + t_4)))));
	else
		tmp = Float64(x1 + Float64(Float64(x1 * Float64(Float64(4.0 * Float64(x2 * t_1)) - 2.0)) + Float64(t_2 + Float64(x2 * -6.0))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = x1 * (x1 * 3.0);
	t_1 = (2.0 * x2) - 3.0;
	t_2 = x1 * (x1 * 9.0);
	t_3 = 1.0 + (x1 * x1);
	t_4 = t_3 * (((x1 * x1) * ((4.0 * (((t_0 + (2.0 * x2)) - x1) / t_3)) - 6.0)) + (x1 * 2.0));
	t_5 = x1 * (x1 * x1);
	t_6 = 3.0 * (((t_0 - (2.0 * x2)) - x1) / t_3);
	tmp = 0.0;
	if (x1 <= -1.6e+135)
		tmp = x1 + t_2;
	elseif (x1 <= -25.0)
		tmp = x1 + (t_6 + (x1 + (t_5 + (t_4 + (t_0 * ((2.0 * x2) - x1))))));
	elseif (x1 <= 7000.0)
		tmp = x1 + (t_6 + (x1 + (4.0 * (x2 * (x1 * t_1)))));
	elseif (x1 <= 1.8e+137)
		tmp = x1 + (t_6 + (x1 + (t_5 + ((3.0 * t_0) + t_4))));
	else
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_1)) - 2.0)) + (t_2 + (x2 * -6.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[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]}, Block[{t$95$2 = N[(x1 * N[(x1 * 9.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * N[(N[(N[(x1 * x1), $MachinePrecision] * N[(N[(4.0 * N[(N[(N[(t$95$0 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision] + N[(x1 * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(3.0 * N[(N[(N[(t$95$0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x1, -1.6e+135], N[(x1 + t$95$2), $MachinePrecision], If[LessEqual[x1, -25.0], N[(x1 + N[(t$95$6 + N[(x1 + N[(t$95$5 + N[(t$95$4 + N[(t$95$0 * N[(N[(2.0 * x2), $MachinePrecision] - x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 7000.0], N[(x1 + N[(t$95$6 + N[(x1 + N[(4.0 * N[(x2 * N[(x1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1.8e+137], N[(x1 + N[(t$95$6 + N[(x1 + N[(t$95$5 + N[(N[(3.0 * t$95$0), $MachinePrecision] + t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x1 + N[(N[(x1 * N[(N[(4.0 * N[(x2 * t$95$1), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 \cdot \left(x1 \cdot 3\right)\\
t_1 := 2 \cdot x2 - 3\\
t_2 := x1 \cdot \left(x1 \cdot 9\right)\\
t_3 := 1 + x1 \cdot x1\\
t_4 := t_3 \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(t_0 + 2 \cdot x2\right) - x1}{t_3} - 6\right) + x1 \cdot 2\right)\\
t_5 := x1 \cdot \left(x1 \cdot x1\right)\\
t_6 := 3 \cdot \frac{\left(t_0 - 2 \cdot x2\right) - x1}{t_3}\\
\mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\
\;\;\;\;x1 + t_2\\

\mathbf{elif}\;x1 \leq -25:\\
\;\;\;\;x1 + \left(t_6 + \left(x1 + \left(t_5 + \left(t_4 + t_0 \cdot \left(2 \cdot x2 - x1\right)\right)\right)\right)\right)\\

\mathbf{elif}\;x1 \leq 7000:\\
\;\;\;\;x1 + \left(t_6 + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot t_1\right)\right)\right)\right)\\

\mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\
\;\;\;\;x1 + \left(t_6 + \left(x1 + \left(t_5 + \left(3 \cdot t_0 + t_4\right)\right)\right)\right)\\

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


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

    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. Taylor expanded in x1 around 0 0.0%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative77.2%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow277.2%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*77.2%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified77.2%

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

    if -1.59999999999999987e135 < x1 < -25

    1. Initial program 79.5%

      \[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. Taylor expanded in x1 around 0 70.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) \]
    3. Taylor expanded in x1 around inf 70.7%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{2 \cdot x1} + \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. Step-by-step derivation
      1. *-commutative70.7%

        \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{x1 \cdot 2} + \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) \]
    5. Simplified70.7%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{x1 \cdot 2} + \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) \]
    6. Taylor expanded in x1 around 0 70.8%

      \[\leadsto x1 + \left(\left(\left(\left(\left(x1 \cdot 2 + \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}{\left(-1 \cdot x1 + 2 \cdot x2\right)}\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 -25 < x1 < 7e3

    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. Taylor expanded in x1 around 0 98.8%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\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 7e3 < x1 < 1.8e137

    1. Initial program 99.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. Taylor expanded in x1 around 0 84.1%

      \[\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) \]
    3. Taylor expanded in x1 around inf 94.4%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{2 \cdot x1} + \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. Step-by-step derivation
      1. *-commutative94.4%

        \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{x1 \cdot 2} + \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) \]
    5. Simplified94.4%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{x1 \cdot 2} + \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) \]
    6. Taylor expanded in x1 around inf 94.4%

      \[\leadsto x1 + \left(\left(\left(\left(\left(x1 \cdot 2 + \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 1.8e137 < x1

    1. Initial program 7.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. Taylor expanded in x1 around 0 7.3%

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

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

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

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

        \[\leadsto x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(-6 \cdot x2 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right)\right) \]
      3. associate-*l*100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{elif}\;x1 \leq -25:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(\left(1 + x1 \cdot x1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 6\right) + x1 \cdot 2\right) + \left(x1 \cdot \left(x1 \cdot 3\right)\right) \cdot \left(2 \cdot x2 - x1\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 7000:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left(1 + x1 \cdot x1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} - 6\right) + x1 \cdot 2\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(x1 \cdot \left(x1 \cdot 9\right) + x2 \cdot -6\right)\right)\\ \end{array} \]

Alternative 11: 88.6% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot x2 - 3\\ t_1 := x1 \cdot \left(x1 \cdot 3\right)\\ t_2 := x1 \cdot \left(x1 \cdot 9\right)\\ t_3 := 1 + x1 \cdot x1\\ t_4 := 3 \cdot \frac{\left(t_1 - 2 \cdot x2\right) - x1}{t_3}\\ t_5 := x1 + \left(t_4 + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(t_1 \cdot \frac{\left(t_1 + 2 \cdot x2\right) - x1}{t_3} + t_3 \cdot \left(x1 \cdot 2 + \left(x1 \cdot x1\right) \cdot 6\right)\right)\right)\right)\right)\\ \mathbf{if}\;x1 \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;x1 + t_2\\ \mathbf{elif}\;x1 \leq -18000000:\\ \;\;\;\;t_5\\ \mathbf{elif}\;x1 \leq 13500:\\ \;\;\;\;x1 + \left(t_4 + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot t_0\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;t_5\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot t_0\right) - 2\right) + \left(t_2 + x2 \cdot -6\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (- (* 2.0 x2) 3.0))
        (t_1 (* x1 (* x1 3.0)))
        (t_2 (* x1 (* x1 9.0)))
        (t_3 (+ 1.0 (* x1 x1)))
        (t_4 (* 3.0 (/ (- (- t_1 (* 2.0 x2)) x1) t_3)))
        (t_5
         (+
          x1
          (+
           t_4
           (+
            x1
            (+
             (* x1 (* x1 x1))
             (+
              (* t_1 (/ (- (+ t_1 (* 2.0 x2)) x1) t_3))
              (* t_3 (+ (* x1 2.0) (* (* x1 x1) 6.0))))))))))
   (if (<= x1 -5.5e+102)
     (+ x1 t_2)
     (if (<= x1 -18000000.0)
       t_5
       (if (<= x1 13500.0)
         (+ x1 (+ t_4 (+ x1 (* 4.0 (* x2 (* x1 t_0))))))
         (if (<= x1 1.8e+137)
           t_5
           (+
            x1
            (+ (* x1 (- (* 4.0 (* x2 t_0)) 2.0)) (+ t_2 (* x2 -6.0))))))))))
double code(double x1, double x2) {
	double t_0 = (2.0 * x2) - 3.0;
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = x1 * (x1 * 9.0);
	double t_3 = 1.0 + (x1 * x1);
	double t_4 = 3.0 * (((t_1 - (2.0 * x2)) - x1) / t_3);
	double t_5 = x1 + (t_4 + (x1 + ((x1 * (x1 * x1)) + ((t_1 * (((t_1 + (2.0 * x2)) - x1) / t_3)) + (t_3 * ((x1 * 2.0) + ((x1 * x1) * 6.0)))))));
	double tmp;
	if (x1 <= -5.5e+102) {
		tmp = x1 + t_2;
	} else if (x1 <= -18000000.0) {
		tmp = t_5;
	} else if (x1 <= 13500.0) {
		tmp = x1 + (t_4 + (x1 + (4.0 * (x2 * (x1 * t_0)))));
	} else if (x1 <= 1.8e+137) {
		tmp = t_5;
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_0)) - 2.0)) + (t_2 + (x2 * -6.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) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_0 = (2.0d0 * x2) - 3.0d0
    t_1 = x1 * (x1 * 3.0d0)
    t_2 = x1 * (x1 * 9.0d0)
    t_3 = 1.0d0 + (x1 * x1)
    t_4 = 3.0d0 * (((t_1 - (2.0d0 * x2)) - x1) / t_3)
    t_5 = x1 + (t_4 + (x1 + ((x1 * (x1 * x1)) + ((t_1 * (((t_1 + (2.0d0 * x2)) - x1) / t_3)) + (t_3 * ((x1 * 2.0d0) + ((x1 * x1) * 6.0d0)))))))
    if (x1 <= (-5.5d+102)) then
        tmp = x1 + t_2
    else if (x1 <= (-18000000.0d0)) then
        tmp = t_5
    else if (x1 <= 13500.0d0) then
        tmp = x1 + (t_4 + (x1 + (4.0d0 * (x2 * (x1 * t_0)))))
    else if (x1 <= 1.8d+137) then
        tmp = t_5
    else
        tmp = x1 + ((x1 * ((4.0d0 * (x2 * t_0)) - 2.0d0)) + (t_2 + (x2 * (-6.0d0))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = (2.0 * x2) - 3.0;
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = x1 * (x1 * 9.0);
	double t_3 = 1.0 + (x1 * x1);
	double t_4 = 3.0 * (((t_1 - (2.0 * x2)) - x1) / t_3);
	double t_5 = x1 + (t_4 + (x1 + ((x1 * (x1 * x1)) + ((t_1 * (((t_1 + (2.0 * x2)) - x1) / t_3)) + (t_3 * ((x1 * 2.0) + ((x1 * x1) * 6.0)))))));
	double tmp;
	if (x1 <= -5.5e+102) {
		tmp = x1 + t_2;
	} else if (x1 <= -18000000.0) {
		tmp = t_5;
	} else if (x1 <= 13500.0) {
		tmp = x1 + (t_4 + (x1 + (4.0 * (x2 * (x1 * t_0)))));
	} else if (x1 <= 1.8e+137) {
		tmp = t_5;
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_0)) - 2.0)) + (t_2 + (x2 * -6.0)));
	}
	return tmp;
}
def code(x1, x2):
	t_0 = (2.0 * x2) - 3.0
	t_1 = x1 * (x1 * 3.0)
	t_2 = x1 * (x1 * 9.0)
	t_3 = 1.0 + (x1 * x1)
	t_4 = 3.0 * (((t_1 - (2.0 * x2)) - x1) / t_3)
	t_5 = x1 + (t_4 + (x1 + ((x1 * (x1 * x1)) + ((t_1 * (((t_1 + (2.0 * x2)) - x1) / t_3)) + (t_3 * ((x1 * 2.0) + ((x1 * x1) * 6.0)))))))
	tmp = 0
	if x1 <= -5.5e+102:
		tmp = x1 + t_2
	elif x1 <= -18000000.0:
		tmp = t_5
	elif x1 <= 13500.0:
		tmp = x1 + (t_4 + (x1 + (4.0 * (x2 * (x1 * t_0)))))
	elif x1 <= 1.8e+137:
		tmp = t_5
	else:
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_0)) - 2.0)) + (t_2 + (x2 * -6.0)))
	return tmp
function code(x1, x2)
	t_0 = Float64(Float64(2.0 * x2) - 3.0)
	t_1 = Float64(x1 * Float64(x1 * 3.0))
	t_2 = Float64(x1 * Float64(x1 * 9.0))
	t_3 = Float64(1.0 + Float64(x1 * x1))
	t_4 = Float64(3.0 * Float64(Float64(Float64(t_1 - Float64(2.0 * x2)) - x1) / t_3))
	t_5 = Float64(x1 + Float64(t_4 + Float64(x1 + Float64(Float64(x1 * Float64(x1 * x1)) + Float64(Float64(t_1 * Float64(Float64(Float64(t_1 + Float64(2.0 * x2)) - x1) / t_3)) + Float64(t_3 * Float64(Float64(x1 * 2.0) + Float64(Float64(x1 * x1) * 6.0))))))))
	tmp = 0.0
	if (x1 <= -5.5e+102)
		tmp = Float64(x1 + t_2);
	elseif (x1 <= -18000000.0)
		tmp = t_5;
	elseif (x1 <= 13500.0)
		tmp = Float64(x1 + Float64(t_4 + Float64(x1 + Float64(4.0 * Float64(x2 * Float64(x1 * t_0))))));
	elseif (x1 <= 1.8e+137)
		tmp = t_5;
	else
		tmp = Float64(x1 + Float64(Float64(x1 * Float64(Float64(4.0 * Float64(x2 * t_0)) - 2.0)) + Float64(t_2 + Float64(x2 * -6.0))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = (2.0 * x2) - 3.0;
	t_1 = x1 * (x1 * 3.0);
	t_2 = x1 * (x1 * 9.0);
	t_3 = 1.0 + (x1 * x1);
	t_4 = 3.0 * (((t_1 - (2.0 * x2)) - x1) / t_3);
	t_5 = x1 + (t_4 + (x1 + ((x1 * (x1 * x1)) + ((t_1 * (((t_1 + (2.0 * x2)) - x1) / t_3)) + (t_3 * ((x1 * 2.0) + ((x1 * x1) * 6.0)))))));
	tmp = 0.0;
	if (x1 <= -5.5e+102)
		tmp = x1 + t_2;
	elseif (x1 <= -18000000.0)
		tmp = t_5;
	elseif (x1 <= 13500.0)
		tmp = x1 + (t_4 + (x1 + (4.0 * (x2 * (x1 * t_0)))));
	elseif (x1 <= 1.8e+137)
		tmp = t_5;
	else
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_0)) - 2.0)) + (t_2 + (x2 * -6.0)));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]}, Block[{t$95$1 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x1 * N[(x1 * 9.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(3.0 * N[(N[(N[(t$95$1 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(x1 + N[(t$95$4 + N[(x1 + N[(N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 * N[(N[(N[(t$95$1 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 * N[(N[(x1 * 2.0), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x1, -5.5e+102], N[(x1 + t$95$2), $MachinePrecision], If[LessEqual[x1, -18000000.0], t$95$5, If[LessEqual[x1, 13500.0], N[(x1 + N[(t$95$4 + N[(x1 + N[(4.0 * N[(x2 * N[(x1 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1.8e+137], t$95$5, N[(x1 + N[(N[(x1 * N[(N[(4.0 * N[(x2 * t$95$0), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 + N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x1 \leq -18000000:\\
\;\;\;\;t_5\\

\mathbf{elif}\;x1 \leq 13500:\\
\;\;\;\;x1 + \left(t_4 + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot t_0\right)\right)\right)\right)\\

\mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\
\;\;\;\;t_5\\

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


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

    1. Initial program 2.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. Taylor expanded in x1 around 0 2.4%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative67.0%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow267.0%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*67.0%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified67.0%

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

    if -5.49999999999999981e102 < x1 < -1.8e7 or 13500 < x1 < 1.8e137

    1. Initial program 99.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. Taylor expanded in x1 around 0 85.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) \]
    3. Taylor expanded in x1 around inf 91.4%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{2 \cdot x1} + \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. Step-by-step derivation
      1. *-commutative91.4%

        \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{x1 \cdot 2} + \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) \]
    5. Simplified91.4%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{x1 \cdot 2} + \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) \]
    6. Taylor expanded in x1 around inf 81.2%

      \[\leadsto x1 + \left(\left(\left(\left(\left(x1 \cdot 2 + \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 -1.8e7 < x1 < 13500

    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. Taylor expanded in x1 around 0 98.8%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\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 1.8e137 < x1

    1. Initial program 7.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. Taylor expanded in x1 around 0 7.3%

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

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

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

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

        \[\leadsto x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(-6 \cdot x2 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right)\right) \]
      3. associate-*l*100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{elif}\;x1 \leq -18000000:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \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}{1 + x1 \cdot x1} + \left(1 + x1 \cdot x1\right) \cdot \left(x1 \cdot 2 + \left(x1 \cdot x1\right) \cdot 6\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 13500:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1.8 \cdot 10^{+137}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{1 + x1 \cdot x1} + \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}{1 + x1 \cdot x1} + \left(1 + x1 \cdot x1\right) \cdot \left(x1 \cdot 2 + \left(x1 \cdot x1\right) \cdot 6\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(x1 \cdot \left(x1 \cdot 9\right) + x2 \cdot -6\right)\right)\\ \end{array} \]

Alternative 12: 74.4% accurate, 4.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 2 x2) < -2.00000000000000018e25 or 9.99999999999999977e101 < (*.f64 2 x2)

    1. Initial program 70.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. Taylor expanded in x1 around 0 65.1%

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

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

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

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

    if -2.00000000000000018e25 < (*.f64 2 x2) < 9.99999999999999977e101

    1. Initial program 67.5%

      \[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. Taylor expanded in x1 around 0 45.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;2 \cdot x2 \leq -2 \cdot 10^{+25} \lor \neg \left(2 \cdot x2 \leq 10^{+102}\right):\\ \;\;\;\;x1 + \left(\left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\right) + 3 \cdot \left(x2 \cdot -2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot -2 + \left(x2 \cdot -6 + 9 \cdot \left(x1 \cdot x1\right)\right)\right)\\ \end{array} \]

Alternative 13: 79.9% accurate, 4.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 2 \cdot x2 - 3\\ t_1 := x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{if}\;x1 \leq -7.8 \cdot 10^{+135}:\\ \;\;\;\;x1 + t_1\\ \mathbf{elif}\;x1 \leq 5.7 \cdot 10^{-73}:\\ \;\;\;\;x1 + \left(\left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot t_0\right)\right)\right) + 3 \cdot \left(x2 \cdot -2 - x1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot t_0\right) - 2\right) + \left(t_1 + x2 \cdot -6\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (- (* 2.0 x2) 3.0)) (t_1 (* x1 (* x1 9.0))))
   (if (<= x1 -7.8e+135)
     (+ x1 t_1)
     (if (<= x1 5.7e-73)
       (+ x1 (+ (+ x1 (* 4.0 (* x2 (* x1 t_0)))) (* 3.0 (- (* x2 -2.0) x1))))
       (+ x1 (+ (* x1 (- (* 4.0 (* x2 t_0)) 2.0)) (+ t_1 (* x2 -6.0))))))))
double code(double x1, double x2) {
	double t_0 = (2.0 * x2) - 3.0;
	double t_1 = x1 * (x1 * 9.0);
	double tmp;
	if (x1 <= -7.8e+135) {
		tmp = x1 + t_1;
	} else if (x1 <= 5.7e-73) {
		tmp = x1 + ((x1 + (4.0 * (x2 * (x1 * t_0)))) + (3.0 * ((x2 * -2.0) - x1)));
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_0)) - 2.0)) + (t_1 + (x2 * -6.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) :: tmp
    t_0 = (2.0d0 * x2) - 3.0d0
    t_1 = x1 * (x1 * 9.0d0)
    if (x1 <= (-7.8d+135)) then
        tmp = x1 + t_1
    else if (x1 <= 5.7d-73) then
        tmp = x1 + ((x1 + (4.0d0 * (x2 * (x1 * t_0)))) + (3.0d0 * ((x2 * (-2.0d0)) - x1)))
    else
        tmp = x1 + ((x1 * ((4.0d0 * (x2 * t_0)) - 2.0d0)) + (t_1 + (x2 * (-6.0d0))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = (2.0 * x2) - 3.0;
	double t_1 = x1 * (x1 * 9.0);
	double tmp;
	if (x1 <= -7.8e+135) {
		tmp = x1 + t_1;
	} else if (x1 <= 5.7e-73) {
		tmp = x1 + ((x1 + (4.0 * (x2 * (x1 * t_0)))) + (3.0 * ((x2 * -2.0) - x1)));
	} else {
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_0)) - 2.0)) + (t_1 + (x2 * -6.0)));
	}
	return tmp;
}
def code(x1, x2):
	t_0 = (2.0 * x2) - 3.0
	t_1 = x1 * (x1 * 9.0)
	tmp = 0
	if x1 <= -7.8e+135:
		tmp = x1 + t_1
	elif x1 <= 5.7e-73:
		tmp = x1 + ((x1 + (4.0 * (x2 * (x1 * t_0)))) + (3.0 * ((x2 * -2.0) - x1)))
	else:
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_0)) - 2.0)) + (t_1 + (x2 * -6.0)))
	return tmp
function code(x1, x2)
	t_0 = Float64(Float64(2.0 * x2) - 3.0)
	t_1 = Float64(x1 * Float64(x1 * 9.0))
	tmp = 0.0
	if (x1 <= -7.8e+135)
		tmp = Float64(x1 + t_1);
	elseif (x1 <= 5.7e-73)
		tmp = Float64(x1 + Float64(Float64(x1 + Float64(4.0 * Float64(x2 * Float64(x1 * t_0)))) + Float64(3.0 * Float64(Float64(x2 * -2.0) - x1))));
	else
		tmp = Float64(x1 + Float64(Float64(x1 * Float64(Float64(4.0 * Float64(x2 * t_0)) - 2.0)) + Float64(t_1 + Float64(x2 * -6.0))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = (2.0 * x2) - 3.0;
	t_1 = x1 * (x1 * 9.0);
	tmp = 0.0;
	if (x1 <= -7.8e+135)
		tmp = x1 + t_1;
	elseif (x1 <= 5.7e-73)
		tmp = x1 + ((x1 + (4.0 * (x2 * (x1 * t_0)))) + (3.0 * ((x2 * -2.0) - x1)));
	else
		tmp = x1 + ((x1 * ((4.0 * (x2 * t_0)) - 2.0)) + (t_1 + (x2 * -6.0)));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]}, Block[{t$95$1 = N[(x1 * N[(x1 * 9.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x1, -7.8e+135], N[(x1 + t$95$1), $MachinePrecision], If[LessEqual[x1, 5.7e-73], N[(x1 + N[(N[(x1 + N[(4.0 * N[(x2 * N[(x1 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(3.0 * N[(N[(x2 * -2.0), $MachinePrecision] - x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x1 + N[(N[(x1 * N[(N[(4.0 * N[(x2 * t$95$0), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 + N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 2 \cdot x2 - 3\\
t_1 := x1 \cdot \left(x1 \cdot 9\right)\\
\mathbf{if}\;x1 \leq -7.8 \cdot 10^{+135}:\\
\;\;\;\;x1 + t_1\\

\mathbf{elif}\;x1 \leq 5.7 \cdot 10^{-73}:\\
\;\;\;\;x1 + \left(\left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot t_0\right)\right)\right) + 3 \cdot \left(x2 \cdot -2 - x1\right)\right)\\

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


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

    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. Taylor expanded in x1 around 0 0.0%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative77.2%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow277.2%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*77.2%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified77.2%

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

    if -7.80000000000000064e135 < x1 < 5.6999999999999998e-73

    1. Initial program 95.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. Taylor expanded in x1 around 0 83.7%

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

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

    if 5.6999999999999998e-73 < x1

    1. Initial program 53.9%

      \[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. Taylor expanded in x1 around 0 28.0%

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

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

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

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

        \[\leadsto x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(-6 \cdot x2 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right)\right) \]
      3. associate-*l*74.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -7.8 \cdot 10^{+135}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{elif}\;x1 \leq 5.7 \cdot 10^{-73}:\\ \;\;\;\;x1 + \left(\left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\right) + 3 \cdot \left(x2 \cdot -2 - x1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + \left(x1 \cdot \left(x1 \cdot 9\right) + x2 \cdot -6\right)\right)\\ \end{array} \]

Alternative 14: 70.0% accurate, 5.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;2 \cdot x2 \leq -5 \cdot 10^{+179} \lor \neg \left(2 \cdot x2 \leq 10^{+163}\right):\\
\;\;\;\;x1 + 8 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 2 x2) < -5e179 or 9.9999999999999994e162 < (*.f64 2 x2)

    1. Initial program 74.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. Taylor expanded in x1 around 0 69.1%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{8 \cdot \left({x2}^{2} \cdot x1\right)} \]
    8. Step-by-step derivation
      1. unpow258.2%

        \[\leadsto x1 + 8 \cdot \left(\color{blue}{\left(x2 \cdot x2\right)} \cdot x1\right) \]
      2. associate-*l*72.3%

        \[\leadsto x1 + 8 \cdot \color{blue}{\left(x2 \cdot \left(x2 \cdot x1\right)\right)} \]
    9. Simplified72.3%

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

    if -5e179 < (*.f64 2 x2) < 9.9999999999999994e162

    1. Initial program 67.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. Taylor expanded in x1 around 0 49.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;2 \cdot x2 \leq -5 \cdot 10^{+179} \lor \neg \left(2 \cdot x2 \leq 10^{+163}\right):\\ \;\;\;\;x1 + 8 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x1 \cdot -2 + \left(x2 \cdot -6 + 9 \cdot \left(x1 \cdot x1\right)\right)\right)\\ \end{array} \]

Alternative 15: 60.3% accurate, 6.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 + x1 \cdot \left(x1 \cdot 9\right)\\ t_1 := x1 + 8 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\\ \mathbf{if}\;x1 \leq -4.1 \cdot 10^{+145}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x1 \leq -1.42 \cdot 10^{+23}:\\ \;\;\;\;x1 + 3 \cdot \left(x1 \cdot \left(x1 \cdot \left(3 + 2 \cdot x2\right)\right)\right)\\ \mathbf{elif}\;x1 \leq -1.15 \cdot 10^{-135}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x1 \leq 2.85 \cdot 10^{-86}:\\ \;\;\;\;x2 \cdot -6\\ \mathbf{elif}\;x1 \leq 4.4 \cdot 10^{+153}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (+ x1 (* x1 (* x1 9.0)))) (t_1 (+ x1 (* 8.0 (* x2 (* x1 x2))))))
   (if (<= x1 -4.1e+145)
     t_0
     (if (<= x1 -1.42e+23)
       (+ x1 (* 3.0 (* x1 (* x1 (+ 3.0 (* 2.0 x2))))))
       (if (<= x1 -1.15e-135)
         t_1
         (if (<= x1 2.85e-86) (* x2 -6.0) (if (<= x1 4.4e+153) t_1 t_0)))))))
double code(double x1, double x2) {
	double t_0 = x1 + (x1 * (x1 * 9.0));
	double t_1 = x1 + (8.0 * (x2 * (x1 * x2)));
	double tmp;
	if (x1 <= -4.1e+145) {
		tmp = t_0;
	} else if (x1 <= -1.42e+23) {
		tmp = x1 + (3.0 * (x1 * (x1 * (3.0 + (2.0 * x2)))));
	} else if (x1 <= -1.15e-135) {
		tmp = t_1;
	} else if (x1 <= 2.85e-86) {
		tmp = x2 * -6.0;
	} else if (x1 <= 4.4e+153) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = x1 + (x1 * (x1 * 9.0d0))
    t_1 = x1 + (8.0d0 * (x2 * (x1 * x2)))
    if (x1 <= (-4.1d+145)) then
        tmp = t_0
    else if (x1 <= (-1.42d+23)) then
        tmp = x1 + (3.0d0 * (x1 * (x1 * (3.0d0 + (2.0d0 * x2)))))
    else if (x1 <= (-1.15d-135)) then
        tmp = t_1
    else if (x1 <= 2.85d-86) then
        tmp = x2 * (-6.0d0)
    else if (x1 <= 4.4d+153) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = x1 + (x1 * (x1 * 9.0));
	double t_1 = x1 + (8.0 * (x2 * (x1 * x2)));
	double tmp;
	if (x1 <= -4.1e+145) {
		tmp = t_0;
	} else if (x1 <= -1.42e+23) {
		tmp = x1 + (3.0 * (x1 * (x1 * (3.0 + (2.0 * x2)))));
	} else if (x1 <= -1.15e-135) {
		tmp = t_1;
	} else if (x1 <= 2.85e-86) {
		tmp = x2 * -6.0;
	} else if (x1 <= 4.4e+153) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x1, x2):
	t_0 = x1 + (x1 * (x1 * 9.0))
	t_1 = x1 + (8.0 * (x2 * (x1 * x2)))
	tmp = 0
	if x1 <= -4.1e+145:
		tmp = t_0
	elif x1 <= -1.42e+23:
		tmp = x1 + (3.0 * (x1 * (x1 * (3.0 + (2.0 * x2)))))
	elif x1 <= -1.15e-135:
		tmp = t_1
	elif x1 <= 2.85e-86:
		tmp = x2 * -6.0
	elif x1 <= 4.4e+153:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x1, x2)
	t_0 = Float64(x1 + Float64(x1 * Float64(x1 * 9.0)))
	t_1 = Float64(x1 + Float64(8.0 * Float64(x2 * Float64(x1 * x2))))
	tmp = 0.0
	if (x1 <= -4.1e+145)
		tmp = t_0;
	elseif (x1 <= -1.42e+23)
		tmp = Float64(x1 + Float64(3.0 * Float64(x1 * Float64(x1 * Float64(3.0 + Float64(2.0 * x2))))));
	elseif (x1 <= -1.15e-135)
		tmp = t_1;
	elseif (x1 <= 2.85e-86)
		tmp = Float64(x2 * -6.0);
	elseif (x1 <= 4.4e+153)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = x1 + (x1 * (x1 * 9.0));
	t_1 = x1 + (8.0 * (x2 * (x1 * x2)));
	tmp = 0.0;
	if (x1 <= -4.1e+145)
		tmp = t_0;
	elseif (x1 <= -1.42e+23)
		tmp = x1 + (3.0 * (x1 * (x1 * (3.0 + (2.0 * x2)))));
	elseif (x1 <= -1.15e-135)
		tmp = t_1;
	elseif (x1 <= 2.85e-86)
		tmp = x2 * -6.0;
	elseif (x1 <= 4.4e+153)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(x1 + N[(x1 * N[(x1 * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x1 + N[(8.0 * N[(x2 * N[(x1 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x1, -4.1e+145], t$95$0, If[LessEqual[x1, -1.42e+23], N[(x1 + N[(3.0 * N[(x1 * N[(x1 * N[(3.0 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, -1.15e-135], t$95$1, If[LessEqual[x1, 2.85e-86], N[(x2 * -6.0), $MachinePrecision], If[LessEqual[x1, 4.4e+153], t$95$1, t$95$0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 + x1 \cdot \left(x1 \cdot 9\right)\\
t_1 := x1 + 8 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\\
\mathbf{if}\;x1 \leq -4.1 \cdot 10^{+145}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x1 \leq -1.42 \cdot 10^{+23}:\\
\;\;\;\;x1 + 3 \cdot \left(x1 \cdot \left(x1 \cdot \left(3 + 2 \cdot x2\right)\right)\right)\\

\mathbf{elif}\;x1 \leq -1.15 \cdot 10^{-135}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x1 \leq 2.85 \cdot 10^{-86}:\\
\;\;\;\;x2 \cdot -6\\

\mathbf{elif}\;x1 \leq 4.4 \cdot 10^{+153}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x1 < -4.1000000000000001e145 or 4.3999999999999999e153 < 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. Taylor expanded in x1 around 0 0.0%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative98.6%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow298.6%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*98.6%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified98.6%

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

    if -4.1000000000000001e145 < x1 < -1.42000000000000004e23

    1. Initial program 54.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. Taylor expanded in x1 around 0 7.2%

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

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

      \[\leadsto x1 + \color{blue}{3 \cdot \left({x1}^{2} \cdot \left(3 - -2 \cdot x2\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*24.4%

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

        \[\leadsto x1 + \left(3 \cdot {x1}^{2}\right) \cdot \left(3 - \color{blue}{x2 \cdot -2}\right) \]
      3. associate-*r*24.4%

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

        \[\leadsto x1 + 3 \cdot \left(\color{blue}{\left(x1 \cdot x1\right)} \cdot \left(3 - x2 \cdot -2\right)\right) \]
      5. associate-*l*24.4%

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

        \[\leadsto x1 + 3 \cdot \left(x1 \cdot \left(x1 \cdot \left(3 - \color{blue}{-2 \cdot x2}\right)\right)\right) \]
      7. cancel-sign-sub-inv24.4%

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

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

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

    if -1.42000000000000004e23 < x1 < -1.15e-135 or 2.8500000000000002e-86 < x1 < 4.3999999999999999e153

    1. Initial program 99.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. Taylor expanded in x1 around 0 66.5%

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

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

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

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

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

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

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

        \[\leadsto x1 + 8 \cdot \left(\color{blue}{\left(x2 \cdot x2\right)} \cdot x1\right) \]
      2. associate-*l*37.1%

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

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

    if -1.15e-135 < x1 < 2.8500000000000002e-86

    1. Initial program 99.5%

      \[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. Taylor expanded in x1 around 0 99.5%

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

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

        \[\leadsto x1 + \color{blue}{x2 \cdot -6} \]
    5. Simplified66.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -4.1 \cdot 10^{+145}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{elif}\;x1 \leq -1.42 \cdot 10^{+23}:\\ \;\;\;\;x1 + 3 \cdot \left(x1 \cdot \left(x1 \cdot \left(3 + 2 \cdot x2\right)\right)\right)\\ \mathbf{elif}\;x1 \leq -1.15 \cdot 10^{-135}:\\ \;\;\;\;x1 + 8 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\\ \mathbf{elif}\;x1 \leq 2.85 \cdot 10^{-86}:\\ \;\;\;\;x2 \cdot -6\\ \mathbf{elif}\;x1 \leq 4.4 \cdot 10^{+153}:\\ \;\;\;\;x1 + 8 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \end{array} \]

Alternative 16: 59.5% accurate, 7.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 + x1 \cdot \left(x1 \cdot 9\right)\\ t_1 := x1 + 8 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\\ \mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x1 \leq -7.8 \cdot 10^{-136}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x1 \leq 3.1 \cdot 10^{-86}:\\ \;\;\;\;x2 \cdot -6\\ \mathbf{elif}\;x1 \leq 4.4 \cdot 10^{+153}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (+ x1 (* x1 (* x1 9.0)))) (t_1 (+ x1 (* 8.0 (* x2 (* x1 x2))))))
   (if (<= x1 -1.6e+135)
     t_0
     (if (<= x1 -7.8e-136)
       t_1
       (if (<= x1 3.1e-86) (* x2 -6.0) (if (<= x1 4.4e+153) t_1 t_0))))))
double code(double x1, double x2) {
	double t_0 = x1 + (x1 * (x1 * 9.0));
	double t_1 = x1 + (8.0 * (x2 * (x1 * x2)));
	double tmp;
	if (x1 <= -1.6e+135) {
		tmp = t_0;
	} else if (x1 <= -7.8e-136) {
		tmp = t_1;
	} else if (x1 <= 3.1e-86) {
		tmp = x2 * -6.0;
	} else if (x1 <= 4.4e+153) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = x1 + (x1 * (x1 * 9.0d0))
    t_1 = x1 + (8.0d0 * (x2 * (x1 * x2)))
    if (x1 <= (-1.6d+135)) then
        tmp = t_0
    else if (x1 <= (-7.8d-136)) then
        tmp = t_1
    else if (x1 <= 3.1d-86) then
        tmp = x2 * (-6.0d0)
    else if (x1 <= 4.4d+153) then
        tmp = t_1
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = x1 + (x1 * (x1 * 9.0));
	double t_1 = x1 + (8.0 * (x2 * (x1 * x2)));
	double tmp;
	if (x1 <= -1.6e+135) {
		tmp = t_0;
	} else if (x1 <= -7.8e-136) {
		tmp = t_1;
	} else if (x1 <= 3.1e-86) {
		tmp = x2 * -6.0;
	} else if (x1 <= 4.4e+153) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x1, x2):
	t_0 = x1 + (x1 * (x1 * 9.0))
	t_1 = x1 + (8.0 * (x2 * (x1 * x2)))
	tmp = 0
	if x1 <= -1.6e+135:
		tmp = t_0
	elif x1 <= -7.8e-136:
		tmp = t_1
	elif x1 <= 3.1e-86:
		tmp = x2 * -6.0
	elif x1 <= 4.4e+153:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(x1, x2)
	t_0 = Float64(x1 + Float64(x1 * Float64(x1 * 9.0)))
	t_1 = Float64(x1 + Float64(8.0 * Float64(x2 * Float64(x1 * x2))))
	tmp = 0.0
	if (x1 <= -1.6e+135)
		tmp = t_0;
	elseif (x1 <= -7.8e-136)
		tmp = t_1;
	elseif (x1 <= 3.1e-86)
		tmp = Float64(x2 * -6.0);
	elseif (x1 <= 4.4e+153)
		tmp = t_1;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = x1 + (x1 * (x1 * 9.0));
	t_1 = x1 + (8.0 * (x2 * (x1 * x2)));
	tmp = 0.0;
	if (x1 <= -1.6e+135)
		tmp = t_0;
	elseif (x1 <= -7.8e-136)
		tmp = t_1;
	elseif (x1 <= 3.1e-86)
		tmp = x2 * -6.0;
	elseif (x1 <= 4.4e+153)
		tmp = t_1;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(x1 + N[(x1 * N[(x1 * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x1 + N[(8.0 * N[(x2 * N[(x1 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x1, -1.6e+135], t$95$0, If[LessEqual[x1, -7.8e-136], t$95$1, If[LessEqual[x1, 3.1e-86], N[(x2 * -6.0), $MachinePrecision], If[LessEqual[x1, 4.4e+153], t$95$1, t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 + x1 \cdot \left(x1 \cdot 9\right)\\
t_1 := x1 + 8 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\\
\mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x1 \leq -7.8 \cdot 10^{-136}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x1 \leq 3.1 \cdot 10^{-86}:\\
\;\;\;\;x2 \cdot -6\\

\mathbf{elif}\;x1 \leq 4.4 \cdot 10^{+153}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -1.59999999999999987e135 or 4.3999999999999999e153 < 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. Taylor expanded in x1 around 0 0.0%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative88.9%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow288.9%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*88.9%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified88.9%

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

    if -1.59999999999999987e135 < x1 < -7.79999999999999952e-136 or 3.09999999999999989e-86 < x1 < 4.3999999999999999e153

    1. Initial program 94.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. Taylor expanded in x1 around 0 54.0%

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

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

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

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

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

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

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

        \[\leadsto x1 + 8 \cdot \left(\color{blue}{\left(x2 \cdot x2\right)} \cdot x1\right) \]
      2. associate-*l*31.1%

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

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

    if -7.79999999999999952e-136 < x1 < 3.09999999999999989e-86

    1. Initial program 99.5%

      \[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. Taylor expanded in x1 around 0 99.5%

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

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

        \[\leadsto x1 + \color{blue}{x2 \cdot -6} \]
    5. Simplified66.1%

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

      \[\leadsto \color{blue}{-6 \cdot x2} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification59.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.6 \cdot 10^{+135}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{elif}\;x1 \leq -7.8 \cdot 10^{-136}:\\ \;\;\;\;x1 + 8 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\\ \mathbf{elif}\;x1 \leq 3.1 \cdot 10^{-86}:\\ \;\;\;\;x2 \cdot -6\\ \mathbf{elif}\;x1 \leq 4.4 \cdot 10^{+153}:\\ \;\;\;\;x1 + 8 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \end{array} \]

Alternative 17: 51.3% accurate, 11.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq -3.4 \cdot 10^{-50} \lor \neg \left(x1 \leq 0.185\right):\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (or (<= x1 -3.4e-50) (not (<= x1 0.185)))
   (+ x1 (* x1 (* x1 9.0)))
   (* x2 -6.0)))
double code(double x1, double x2) {
	double tmp;
	if ((x1 <= -3.4e-50) || !(x1 <= 0.185)) {
		tmp = x1 + (x1 * (x1 * 9.0));
	} else {
		tmp = 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 ((x1 <= (-3.4d-50)) .or. (.not. (x1 <= 0.185d0))) then
        tmp = x1 + (x1 * (x1 * 9.0d0))
    else
        tmp = x2 * (-6.0d0)
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if ((x1 <= -3.4e-50) || !(x1 <= 0.185)) {
		tmp = x1 + (x1 * (x1 * 9.0));
	} else {
		tmp = x2 * -6.0;
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if (x1 <= -3.4e-50) or not (x1 <= 0.185):
		tmp = x1 + (x1 * (x1 * 9.0))
	else:
		tmp = x2 * -6.0
	return tmp
function code(x1, x2)
	tmp = 0.0
	if ((x1 <= -3.4e-50) || !(x1 <= 0.185))
		tmp = Float64(x1 + Float64(x1 * Float64(x1 * 9.0)));
	else
		tmp = Float64(x2 * -6.0);
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if ((x1 <= -3.4e-50) || ~((x1 <= 0.185)))
		tmp = x1 + (x1 * (x1 * 9.0));
	else
		tmp = x2 * -6.0;
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[Or[LessEqual[x1, -3.4e-50], N[Not[LessEqual[x1, 0.185]], $MachinePrecision]], N[(x1 + N[(x1 * N[(x1 * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x2 * -6.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -3.4 \cdot 10^{-50} \lor \neg \left(x1 \leq 0.185\right):\\
\;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -3.40000000000000014e-50 or 0.185 < x1

    1. Initial program 40.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. Taylor expanded in x1 around 0 11.7%

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{9 \cdot {x1}^{2}} \]
    8. Step-by-step derivation
      1. *-commutative52.0%

        \[\leadsto x1 + \color{blue}{{x1}^{2} \cdot 9} \]
      2. unpow252.0%

        \[\leadsto x1 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 \]
      3. associate-*r*52.0%

        \[\leadsto x1 + \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} \]
    9. Simplified52.0%

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

    if -3.40000000000000014e-50 < x1 < 0.185

    1. Initial program 99.5%

      \[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. Taylor expanded in x1 around 0 99.5%

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

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

        \[\leadsto x1 + \color{blue}{x2 \cdot -6} \]
    5. Simplified54.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -3.4 \cdot 10^{-50} \lor \neg \left(x1 \leq 0.185\right):\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6\\ \end{array} \]

Alternative 18: 26.8% accurate, 25.4× speedup?

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

\\
x1 + x2 \cdot -6
\end{array}
Derivation
  1. Initial program 68.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. Taylor expanded in x1 around 0 53.9%

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

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

      \[\leadsto x1 + \color{blue}{x2 \cdot -6} \]
  5. Simplified27.7%

    \[\leadsto x1 + \color{blue}{x2 \cdot -6} \]
  6. Final simplification27.7%

    \[\leadsto x1 + x2 \cdot -6 \]

Alternative 19: 26.6% accurate, 42.3× speedup?

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

\\
x2 \cdot -6
\end{array}
Derivation
  1. Initial program 68.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. Taylor expanded in x1 around 0 53.9%

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

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

      \[\leadsto x1 + \color{blue}{x2 \cdot -6} \]
  5. Simplified27.7%

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

    \[\leadsto \color{blue}{-6 \cdot x2} \]
  7. Final simplification27.4%

    \[\leadsto x2 \cdot -6 \]

Alternative 20: 3.3% accurate, 127.0× 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 x1
end
function tmp = code(x1, x2)
	tmp = x1;
end
code[x1_, x2_] := x1
\begin{array}{l}

\\
x1
\end{array}
Derivation
  1. Initial program 68.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. Taylor expanded in x1 around 0 53.9%

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

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

      \[\leadsto x1 + \color{blue}{x2 \cdot -6} \]
  5. Simplified27.7%

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

    \[\leadsto \color{blue}{x1} \]
  7. Final simplification3.6%

    \[\leadsto x1 \]

Reproduce

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