Rosa's FloatVsDoubleBenchmark

Percentage Accurate: 71.0% → 99.5%
Time: 45.4s
Alternatives: 23
Speedup: 4.7×

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 23 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: 71.0% 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)\\ t_1 := x1 \cdot \left(x1 \cdot 3\right)\\ t_2 := x1 \cdot x1 + 1\\ t_3 := \frac{\left(t_1 + 2 \cdot x2\right) - x1}{t_2}\\ \mathbf{if}\;x1 + \left(\left(x1 + \left(\left(t_2 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t_3\right) \cdot \left(t_3 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(t_3 \cdot 4 - 6\right)\right) + t_1 \cdot t_3\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right) + 3 \cdot \frac{\left(t_1 - 2 \cdot x2\right) - x1}{t_2}\right) \leq \infty:\\ \;\;\;\;x1 + \mathsf{fma}\left(3, \frac{t_1 - \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}:\\ \;\;\;\;6 \cdot {x1}^{4} - x1\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (fma x1 (* x1 3.0) (fma 2.0 x2 (- x1))))
        (t_1 (* x1 (* x1 3.0)))
        (t_2 (+ (* x1 x1) 1.0))
        (t_3 (/ (- (+ t_1 (* 2.0 x2)) x1) t_2)))
   (if (<=
        (+
         x1
         (+
          (+
           x1
           (+
            (+
             (*
              t_2
              (+
               (* (* (* x1 2.0) t_3) (- t_3 3.0))
               (* (* x1 x1) (- (* t_3 4.0) 6.0))))
             (* t_1 t_3))
            (* x1 (* x1 x1))))
          (* 3.0 (/ (- (- t_1 (* 2.0 x2)) x1) t_2))))
        INFINITY)
     (+
      x1
      (fma
       3.0
       (/ (- t_1 (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)))))))))
     (- (* 6.0 (pow x1 4.0)) x1))))
double code(double x1, double x2) {
	double t_0 = fma(x1, (x1 * 3.0), fma(2.0, x2, -x1));
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = (x1 * x1) + 1.0;
	double t_3 = ((t_1 + (2.0 * x2)) - x1) / t_2;
	double tmp;
	if ((x1 + ((x1 + (((t_2 * ((((x1 * 2.0) * t_3) * (t_3 - 3.0)) + ((x1 * x1) * ((t_3 * 4.0) - 6.0)))) + (t_1 * t_3)) + (x1 * (x1 * x1)))) + (3.0 * (((t_1 - (2.0 * x2)) - x1) / t_2)))) <= ((double) INFINITY)) {
		tmp = x1 + fma(3.0, ((t_1 - 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 = (6.0 * pow(x1, 4.0)) - x1;
	}
	return tmp;
}
function code(x1, x2)
	t_0 = fma(x1, Float64(x1 * 3.0), fma(2.0, x2, Float64(-x1)))
	t_1 = Float64(x1 * Float64(x1 * 3.0))
	t_2 = Float64(Float64(x1 * x1) + 1.0)
	t_3 = Float64(Float64(Float64(t_1 + Float64(2.0 * x2)) - x1) / t_2)
	tmp = 0.0
	if (Float64(x1 + Float64(Float64(x1 + Float64(Float64(Float64(t_2 * Float64(Float64(Float64(Float64(x1 * 2.0) * t_3) * Float64(t_3 - 3.0)) + Float64(Float64(x1 * x1) * Float64(Float64(t_3 * 4.0) - 6.0)))) + Float64(t_1 * t_3)) + Float64(x1 * Float64(x1 * x1)))) + Float64(3.0 * Float64(Float64(Float64(t_1 - Float64(2.0 * x2)) - x1) / t_2)))) <= Inf)
		tmp = Float64(x1 + fma(3.0, Float64(Float64(t_1 - 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(Float64(6.0 * (x1 ^ 4.0)) - x1);
	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]}, Block[{t$95$1 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(t$95$1 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$2), $MachinePrecision]}, If[LessEqual[N[(x1 + N[(N[(x1 + N[(N[(N[(t$95$2 * N[(N[(N[(N[(x1 * 2.0), $MachinePrecision] * t$95$3), $MachinePrecision] * N[(t$95$3 - 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * N[(N[(t$95$3 * 4.0), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(3.0 * N[(N[(N[(t$95$1 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(x1 + N[(3.0 * N[(N[(t$95$1 - 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[(N[(6.0 * N[Power[x1, 4.0], $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x1, x1 \cdot 3, \mathsf{fma}\left(2, x2, -x1\right)\right)\\
t_1 := x1 \cdot \left(x1 \cdot 3\right)\\
t_2 := x1 \cdot x1 + 1\\
t_3 := \frac{\left(t_1 + 2 \cdot x2\right) - x1}{t_2}\\
\mathbf{if}\;x1 + \left(\left(x1 + \left(\left(t_2 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t_3\right) \cdot \left(t_3 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(t_3 \cdot 4 - 6\right)\right) + t_1 \cdot t_3\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right) + 3 \cdot \frac{\left(t_1 - 2 \cdot x2\right) - x1}{t_2}\right) \leq \infty:\\
\;\;\;\;x1 + \mathsf{fma}\left(3, \frac{t_1 - \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}:\\
\;\;\;\;6 \cdot {x1}^{4} - x1\\


\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) \]
    2. Step-by-step derivation
      1. +-commutative99.4%

        \[\leadsto x1 + \color{blue}{\left(3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} + \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)\right)} \]
    3. 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 +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(\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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around inf 98.5%

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

      \[\leadsto \color{blue}{-1 \cdot x1 + 6 \cdot {x1}^{4}} \]
    5. Step-by-step derivation
      1. +-commutative98.5%

        \[\leadsto \color{blue}{6 \cdot {x1}^{4} + -1 \cdot x1} \]
      2. neg-mul-198.5%

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

        \[\leadsto \color{blue}{6 \cdot {x1}^{4} - x1} \]
    6. Simplified98.5%

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

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

Alternative 2: 99.4% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;6 \cdot {x1}^{4} - x1\\


\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) \]
    2. Taylor expanded in x1 around 0 98.6%

      \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around 0 98.6%

      \[\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(\color{blue}{3 \cdot {x1}^{2}} + 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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    4. Step-by-step derivation
      1. unpow298.6%

        \[\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(3 \cdot \color{blue}{\left(x1 \cdot x1\right)} + 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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    5. Simplified98.6%

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

      \[\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(3 \cdot \left(x1 \cdot x1\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \color{blue}{9 \cdot {x1}^{2}}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    7. Step-by-step derivation
      1. *-commutative33.3%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\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) + \color{blue}{{x1}^{2} \cdot 9}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      2. unpow233.3%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\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) + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    8. Simplified99.4%

      \[\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(3 \cdot \left(x1 \cdot x1\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \color{blue}{\left(x1 \cdot x1\right) \cdot 9}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \left(-1 \cdot x1 + -2 \cdot x2\right)\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(\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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around inf 98.5%

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

      \[\leadsto \color{blue}{-1 \cdot x1 + 6 \cdot {x1}^{4}} \]
    5. Step-by-step derivation
      1. +-commutative98.5%

        \[\leadsto \color{blue}{6 \cdot {x1}^{4} + -1 \cdot x1} \]
      2. neg-mul-198.5%

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

        \[\leadsto \color{blue}{6 \cdot {x1}^{4} - x1} \]
    6. Simplified98.5%

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

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

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

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

\mathbf{elif}\;x1 \leq -0.7:\\
\;\;\;\;t_4\\

\mathbf{elif}\;x1 \leq 0.33:\\
\;\;\;\;x1 + \left(3 \cdot \frac{\left(t_0 - 2 \cdot x2\right) - x1}{t_2} + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\right)\right)\\

\mathbf{elif}\;x1 \leq 2 \cdot 10^{+153}:\\
\;\;\;\;t_4\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -1.8e108 or 2e153 < 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 x2 around 0 0.1%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{x1 \cdot x1} + 1}, x1\right) \]
      8. fma-udef0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{3 \cdot \left(x1 \cdot x1\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    5. Simplified0.1%

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-185.0%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg85.0%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative85.0%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow285.0%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*85.0%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified85.0%

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

    if -1.8e108 < x1 < -0.69999999999999996 or 0.330000000000000016 < x1 < 2e153

    1. Initial program 97.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 94.6%

      \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around inf 93.3%

      \[\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 \color{blue}{\left(2 \cdot \frac{x2}{{x1}^{2}} - \left(\frac{1}{x1} + 3 \cdot \frac{1}{{x1}^{2}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    4. Step-by-step derivation
      1. unpow293.3%

        \[\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(2 \cdot \frac{x2}{\color{blue}{x1 \cdot x1}} - \left(\frac{1}{x1} + 3 \cdot \frac{1}{{x1}^{2}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      2. associate-*r/93.3%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \color{blue}{\frac{3 \cdot 1}{{x1}^{2}}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      3. metadata-eval93.3%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{\color{blue}{3}}{{x1}^{2}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      4. unpow293.3%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{\color{blue}{x1 \cdot x1}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    5. Simplified93.3%

      \[\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 \color{blue}{\left(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    6. Taylor expanded in x1 around inf 93.1%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\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) + \color{blue}{9 \cdot {x1}^{2}}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    7. Step-by-step derivation
      1. *-commutative93.1%

        \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\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) + \color{blue}{{x1}^{2} \cdot 9}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      2. unpow293.1%

        \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\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) + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    8. Simplified93.1%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\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) + \color{blue}{\left(x1 \cdot x1\right) \cdot 9}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]

    if -0.69999999999999996 < x1 < 0.330000000000000016

    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 99.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. Recombined 3 regimes into one program.
  4. Final simplification94.3%

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

Alternative 4: 93.2% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;x1 \leq -0.72:\\
\;\;\;\;t_4\\

\mathbf{elif}\;x1 \leq 0.36:\\
\;\;\;\;x1 + \left(3 \cdot \frac{\left(t_2 - 2 \cdot x2\right) - x1}{t_0} + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\right)\right)\\

\mathbf{elif}\;x1 \leq 2 \cdot 10^{+153}:\\
\;\;\;\;t_4\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -4.9999999999999998e106 or 2e153 < 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 x2 around 0 0.1%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{x1 \cdot x1} + 1}, x1\right) \]
      8. fma-udef0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{3 \cdot \left(x1 \cdot x1\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    5. Simplified0.1%

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-185.0%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg85.0%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative85.0%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow285.0%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*85.0%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified85.0%

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

    if -4.9999999999999998e106 < x1 < -0.71999999999999997 or 0.35999999999999999 < x1 < 2e153

    1. Initial program 97.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 94.6%

      \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around inf 93.3%

      \[\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 \color{blue}{\left(2 \cdot \frac{x2}{{x1}^{2}} - \left(\frac{1}{x1} + 3 \cdot \frac{1}{{x1}^{2}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    4. Step-by-step derivation
      1. unpow293.3%

        \[\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(2 \cdot \frac{x2}{\color{blue}{x1 \cdot x1}} - \left(\frac{1}{x1} + 3 \cdot \frac{1}{{x1}^{2}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      2. associate-*r/93.3%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \color{blue}{\frac{3 \cdot 1}{{x1}^{2}}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      3. metadata-eval93.3%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{\color{blue}{3}}{{x1}^{2}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      4. unpow293.3%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{\color{blue}{x1 \cdot x1}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    5. Simplified93.3%

      \[\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 \color{blue}{\left(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    6. Taylor expanded in x1 around inf 87.0%

      \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\right)\right) + \color{blue}{6 \cdot {x1}^{2}}\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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    7. Step-by-step derivation
      1. *-commutative66.8%

        \[\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 -3 + \color{blue}{{x1}^{2} \cdot 6}\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 \left(x2 \cdot -2\right)\right) \]
      2. unpow266.8%

        \[\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 -3 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 6\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 \left(x2 \cdot -2\right)\right) \]
    8. Simplified87.0%

      \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\right)\right) + \color{blue}{\left(x1 \cdot x1\right) \cdot 6}\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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]

    if -0.71999999999999997 < x1 < 0.35999999999999999

    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 99.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. Recombined 3 regimes into one program.
  4. Final simplification93.2%

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

Alternative 5: 95.4% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
t_0 := x1 \cdot x1 + 1\\
t_1 := \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{t_0}\\
\mathbf{if}\;x1 \leq -3.6 \cdot 10^{+108} \lor \neg \left(x1 \leq 2 \cdot 10^{+153}\right):\\
\;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -3.6e108 or 2e153 < 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 x2 around 0 0.1%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{x1 \cdot x1} + 1}, x1\right) \]
      8. fma-udef0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{3 \cdot \left(x1 \cdot x1\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    5. Simplified0.1%

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-185.0%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg85.0%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative85.0%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow285.0%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*85.0%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified85.0%

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

    if -3.6e108 < x1 < 2e153

    1. Initial program 98.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 98.0%

      \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around 0 98.1%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\color{blue}{3 \cdot {x1}^{2}} + 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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    4. Step-by-step derivation
      1. unpow298.1%

        \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(3 \cdot \color{blue}{\left(x1 \cdot x1\right)} + 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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    5. Simplified98.1%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\color{blue}{3 \cdot \left(x1 \cdot x1\right)} + 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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    6. Taylor expanded in x1 around inf 98.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(3 \cdot \left(x1 \cdot x1\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \color{blue}{9 \cdot {x1}^{2}}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    7. Step-by-step derivation
      1. *-commutative33.1%

        \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\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) + \color{blue}{{x1}^{2} \cdot 9}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      2. unpow233.1%

        \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\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) + \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    8. Simplified98.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(3 \cdot \left(x1 \cdot x1\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \color{blue}{\left(x1 \cdot x1\right) \cdot 9}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification95.3%

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

Alternative 6: 93.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot x1 + 1\\ t_1 := x1 \cdot \left(x1 \cdot 3\right)\\ t_2 := \frac{\left(t_1 + 2 \cdot x2\right) - x1}{t_0}\\ \mathbf{if}\;x1 \leq -1.28 \cdot 10^{+107} \lor \neg \left(x1 \leq 2 \cdot 10^{+153}\right):\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(3 \cdot \left(x2 \cdot -2 - x1\right) + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(t_1 \cdot t_2 + t_0 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t_2\right) \cdot \left(t_2 - 3\right) + \left(x1 \cdot x1\right) \cdot 6\right)\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (+ (* x1 x1) 1.0))
        (t_1 (* x1 (* x1 3.0)))
        (t_2 (/ (- (+ t_1 (* 2.0 x2)) x1) t_0)))
   (if (or (<= x1 -1.28e+107) (not (<= x1 2e+153)))
     (- (* x1 (* x1 9.0)) x1)
     (+
      x1
      (+
       (* 3.0 (- (* x2 -2.0) x1))
       (+
        x1
        (+
         (* x1 (* x1 x1))
         (+
          (* t_1 t_2)
          (*
           t_0
           (+ (* (* (* x1 2.0) t_2) (- t_2 3.0)) (* (* x1 x1) 6.0)))))))))))
double code(double x1, double x2) {
	double t_0 = (x1 * x1) + 1.0;
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0;
	double tmp;
	if ((x1 <= -1.28e+107) || !(x1 <= 2e+153)) {
		tmp = (x1 * (x1 * 9.0)) - x1;
	} else {
		tmp = x1 + ((3.0 * ((x2 * -2.0) - x1)) + (x1 + ((x1 * (x1 * x1)) + ((t_1 * t_2) + (t_0 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * 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) :: tmp
    t_0 = (x1 * x1) + 1.0d0
    t_1 = x1 * (x1 * 3.0d0)
    t_2 = ((t_1 + (2.0d0 * x2)) - x1) / t_0
    if ((x1 <= (-1.28d+107)) .or. (.not. (x1 <= 2d+153))) then
        tmp = (x1 * (x1 * 9.0d0)) - x1
    else
        tmp = x1 + ((3.0d0 * ((x2 * (-2.0d0)) - x1)) + (x1 + ((x1 * (x1 * x1)) + ((t_1 * t_2) + (t_0 * ((((x1 * 2.0d0) * t_2) * (t_2 - 3.0d0)) + ((x1 * x1) * 6.0d0)))))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = (x1 * x1) + 1.0;
	double t_1 = x1 * (x1 * 3.0);
	double t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0;
	double tmp;
	if ((x1 <= -1.28e+107) || !(x1 <= 2e+153)) {
		tmp = (x1 * (x1 * 9.0)) - x1;
	} else {
		tmp = x1 + ((3.0 * ((x2 * -2.0) - x1)) + (x1 + ((x1 * (x1 * x1)) + ((t_1 * t_2) + (t_0 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * 6.0)))))));
	}
	return tmp;
}
def code(x1, x2):
	t_0 = (x1 * x1) + 1.0
	t_1 = x1 * (x1 * 3.0)
	t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0
	tmp = 0
	if (x1 <= -1.28e+107) or not (x1 <= 2e+153):
		tmp = (x1 * (x1 * 9.0)) - x1
	else:
		tmp = x1 + ((3.0 * ((x2 * -2.0) - x1)) + (x1 + ((x1 * (x1 * x1)) + ((t_1 * t_2) + (t_0 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * 6.0)))))))
	return tmp
function code(x1, x2)
	t_0 = Float64(Float64(x1 * x1) + 1.0)
	t_1 = Float64(x1 * Float64(x1 * 3.0))
	t_2 = Float64(Float64(Float64(t_1 + Float64(2.0 * x2)) - x1) / t_0)
	tmp = 0.0
	if ((x1 <= -1.28e+107) || !(x1 <= 2e+153))
		tmp = Float64(Float64(x1 * Float64(x1 * 9.0)) - x1);
	else
		tmp = Float64(x1 + Float64(Float64(3.0 * Float64(Float64(x2 * -2.0) - x1)) + Float64(x1 + Float64(Float64(x1 * Float64(x1 * x1)) + Float64(Float64(t_1 * t_2) + Float64(t_0 * Float64(Float64(Float64(Float64(x1 * 2.0) * t_2) * Float64(t_2 - 3.0)) + Float64(Float64(x1 * x1) * 6.0))))))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = (x1 * x1) + 1.0;
	t_1 = x1 * (x1 * 3.0);
	t_2 = ((t_1 + (2.0 * x2)) - x1) / t_0;
	tmp = 0.0;
	if ((x1 <= -1.28e+107) || ~((x1 <= 2e+153)))
		tmp = (x1 * (x1 * 9.0)) - x1;
	else
		tmp = x1 + ((3.0 * ((x2 * -2.0) - x1)) + (x1 + ((x1 * (x1 * x1)) + ((t_1 * t_2) + (t_0 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * 6.0)))))));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$1 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[Or[LessEqual[x1, -1.28e+107], N[Not[LessEqual[x1, 2e+153]], $MachinePrecision]], N[(N[(x1 * N[(x1 * 9.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision], N[(x1 + N[(N[(3.0 * N[(N[(x2 * -2.0), $MachinePrecision] - x1), $MachinePrecision]), $MachinePrecision] + N[(x1 + N[(N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 * t$95$2), $MachinePrecision] + N[(t$95$0 * N[(N[(N[(N[(x1 * 2.0), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(t$95$2 - 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 \cdot x1 + 1\\
t_1 := x1 \cdot \left(x1 \cdot 3\right)\\
t_2 := \frac{\left(t_1 + 2 \cdot x2\right) - x1}{t_0}\\
\mathbf{if}\;x1 \leq -1.28 \cdot 10^{+107} \lor \neg \left(x1 \leq 2 \cdot 10^{+153}\right):\\
\;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -1.2799999999999999e107 or 2e153 < 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 x2 around 0 0.1%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{x1 \cdot x1} + 1}, x1\right) \]
      8. fma-udef0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{3 \cdot \left(x1 \cdot x1\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    5. Simplified0.1%

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-185.0%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg85.0%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative85.0%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow285.0%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*85.0%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified85.0%

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

    if -1.2799999999999999e107 < x1 < 2e153

    1. Initial program 98.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 98.0%

      \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around inf 96.4%

      \[\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) + \color{blue}{6 \cdot {x1}^{2}}\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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    4. Step-by-step derivation
      1. *-commutative57.7%

        \[\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 -3 + \color{blue}{{x1}^{2} \cdot 6}\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 \left(x2 \cdot -2\right)\right) \]
      2. unpow257.7%

        \[\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 -3 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 6\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 \left(x2 \cdot -2\right)\right) \]
    5. Simplified96.4%

      \[\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) + \color{blue}{\left(x1 \cdot x1\right) \cdot 6}\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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification93.4%

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

Alternative 7: 91.8% accurate, 1.4× speedup?

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

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

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

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

\mathbf{elif}\;x1 \leq 2 \cdot 10^{+153}:\\
\;\;\;\;t_5\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -7.1000000000000003e108 or 2e153 < 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 x2 around 0 0.1%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{x1 \cdot x1} + 1}, x1\right) \]
      8. fma-udef0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{3 \cdot \left(x1 \cdot x1\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    5. Simplified0.1%

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-185.0%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg85.0%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative85.0%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow285.0%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*85.0%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified85.0%

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

    if -7.1000000000000003e108 < x1 < -0.900000000000000022 or 1.45e-18 < x1 < 2e153

    1. Initial program 97.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 94.7%

      \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around inf 91.5%

      \[\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 \color{blue}{\left(2 \cdot \frac{x2}{{x1}^{2}} - \left(\frac{1}{x1} + 3 \cdot \frac{1}{{x1}^{2}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    4. Step-by-step derivation
      1. unpow291.5%

        \[\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(2 \cdot \frac{x2}{\color{blue}{x1 \cdot x1}} - \left(\frac{1}{x1} + 3 \cdot \frac{1}{{x1}^{2}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      2. associate-*r/91.5%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \color{blue}{\frac{3 \cdot 1}{{x1}^{2}}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      3. metadata-eval91.5%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{\color{blue}{3}}{{x1}^{2}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      4. unpow291.5%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{\color{blue}{x1 \cdot x1}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    5. Simplified91.5%

      \[\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 \color{blue}{\left(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    6. Taylor expanded in x1 around 0 83.6%

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

    if -0.900000000000000022 < x1 < 1.45e-18

    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 99.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. Recombined 3 regimes into one program.
  4. Final simplification92.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -7.1 \cdot 10^{+108}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \mathbf{elif}\;x1 \leq -0.9:\\ \;\;\;\;x1 + \left(3 \cdot \left(x2 \cdot -2 - x1\right) + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(\left(x1 \cdot \left(x1 \cdot 3\right)\right) \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} + \left(x1 \cdot x1 + 1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} \cdot 4 - 6\right) + 4 \cdot \frac{x2 \cdot \left(2 \cdot x2 - 3\right)}{x1}\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1.45 \cdot 10^{-18}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 2 \cdot 10^{+153}:\\ \;\;\;\;x1 + \left(3 \cdot \left(x2 \cdot -2 - x1\right) + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(\left(x1 \cdot \left(x1 \cdot 3\right)\right) \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} + \left(x1 \cdot x1 + 1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} \cdot 4 - 6\right) + 4 \cdot \frac{x2 \cdot \left(2 \cdot x2 - 3\right)}{x1}\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \end{array} \]

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

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

\mathbf{elif}\;x1 \leq -2.05 \cdot 10^{+55}:\\
\;\;\;\;t_4\\

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

\mathbf{elif}\;x1 \leq 2 \cdot 10^{+153}:\\
\;\;\;\;t_4\\

\mathbf{else}:\\
\;\;\;\;t_1\\


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

    1. Initial program 1.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 1.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 x2 around 0 0.1%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{x1 \cdot x1} + 1}, x1\right) \]
      8. fma-udef0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{3 \cdot \left(x1 \cdot x1\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    5. Simplified0.1%

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-183.7%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg83.7%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative83.7%

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

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

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

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

    if -5.60000000000000037e102 < x1 < -2.04999999999999991e55 or 1.8999999999999999e51 < x1 < 2e153

    1. Initial program 96.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 x2 around 0 92.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 \color{blue}{\left(3 \cdot \frac{{x1}^{2}}{1 + {x1}^{2}} - \left(3 + \frac{x1}{1 + {x1}^{2}}\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 \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. Step-by-step derivation
      1. +-commutative92.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(3 \cdot \frac{{x1}^{2}}{1 + {x1}^{2}} - \color{blue}{\left(\frac{x1}{1 + {x1}^{2}} + 3\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 \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. associate--r+92.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 \color{blue}{\left(\left(3 \cdot \frac{{x1}^{2}}{1 + {x1}^{2}} - \frac{x1}{1 + {x1}^{2}}\right) - 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. associate-*r/92.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(\left(\color{blue}{\frac{3 \cdot {x1}^{2}}{1 + {x1}^{2}}} - \frac{x1}{1 + {x1}^{2}}\right) - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
      4. div-sub92.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(\color{blue}{\frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}} - 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) \]
      5. *-commutative92.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{\color{blue}{{x1}^{2} \cdot 3} - x1}{1 + {x1}^{2}} - 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) \]
      6. unpow292.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{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}} - 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) \]
      7. associate-*r*92.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{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}} - 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) \]
      8. fma-neg92.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{\color{blue}{\mathsf{fma}\left(x1, x1 \cdot 3, -x1\right)}}{1 + {x1}^{2}} - 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) \]
      9. +-commutative92.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{\mathsf{fma}\left(x1, x1 \cdot 3, -x1\right)}{\color{blue}{{x1}^{2} + 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) \]
      10. unpow292.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{\mathsf{fma}\left(x1, x1 \cdot 3, -x1\right)}{\color{blue}{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) \]
      11. fma-udef92.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{\mathsf{fma}\left(x1, x1 \cdot 3, -x1\right)}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    4. Simplified92.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 \color{blue}{\left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, -x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} - 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) \]
    5. Taylor expanded in x1 around 0 92.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 \color{blue}{-3} + \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 92.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 -3 + \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 \color{blue}{\left(-2 \cdot x2\right)}\right) \]
    7. Step-by-step derivation
      1. *-commutative23.3%

        \[\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) \]
    8. Simplified92.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 -3 + \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 \color{blue}{\left(x2 \cdot -2\right)}\right) \]
    9. Taylor expanded in x1 around inf 89.3%

      \[\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 -3 + \color{blue}{6 \cdot {x1}^{2}}\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 \left(x2 \cdot -2\right)\right) \]
    10. Step-by-step derivation
      1. *-commutative89.3%

        \[\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 -3 + \color{blue}{{x1}^{2} \cdot 6}\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 \left(x2 \cdot -2\right)\right) \]
      2. unpow289.3%

        \[\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 -3 + \color{blue}{\left(x1 \cdot x1\right)} \cdot 6\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 \left(x2 \cdot -2\right)\right) \]
    11. Simplified89.3%

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

    if -2.04999999999999991e55 < x1 < 1.8999999999999999e51

    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 92.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 92.9%

      \[\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) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.1%

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

Alternative 9: 90.8% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;x1 \leq -1.05 \cdot 10^{+32}:\\
\;\;\;\;t_5\\

\mathbf{elif}\;x1 \leq 6000000:\\
\;\;\;\;x1 + \left(t_3 + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\right)\right)\\

\mathbf{elif}\;x1 \leq 2 \cdot 10^{+153}:\\
\;\;\;\;t_5\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -3.49999999999999981e106 or 2e153 < 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 x2 around 0 0.1%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.1%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{x1 \cdot x1} + 1}, x1\right) \]
      8. fma-udef0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.1%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{3 \cdot \left(x1 \cdot x1\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    5. Simplified0.1%

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-185.0%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg85.0%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative85.0%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow285.0%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*85.0%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified85.0%

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

    if -3.49999999999999981e106 < x1 < -1.05e32 or 6e6 < x1 < 2e153

    1. Initial program 97.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 97.4%

      \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around inf 97.4%

      \[\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 \color{blue}{\left(2 \cdot \frac{x2}{{x1}^{2}} - \left(\frac{1}{x1} + 3 \cdot \frac{1}{{x1}^{2}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    4. Step-by-step derivation
      1. unpow297.4%

        \[\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(2 \cdot \frac{x2}{\color{blue}{x1 \cdot x1}} - \left(\frac{1}{x1} + 3 \cdot \frac{1}{{x1}^{2}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      2. associate-*r/97.4%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \color{blue}{\frac{3 \cdot 1}{{x1}^{2}}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      3. metadata-eval97.4%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{\color{blue}{3}}{{x1}^{2}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
      4. unpow297.4%

        \[\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(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{\color{blue}{x1 \cdot x1}}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    5. Simplified97.4%

      \[\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 \color{blue}{\left(2 \cdot \frac{x2}{x1 \cdot x1} - \left(\frac{1}{x1} + \frac{3}{x1 \cdot x1}\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 \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]
    6. Taylor expanded in x1 around inf 85.6%

      \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{-6} + \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 \left(-1 \cdot x1 + -2 \cdot x2\right)\right) \]

    if -1.05e32 < x1 < 6e6

    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 96.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) \]
    3. Taylor expanded in x1 around 0 96.9%

      \[\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) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification91.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -3.5 \cdot 10^{+106}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \mathbf{elif}\;x1 \leq -1.05 \cdot 10^{+32}:\\ \;\;\;\;x1 + \left(3 \cdot \left(x2 \cdot -2 - x1\right) + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(\left(x1 \cdot \left(x1 \cdot 3\right)\right) \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} + \left(x1 \cdot x1 + 1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} \cdot 4 - 6\right) + -6\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 6000000:\\ \;\;\;\;x1 + \left(3 \cdot \left(x2 \cdot -2 - x1\right) + \left(x1 + 4 \cdot \left(x2 \cdot \left(x1 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 2 \cdot 10^{+153}:\\ \;\;\;\;x1 + \left(3 \cdot \left(x2 \cdot -2 - x1\right) + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(\left(x1 \cdot \left(x1 \cdot 3\right)\right) \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} + \left(x1 \cdot x1 + 1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(\frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} \cdot 4 - 6\right) + -6\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \end{array} \]

Alternative 10: 79.8% accurate, 3.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -3 \cdot 10^{+107} \lor \neg \left(x1 \leq 2.3 \cdot 10^{+148}\right):\\
\;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -3.00000000000000023e107 or 2.3000000000000001e148 < x1

    1. Initial program 2.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 0.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 x2 around 0 0.2%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.2%

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

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-182.8%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg82.8%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative82.8%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow282.8%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*82.8%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified82.8%

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

    if -3.00000000000000023e107 < x1 < 2.3000000000000001e148

    1. Initial program 98.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 83.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. Recombined 2 regimes into one program.
  4. Final simplification83.0%

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

Alternative 11: 74.3% accurate, 4.7× speedup?

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

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

\mathbf{elif}\;x1 \leq -1.86 \cdot 10^{-202}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x1 \leq -5 \cdot 10^{-309}:\\
\;\;\;\;x2 \cdot -6 - x1\\

\mathbf{elif}\;x1 \leq 2.3 \cdot 10^{+148}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -3.20000000000000029e107 or 2.3000000000000001e148 < x1

    1. Initial program 2.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 0.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 x2 around 0 0.2%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.2%

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

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-182.8%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg82.8%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative82.8%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow282.8%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*82.8%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified82.8%

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

    if -3.20000000000000029e107 < x1 < -1.85999999999999998e-202 or -4.9999999999999995e-309 < x1 < 2.3000000000000001e148

    1. Initial program 98.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 80.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 75.6%

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

    if -1.85999999999999998e-202 < x1 < -4.9999999999999995e-309

    1. Initial program 99.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 99.7%

      \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around inf 96.2%

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

      \[\leadsto \color{blue}{-1 \cdot x1 + -6 \cdot x2} \]
    5. Step-by-step derivation
      1. +-commutative96.3%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-6, x2, -1 \cdot x1\right)} \]
      3. neg-mul-196.2%

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{-x1}\right) \]
      4. fma-neg96.3%

        \[\leadsto \color{blue}{-6 \cdot x2 - x1} \]
    6. Simplified96.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -3.2 \cdot 10^{+107}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \mathbf{elif}\;x1 \leq -1.86 \cdot 10^{-202}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq -5 \cdot 10^{-309}:\\ \;\;\;\;x2 \cdot -6 - x1\\ \mathbf{elif}\;x1 \leq 2.3 \cdot 10^{+148}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + x2 \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \end{array} \]

Alternative 12: 74.9% accurate, 4.7× speedup?

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

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

\mathbf{elif}\;x1 \leq -4.2 \cdot 10^{-208}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;x1 \leq 2.3 \cdot 10^{+148}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -2.6000000000000001e107 or 2.3000000000000001e148 < x1

    1. Initial program 2.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 0.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 x2 around 0 0.2%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.2%

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

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-182.8%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg82.8%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative82.8%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow282.8%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*82.8%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified82.8%

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

    if -2.6000000000000001e107 < x1 < -4.20000000000000024e-208 or 3.00000000000000009e-159 < x1 < 2.3000000000000001e148

    1. Initial program 98.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 75.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 72.9%

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

    if -4.20000000000000024e-208 < x1 < 3.00000000000000009e-159

    1. Initial program 99.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 99.6%

      \[\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 92.8%

      \[\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. *-commutative92.8%

        \[\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. Simplified92.8%

      \[\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) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -2.6 \cdot 10^{+107}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \mathbf{elif}\;x1 \leq -4.2 \cdot 10^{-208}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq 3 \cdot 10^{-159}:\\ \;\;\;\;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{elif}\;x1 \leq 2.3 \cdot 10^{+148}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right) - 2\right) + x2 \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \end{array} \]

Alternative 13: 79.5% accurate, 4.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -3.9 \cdot 10^{+108} \lor \neg \left(x1 \leq 2.3 \cdot 10^{+148}\right):\\
\;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -3.89999999999999985e108 or 2.3000000000000001e148 < x1

    1. Initial program 2.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 0.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 x2 around 0 0.2%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.2%

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

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-182.8%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg82.8%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative82.8%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow282.8%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*82.8%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified82.8%

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

    if -3.89999999999999985e108 < x1 < 2.3000000000000001e148

    1. Initial program 98.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 83.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 83.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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.0%

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

Alternative 14: 66.5% accurate, 5.5× speedup?

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

\\
\begin{array}{l}
t_0 := x1 \cdot \left(x1 \cdot 9\right) - x1\\
\mathbf{if}\;x1 \leq -1.06 \cdot 10^{+108}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x1 \leq -1.85 \cdot 10^{-37}:\\
\;\;\;\;x1 + \left(x2 \cdot x2\right) \cdot \left(x1 \cdot 8\right)\\

\mathbf{elif}\;x1 \leq 0.7:\\
\;\;\;\;x2 \cdot -6 - x1\\

\mathbf{elif}\;x1 \leq 2.3 \cdot 10^{+148}:\\
\;\;\;\;x1 + x1 \cdot \left(1 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x1 < -1.06e108 or 2.3000000000000001e148 < x1

    1. Initial program 2.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 0.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 x2 around 0 0.2%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.2%

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

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-182.8%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg82.8%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative82.8%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow282.8%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*82.8%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified82.8%

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

    if -1.06e108 < x1 < -1.85e-37

    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 60.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 x2 around inf 49.4%

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

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

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

        \[\leadsto x1 + \color{blue}{\left(x2 \cdot x2\right)} \cdot \left(x1 \cdot 8\right) \]
    5. Simplified49.4%

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

    if -1.85e-37 < x1 < 0.69999999999999996

    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 98.7%

      \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around inf 81.4%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-6, x2, -1 \cdot x1\right)} \]
      3. neg-mul-182.1%

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{-x1}\right) \]
      4. fma-neg82.0%

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

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

    if 0.69999999999999996 < x1 < 2.3000000000000001e148

    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 32.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 inf 32.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.06 \cdot 10^{+108}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \mathbf{elif}\;x1 \leq -1.85 \cdot 10^{-37}:\\ \;\;\;\;x1 + \left(x2 \cdot x2\right) \cdot \left(x1 \cdot 8\right)\\ \mathbf{elif}\;x1 \leq 0.7:\\ \;\;\;\;x2 \cdot -6 - x1\\ \mathbf{elif}\;x1 \leq 2.3 \cdot 10^{+148}:\\ \;\;\;\;x1 + x1 \cdot \left(1 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \end{array} \]

Alternative 15: 66.6% accurate, 5.5× speedup?

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

\\
\begin{array}{l}
t_0 := x1 \cdot \left(x1 \cdot 9\right) - x1\\
\mathbf{if}\;x1 \leq -4 \cdot 10^{+107}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x1 \leq -2.1 \cdot 10^{-37}:\\
\;\;\;\;\left(x1 + \left(9 + \left(x2 \cdot x2\right) \cdot \left(x1 \cdot 8\right)\right)\right) - \frac{3}{x1}\\

\mathbf{elif}\;x1 \leq 0.7:\\
\;\;\;\;x2 \cdot -6 - x1\\

\mathbf{elif}\;x1 \leq 2.3 \cdot 10^{+148}:\\
\;\;\;\;x1 + x1 \cdot \left(1 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x1 < -3.9999999999999999e107 or 2.3000000000000001e148 < x1

    1. Initial program 2.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 0.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 x2 around 0 0.2%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.2%

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

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-182.8%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg82.8%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative82.8%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow282.8%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*82.8%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified82.8%

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

    if -3.9999999999999999e107 < x1 < -2.1000000000000001e-37

    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 60.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 inf 50.4%

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

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

        \[\leadsto x1 + \left(\left(9 + \color{blue}{\left({x2}^{2} \cdot x1\right) \cdot 8}\right) - 3 \cdot \frac{1}{x1}\right) \]
      2. associate-*l*50.4%

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

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

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

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

        \[\leadsto \left(x1 + \color{blue}{\left(\left(x2 \cdot x2\right) \cdot \left(x1 \cdot 8\right) + 9\right)}\right) - 3 \cdot \frac{1}{x1} \]
      3. un-div-inv50.4%

        \[\leadsto \left(x1 + \left(\left(x2 \cdot x2\right) \cdot \left(x1 \cdot 8\right) + 9\right)\right) - \color{blue}{\frac{3}{x1}} \]
    8. Applied egg-rr50.4%

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

    if -2.1000000000000001e-37 < x1 < 0.69999999999999996

    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 98.7%

      \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around inf 81.4%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-6, x2, -1 \cdot x1\right)} \]
      3. neg-mul-182.1%

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{-x1}\right) \]
      4. fma-neg82.0%

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

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

    if 0.69999999999999996 < x1 < 2.3000000000000001e148

    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 32.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 inf 32.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -4 \cdot 10^{+107}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \mathbf{elif}\;x1 \leq -2.1 \cdot 10^{-37}:\\ \;\;\;\;\left(x1 + \left(9 + \left(x2 \cdot x2\right) \cdot \left(x1 \cdot 8\right)\right)\right) - \frac{3}{x1}\\ \mathbf{elif}\;x1 \leq 0.7:\\ \;\;\;\;x2 \cdot -6 - x1\\ \mathbf{elif}\;x1 \leq 2.3 \cdot 10^{+148}:\\ \;\;\;\;x1 + x1 \cdot \left(1 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \end{array} \]

Alternative 16: 66.7% accurate, 5.5× speedup?

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

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

\mathbf{elif}\;x1 \leq -1.85 \cdot 10^{-37}:\\
\;\;\;\;x1 + \left(9 + t_1\right)\\

\mathbf{elif}\;x1 \leq 0.7:\\
\;\;\;\;x2 \cdot -6 - x1\\

\mathbf{elif}\;x1 \leq 2.3 \cdot 10^{+148}:\\
\;\;\;\;x1 + t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x1 < -8.40000000000000039e108 or 2.3000000000000001e148 < x1

    1. Initial program 2.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 0.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 x2 around 0 0.2%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.2%

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

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-182.8%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg82.8%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative82.8%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow282.8%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*82.8%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified82.8%

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

    if -8.40000000000000039e108 < x1 < -1.85e-37

    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 60.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 inf 50.5%

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

    if -1.85e-37 < x1 < 0.69999999999999996

    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 98.7%

      \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around inf 81.4%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-6, x2, -1 \cdot x1\right)} \]
      3. neg-mul-182.1%

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{-x1}\right) \]
      4. fma-neg82.0%

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

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

    if 0.69999999999999996 < x1 < 2.3000000000000001e148

    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 32.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 inf 32.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -8.4 \cdot 10^{+108}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \mathbf{elif}\;x1 \leq -1.85 \cdot 10^{-37}:\\ \;\;\;\;x1 + \left(9 + x1 \cdot \left(1 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 0.7:\\ \;\;\;\;x2 \cdot -6 - x1\\ \mathbf{elif}\;x1 \leq 2.3 \cdot 10^{+148}:\\ \;\;\;\;x1 + x1 \cdot \left(1 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \end{array} \]

Alternative 17: 66.5% accurate, 7.4× speedup?

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

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

\mathbf{elif}\;x1 \leq -2.6 \cdot 10^{-37}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x1 \leq 0.7:\\
\;\;\;\;x2 \cdot -6 - x1\\

\mathbf{elif}\;x1 \leq 2.3 \cdot 10^{+148}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -7.1000000000000003e108 or 2.3000000000000001e148 < x1

    1. Initial program 2.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 0.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 x2 around 0 0.2%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity0.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow20.2%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative0.2%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*0.2%

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

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-182.8%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg82.8%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative82.8%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow282.8%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*82.8%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified82.8%

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

    if -7.1000000000000003e108 < x1 < -2.5999999999999998e-37 or 0.69999999999999996 < x1 < 2.3000000000000001e148

    1. Initial program 97.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 47.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) \]
    3. Taylor expanded in x2 around inf 41.7%

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

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

        \[\leadsto x1 + \color{blue}{{x2}^{2} \cdot \left(x1 \cdot 8\right)} \]
      3. unpow241.7%

        \[\leadsto x1 + \color{blue}{\left(x2 \cdot x2\right)} \cdot \left(x1 \cdot 8\right) \]
    5. Simplified41.7%

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

    if -2.5999999999999998e-37 < x1 < 0.69999999999999996

    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 98.7%

      \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around inf 81.4%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-6, x2, -1 \cdot x1\right)} \]
      3. neg-mul-182.1%

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{-x1}\right) \]
      4. fma-neg82.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -7.1 \cdot 10^{+108}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \mathbf{elif}\;x1 \leq -2.6 \cdot 10^{-37}:\\ \;\;\;\;x1 + \left(x2 \cdot x2\right) \cdot \left(x1 \cdot 8\right)\\ \mathbf{elif}\;x1 \leq 0.7:\\ \;\;\;\;x2 \cdot -6 - x1\\ \mathbf{elif}\;x1 \leq 2.3 \cdot 10^{+148}:\\ \;\;\;\;x1 + \left(x2 \cdot x2\right) \cdot \left(x1 \cdot 8\right)\\ \mathbf{else}:\\ \;\;\;\;x1 \cdot \left(x1 \cdot 9\right) - x1\\ \end{array} \]

Alternative 18: 62.5% accurate, 11.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -2.4e-31 or 3.39999999999999991 < x1

    1. Initial program 44.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 19.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) \]
    3. Taylor expanded in x2 around 0 3.9%

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

        \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(3, \frac{3 \cdot {x1}^{2} - x1}{1 + {x1}^{2}}, x1\right)} \]
      2. *-commutative3.9%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{{x1}^{2} \cdot 3} - x1}{1 + {x1}^{2}}, x1\right) \]
      3. unpow23.9%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*3.9%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity3.9%

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{{x1}^{2} + 1}}, x1\right) \]
      7. unpow23.9%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{x1 \cdot x1} + 1}, x1\right) \]
      8. fma-udef3.9%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity3.9%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative3.9%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative3.9%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*3.9%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{3 \cdot \left(x1 \cdot x1\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    5. Simplified3.9%

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

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

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} + -1 \cdot x1} \]
      2. neg-mul-151.2%

        \[\leadsto 9 \cdot {x1}^{2} + \color{blue}{\left(-x1\right)} \]
      3. unsub-neg51.2%

        \[\leadsto \color{blue}{9 \cdot {x1}^{2} - x1} \]
      4. *-commutative51.2%

        \[\leadsto \color{blue}{{x1}^{2} \cdot 9} - x1 \]
      5. unpow251.2%

        \[\leadsto \color{blue}{\left(x1 \cdot x1\right)} \cdot 9 - x1 \]
      6. associate-*l*51.2%

        \[\leadsto \color{blue}{x1 \cdot \left(x1 \cdot 9\right)} - x1 \]
    8. Simplified51.2%

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

    if -2.4e-31 < x1 < 3.39999999999999991

    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 98.7%

      \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
    3. Taylor expanded in x1 around inf 79.3%

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

      \[\leadsto \color{blue}{-1 \cdot x1 + -6 \cdot x2} \]
    5. Step-by-step derivation
      1. +-commutative79.8%

        \[\leadsto \color{blue}{-6 \cdot x2 + -1 \cdot x1} \]
      2. fma-def79.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-6, x2, -1 \cdot x1\right)} \]
      3. neg-mul-179.9%

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{-x1}\right) \]
      4. fma-neg79.8%

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

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

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

Alternative 19: 31.2% accurate, 13.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x2 \leq -1.1 \cdot 10^{-97} \lor \neg \left(x2 \leq 1.65 \cdot 10^{-195}\right):\\
\;\;\;\;x1 + x2 \cdot -6\\

\mathbf{else}:\\
\;\;\;\;x1 + x1 \cdot -2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x2 < -1.0999999999999999e-97 or 1.65e-195 < x2

    1. Initial program 72.6%

      \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
    2. Taylor expanded in x1 around 0 62.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 36.8%

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

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

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

    if -1.0999999999999999e-97 < x2 < 1.65e-195

    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 56.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 x2 around 0 41.9%

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

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

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
      4. associate-*r*42.6%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
      5. +-rgt-identity42.6%

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

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

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

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
      9. +-rgt-identity42.6%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      10. *-commutative42.6%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      11. *-commutative42.6%

        \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
      12. associate-*r*42.6%

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

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

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

        \[\leadsto x1 + \color{blue}{x1 \cdot -2} \]
    8. Simplified43.4%

      \[\leadsto x1 + \color{blue}{x1 \cdot -2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification38.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x2 \leq -1.1 \cdot 10^{-97} \lor \neg \left(x2 \leq 1.65 \cdot 10^{-195}\right):\\ \;\;\;\;x1 + x2 \cdot -6\\ \mathbf{else}:\\ \;\;\;\;x1 + x1 \cdot -2\\ \end{array} \]

Alternative 20: 14.0% accurate, 25.4× speedup?

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

\\
x1 + x1 \cdot -2
\end{array}
Derivation
  1. Initial program 73.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 60.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 x2 around 0 14.3%

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

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

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

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
    4. associate-*r*14.6%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
    5. +-rgt-identity14.6%

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

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

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

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
    9. +-rgt-identity14.6%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    10. *-commutative14.6%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    11. *-commutative14.6%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    12. associate-*r*14.6%

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

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

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

      \[\leadsto x1 + \color{blue}{x1 \cdot -2} \]
  8. Simplified15.1%

    \[\leadsto x1 + \color{blue}{x1 \cdot -2} \]
  9. Final simplification15.1%

    \[\leadsto x1 + x1 \cdot -2 \]

Alternative 21: 38.2% accurate, 25.4× speedup?

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

\\
x2 \cdot -6 - x1
\end{array}
Derivation
  1. Initial program 73.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 72.4%

    \[\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 \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 \color{blue}{\left(-1 \cdot x1 + -2 \cdot x2\right)}\right) \]
  3. Taylor expanded in x1 around inf 81.1%

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(-6, x2, -1 \cdot x1\right)} \]
    3. neg-mul-144.2%

      \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{-x1}\right) \]
    4. fma-neg44.2%

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

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

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

Alternative 22: 3.3% accurate, 42.3× speedup?

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

\\
x1 \cdot 2
\end{array}
Derivation
  1. Initial program 73.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 60.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 x2 around 0 14.3%

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

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

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

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot x1\right)} \cdot 3 - x1}{1 + {x1}^{2}}, x1\right) \]
    4. associate-*r*14.6%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{1 + {x1}^{2}}, x1\right) \]
    5. +-rgt-identity14.6%

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

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

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

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\left(x1 \cdot \left(x1 \cdot 3\right) + 0\right) - x1}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}, x1\right) \]
    9. +-rgt-identity14.6%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{x1 \cdot \left(x1 \cdot 3\right)} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    10. *-commutative14.6%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(x1 \cdot 3\right) \cdot x1} - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    11. *-commutative14.6%

      \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\color{blue}{\left(3 \cdot x1\right)} \cdot x1 - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, x1\right) \]
    12. associate-*r*14.6%

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

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

    \[\leadsto \color{blue}{2 \cdot x1} \]
  7. Step-by-step derivation
    1. *-commutative3.4%

      \[\leadsto \color{blue}{x1 \cdot 2} \]
  8. Simplified3.4%

    \[\leadsto \color{blue}{x1 \cdot 2} \]
  9. Final simplification3.4%

    \[\leadsto x1 \cdot 2 \]

Alternative 23: 3.2% 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 73.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 60.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 31.0%

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

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

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

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

    \[\leadsto x1 \]

Reproduce

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