Rosa's FloatVsDoubleBenchmark

Percentage Accurate: 69.7% → 98.9%
Time: 37.6s
Alternatives: 23
Speedup: 1.6×

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: 69.7% accurate, 1.0× speedup?

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

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

Alternative 1: 98.9% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(x1, x1 \cdot 3, x2 \cdot 2 - x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}\\
\mathbf{if}\;x1 \leq -3.1 \cdot 10^{+107}:\\
\;\;\;\;x1 + \left(\left(x1 + \left(6 \cdot {x1}^{4} + -3 \cdot {x1}^{3}\right)\right) + 3 \cdot \left(x2 \cdot -2\right)\right)\\

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

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


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

    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 inf 19.6%

      \[\leadsto x1 + \left(\left(\color{blue}{\left(-3 \cdot {x1}^{3} + 6 \cdot {x1}^{4}\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 100.0%

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

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

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

    if -3.10000000000000026e107 < x1 < 2.00000000000000003e151

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

      \[\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)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2 - x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, 4, -6\right), \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2 - x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} \cdot \left(\left(x1 \cdot 2\right) \cdot \left(\frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2 - x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)} + -3\right)\right)\right), \mathsf{fma}\left(x1 \cdot \left(x1 \cdot 3\right), \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2 - x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)} \]
    3. Taylor expanded in x1 around inf 98.7%

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

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

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

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

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

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

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

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

    if 2.00000000000000003e151 < 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(x1 \cdot \left(x2 \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.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{\left(-2 \cdot x1 + 9 \cdot {x1}^{2}\right)} \]
    7. Step-by-step derivation
      1. fma-def100.0%

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

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

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

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

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

Alternative 2: 98.8% accurate, 0.4× speedup?

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

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

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

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


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

    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 inf 19.6%

      \[\leadsto x1 + \left(\left(\color{blue}{\left(-3 \cdot {x1}^{3} + 6 \cdot {x1}^{4}\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 100.0%

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

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

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

    if -3.10000000000000026e107 < x1 < 2.00000000000000003e151

    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. Step-by-step derivation
      1. fma-def98.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}{\color{blue}{\mathsf{fma}\left(x1, x1, 1\right)}}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \]
      2. div-inv98.7%

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

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

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

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

    if 2.00000000000000003e151 < 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(x1 \cdot \left(x2 \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.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{\left(-2 \cdot x1 + 9 \cdot {x1}^{2}\right)} \]
    7. Step-by-step derivation
      1. fma-def100.0%

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

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

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

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

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

Alternative 3: 95.8% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 99.2%

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

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

    1. Initial program 0.0%

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x1 + \mathsf{fma}\left(-2, x1, \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right) \]
    8. Simplified87.7%

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

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

Alternative 4: 98.8% accurate, 0.6× speedup?

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

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

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

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


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

    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 inf 19.6%

      \[\leadsto x1 + \left(\left(\color{blue}{\left(-3 \cdot {x1}^{3} + 6 \cdot {x1}^{4}\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 100.0%

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

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

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

    if -3.10000000000000026e107 < x1 < 2.00000000000000003e151

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

    if 2.00000000000000003e151 < 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(x1 \cdot \left(x2 \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.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{\left(-2 \cdot x1 + 9 \cdot {x1}^{2}\right)} \]
    7. Step-by-step derivation
      1. fma-def100.0%

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

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

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

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

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

Alternative 5: 98.5% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x1 \leq -3.1 \cdot 10^{+107}:\\
\;\;\;\;x1 + \left(t_3 + \left(x1 + -3 \cdot {x1}^{3}\right)\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -5.00000000000000003e159 or 2.00000000000000003e151 < 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(x1 \cdot \left(x2 \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.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto x1 + \color{blue}{\left(-2 \cdot x1 + 9 \cdot {x1}^{2}\right)} \]
    7. Step-by-step derivation
      1. fma-def100.0%

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

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

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

      \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(-2, x1, \left(x1 \cdot x1\right) \cdot 9\right)} \]

    if -5.00000000000000003e159 < x1 < -3.10000000000000026e107

    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 inf 100.0%

      \[\leadsto x1 + \left(\left(\color{blue}{\left(-3 \cdot {x1}^{3} + 6 \cdot {x1}^{4}\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 100.0%

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

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

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

    if -3.10000000000000026e107 < x1 < 2.00000000000000003e151

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

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

Alternative 6: 94.8% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot \left(x1 \cdot 3\right)\\ t_1 := 1 + x1 \cdot x1\\ t_2 := \frac{\left(x2 \cdot 2 + t_0\right) - x1}{t_1}\\ \mathbf{if}\;x1 \leq -1.55 \cdot 10^{+109} \lor \neg \left(x1 \leq 2 \cdot 10^{+151}\right):\\ \;\;\;\;x1 + \mathsf{fma}\left(-2, x1, \left(x1 \cdot x1\right) \cdot 9\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(t_0 - x2 \cdot 2\right) - x1}{t_1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(t_1 \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot t_2 - 6\right) + \left(t_2 - 3\right) \cdot \left(\left(x1 \cdot 2\right) \cdot t_2\right)\right) + 3 \cdot t_0\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* x1 (* x1 3.0)))
        (t_1 (+ 1.0 (* x1 x1)))
        (t_2 (/ (- (+ (* x2 2.0) t_0) x1) t_1)))
   (if (or (<= x1 -1.55e+109) (not (<= x1 2e+151)))
     (+ x1 (fma -2.0 x1 (* (* x1 x1) 9.0)))
     (+
      x1
      (+
       (* 3.0 (/ (- (- t_0 (* x2 2.0)) x1) t_1))
       (+
        x1
        (+
         (* x1 (* x1 x1))
         (+
          (*
           t_1
           (+
            (* (* x1 x1) (- (* 4.0 t_2) 6.0))
            (* (- t_2 3.0) (* (* x1 2.0) t_2))))
          (* 3.0 t_0)))))))))
double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = 1.0 + (x1 * x1);
	double t_2 = (((x2 * 2.0) + t_0) - x1) / t_1;
	double tmp;
	if ((x1 <= -1.55e+109) || !(x1 <= 2e+151)) {
		tmp = x1 + fma(-2.0, x1, ((x1 * x1) * 9.0));
	} else {
		tmp = x1 + ((3.0 * (((t_0 - (x2 * 2.0)) - x1) / t_1)) + (x1 + ((x1 * (x1 * x1)) + ((t_1 * (((x1 * x1) * ((4.0 * t_2) - 6.0)) + ((t_2 - 3.0) * ((x1 * 2.0) * t_2)))) + (3.0 * t_0)))));
	}
	return tmp;
}
function code(x1, x2)
	t_0 = Float64(x1 * Float64(x1 * 3.0))
	t_1 = Float64(1.0 + Float64(x1 * x1))
	t_2 = Float64(Float64(Float64(Float64(x2 * 2.0) + t_0) - x1) / t_1)
	tmp = 0.0
	if ((x1 <= -1.55e+109) || !(x1 <= 2e+151))
		tmp = Float64(x1 + fma(-2.0, x1, Float64(Float64(x1 * x1) * 9.0)));
	else
		tmp = Float64(x1 + Float64(Float64(3.0 * Float64(Float64(Float64(t_0 - Float64(x2 * 2.0)) - x1) / t_1)) + Float64(x1 + Float64(Float64(x1 * Float64(x1 * x1)) + Float64(Float64(t_1 * Float64(Float64(Float64(x1 * x1) * Float64(Float64(4.0 * t_2) - 6.0)) + Float64(Float64(t_2 - 3.0) * Float64(Float64(x1 * 2.0) * t_2)))) + Float64(3.0 * t_0))))));
	end
	return tmp
end
code[x1_, x2_] := Block[{t$95$0 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(x2 * 2.0), $MachinePrecision] + t$95$0), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[Or[LessEqual[x1, -1.55e+109], N[Not[LessEqual[x1, 2e+151]], $MachinePrecision]], N[(x1 + N[(-2.0 * x1 + N[(N[(x1 * x1), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x1 + N[(N[(3.0 * N[(N[(N[(t$95$0 - N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(x1 + N[(N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 * N[(N[(N[(x1 * x1), $MachinePrecision] * N[(N[(4.0 * t$95$2), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - 3.0), $MachinePrecision] * N[(N[(x1 * 2.0), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(3.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 \cdot \left(x1 \cdot 3\right)\\
t_1 := 1 + x1 \cdot x1\\
t_2 := \frac{\left(x2 \cdot 2 + t_0\right) - x1}{t_1}\\
\mathbf{if}\;x1 \leq -1.55 \cdot 10^{+109} \lor \neg \left(x1 \leq 2 \cdot 10^{+151}\right):\\
\;\;\;\;x1 + \mathsf{fma}\left(-2, x1, \left(x1 \cdot x1\right) \cdot 9\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -1.54999999999999996e109 or 2.00000000000000003e151 < 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(x1 \cdot \left(x2 \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.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x1 + \mathsf{fma}\left(-2, x1, \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right) \]
    8. Simplified88.8%

      \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(-2, x1, \left(x1 \cdot x1\right) \cdot 9\right)} \]

    if -1.54999999999999996e109 < x1 < 2.00000000000000003e151

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

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

Alternative 7: 91.6% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -1.6000000000000001e109 or 5.00000000000000018e153 < 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(x1 \cdot \left(x2 \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.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x1 + \mathsf{fma}\left(-2, x1, \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right) \]
    8. Simplified88.8%

      \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(-2, x1, \left(x1 \cdot x1\right) \cdot 9\right)} \]

    if -1.6000000000000001e109 < x1 < 5.00000000000000018e153

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

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

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

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

Alternative 8: 93.3% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot \left(x1 \cdot 3\right)\\ t_1 := 1 + x1 \cdot x1\\ t_2 := \frac{\left(x2 \cdot 2 + t_0\right) - x1}{t_1}\\ \mathbf{if}\;x1 \leq -5.8 \cdot 10^{+107} \lor \neg \left(x1 \leq 2 \cdot 10^{+151}\right):\\ \;\;\;\;x1 + \mathsf{fma}\left(-2, x1, \left(x1 \cdot x1\right) \cdot 9\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(t_0 - x2 \cdot 2\right) - x1}{t_1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(t_0 \cdot t_2 + t_1 \cdot \left(\left(t_2 - 3\right) \cdot \left(\left(x1 \cdot 2\right) \cdot t_2\right) + 6 \cdot \left(x1 \cdot x1\right)\right)\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* x1 (* x1 3.0)))
        (t_1 (+ 1.0 (* x1 x1)))
        (t_2 (/ (- (+ (* x2 2.0) t_0) x1) t_1)))
   (if (or (<= x1 -5.8e+107) (not (<= x1 2e+151)))
     (+ x1 (fma -2.0 x1 (* (* x1 x1) 9.0)))
     (+
      x1
      (+
       (* 3.0 (/ (- (- t_0 (* x2 2.0)) x1) t_1))
       (+
        x1
        (+
         (* x1 (* x1 x1))
         (+
          (* t_0 t_2)
          (*
           t_1
           (+ (* (- t_2 3.0) (* (* x1 2.0) t_2)) (* 6.0 (* x1 x1))))))))))))
double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = 1.0 + (x1 * x1);
	double t_2 = (((x2 * 2.0) + t_0) - x1) / t_1;
	double tmp;
	if ((x1 <= -5.8e+107) || !(x1 <= 2e+151)) {
		tmp = x1 + fma(-2.0, x1, ((x1 * x1) * 9.0));
	} else {
		tmp = x1 + ((3.0 * (((t_0 - (x2 * 2.0)) - x1) / t_1)) + (x1 + ((x1 * (x1 * x1)) + ((t_0 * t_2) + (t_1 * (((t_2 - 3.0) * ((x1 * 2.0) * t_2)) + (6.0 * (x1 * x1))))))));
	}
	return tmp;
}
function code(x1, x2)
	t_0 = Float64(x1 * Float64(x1 * 3.0))
	t_1 = Float64(1.0 + Float64(x1 * x1))
	t_2 = Float64(Float64(Float64(Float64(x2 * 2.0) + t_0) - x1) / t_1)
	tmp = 0.0
	if ((x1 <= -5.8e+107) || !(x1 <= 2e+151))
		tmp = Float64(x1 + fma(-2.0, x1, Float64(Float64(x1 * x1) * 9.0)));
	else
		tmp = Float64(x1 + Float64(Float64(3.0 * Float64(Float64(Float64(t_0 - Float64(x2 * 2.0)) - x1) / t_1)) + Float64(x1 + Float64(Float64(x1 * Float64(x1 * x1)) + Float64(Float64(t_0 * t_2) + Float64(t_1 * Float64(Float64(Float64(t_2 - 3.0) * Float64(Float64(x1 * 2.0) * t_2)) + Float64(6.0 * Float64(x1 * x1)))))))));
	end
	return tmp
end
code[x1_, x2_] := Block[{t$95$0 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(x2 * 2.0), $MachinePrecision] + t$95$0), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[Or[LessEqual[x1, -5.8e+107], N[Not[LessEqual[x1, 2e+151]], $MachinePrecision]], N[(x1 + N[(-2.0 * x1 + N[(N[(x1 * x1), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x1 + N[(N[(3.0 * N[(N[(N[(t$95$0 - N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(x1 + N[(N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$0 * t$95$2), $MachinePrecision] + N[(t$95$1 * N[(N[(N[(t$95$2 - 3.0), $MachinePrecision] * N[(N[(x1 * 2.0), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(6.0 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -5.79999999999999975e107 or 2.00000000000000003e151 < 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(x1 \cdot \left(x2 \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.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x1 + \mathsf{fma}\left(-2, x1, \color{blue}{\left(x1 \cdot x1\right)} \cdot 9\right) \]
    8. Simplified88.8%

      \[\leadsto x1 + \color{blue}{\mathsf{fma}\left(-2, x1, \left(x1 \cdot x1\right) \cdot 9\right)} \]

    if -5.79999999999999975e107 < x1 < 2.00000000000000003e151

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

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

Alternative 9: 78.7% accurate, 1.2× speedup?

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

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

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

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


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

    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(x1 \cdot \left(x2 \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 2.2%

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

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

        \[\leadsto x1 + \left(\left(4 \cdot \left(\color{blue}{\left(x2 \cdot x1\right)} \cdot -3\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-*l*2.2%

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

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

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

    if -3.10000000000000026e107 < x1 < 7.59999999999999933e153

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

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

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

    if 7.59999999999999933e153 < 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(x1 \cdot \left(x2 \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 5.6%

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

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

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

        \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    7. Applied egg-rr77.4%

      \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    8. Step-by-step derivation
      1. swap-sqr77.4%

        \[\leadsto \frac{x1 \cdot x1 - \color{blue}{\left(x2 \cdot x2\right) \cdot \left(-6 \cdot -6\right)}}{x1 - x2 \cdot -6} \]
      2. metadata-eval77.4%

        \[\leadsto \frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot \color{blue}{36}}{x1 - x2 \cdot -6} \]
    9. Simplified77.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -3.1 \cdot 10^{+107}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq 7.6 \cdot 10^{+153}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left(1 + x1 \cdot x1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x2 \cdot 2 + x1 \cdot \left(x1 \cdot 3\right)\right) - x1}{1 + x1 \cdot x1} - 6\right) + \left(\frac{\left(x2 \cdot 2 + x1 \cdot \left(x1 \cdot 3\right)\right) - x1}{1 + x1 \cdot x1} - 3\right) \cdot \left(\left(x1 \cdot 2\right) \cdot \left(x2 \cdot 2 - x1\right)\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot 36}{x1 - x2 \cdot -6}\\ \end{array} \]

Alternative 10: 78.3% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot \left(x1 \cdot x1\right)\\ t_1 := 1 + x1 \cdot x1\\ t_2 := x1 \cdot \left(x1 \cdot 3\right)\\ t_3 := 3 \cdot \frac{\left(t_2 - x2 \cdot 2\right) - x1}{t_1}\\ t_4 := \frac{\left(x2 \cdot 2 + t_2\right) - x1}{t_1}\\ t_5 := \left(x1 \cdot x1\right) \cdot \left(4 \cdot t_4 - 6\right)\\ \mathbf{if}\;x1 \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq -5500000000:\\ \;\;\;\;x1 + \left(t_3 + \left(x1 + \left(t_0 + \left(t_2 \cdot t_4 + t_1 \cdot \left(t_5 + \left(\left(x1 \cdot 2\right) \cdot \left(x2 \cdot 2 - x1\right)\right) \cdot 0\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1950:\\ \;\;\;\;x1 + \left(t_3 + \left(x1 + 4 \cdot \left(2 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;x1 + \left(t_3 + \left(x1 + \left(t_0 + \left(3 \cdot t_2 + t_1 \cdot \left(x1 \cdot 2 + t_5\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot 36}{x1 - x2 \cdot -6}\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* x1 (* x1 x1)))
        (t_1 (+ 1.0 (* x1 x1)))
        (t_2 (* x1 (* x1 3.0)))
        (t_3 (* 3.0 (/ (- (- t_2 (* x2 2.0)) x1) t_1)))
        (t_4 (/ (- (+ (* x2 2.0) t_2) x1) t_1))
        (t_5 (* (* x1 x1) (- (* 4.0 t_4) 6.0))))
   (if (<= x1 -5.5e+102)
     (+ x1 (+ (* x1 (- (* x2 -12.0) 2.0)) (* x2 -6.0)))
     (if (<= x1 -5500000000.0)
       (+
        x1
        (+
         t_3
         (+
          x1
          (+
           t_0
           (+
            (* t_2 t_4)
            (* t_1 (+ t_5 (* (* (* x1 2.0) (- (* x2 2.0) x1)) 0.0))))))))
       (if (<= x1 1950.0)
         (+ x1 (+ t_3 (+ x1 (* 4.0 (* 2.0 (* x2 (* x1 x2)))))))
         (if (<= x1 1.35e+154)
           (+
            x1
            (+ t_3 (+ x1 (+ t_0 (+ (* 3.0 t_2) (* t_1 (+ (* x1 2.0) t_5)))))))
           (/ (- (* x1 x1) (* (* x2 x2) 36.0)) (- x1 (* x2 -6.0)))))))))
double code(double x1, double x2) {
	double t_0 = x1 * (x1 * x1);
	double t_1 = 1.0 + (x1 * x1);
	double t_2 = x1 * (x1 * 3.0);
	double t_3 = 3.0 * (((t_2 - (x2 * 2.0)) - x1) / t_1);
	double t_4 = (((x2 * 2.0) + t_2) - x1) / t_1;
	double t_5 = (x1 * x1) * ((4.0 * t_4) - 6.0);
	double tmp;
	if (x1 <= -5.5e+102) {
		tmp = x1 + ((x1 * ((x2 * -12.0) - 2.0)) + (x2 * -6.0));
	} else if (x1 <= -5500000000.0) {
		tmp = x1 + (t_3 + (x1 + (t_0 + ((t_2 * t_4) + (t_1 * (t_5 + (((x1 * 2.0) * ((x2 * 2.0) - x1)) * 0.0)))))));
	} else if (x1 <= 1950.0) {
		tmp = x1 + (t_3 + (x1 + (4.0 * (2.0 * (x2 * (x1 * x2))))));
	} else if (x1 <= 1.35e+154) {
		tmp = x1 + (t_3 + (x1 + (t_0 + ((3.0 * t_2) + (t_1 * ((x1 * 2.0) + t_5))))));
	} else {
		tmp = ((x1 * x1) - ((x2 * x2) * 36.0)) / (x1 - (x2 * -6.0));
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_0 = x1 * (x1 * x1)
    t_1 = 1.0d0 + (x1 * x1)
    t_2 = x1 * (x1 * 3.0d0)
    t_3 = 3.0d0 * (((t_2 - (x2 * 2.0d0)) - x1) / t_1)
    t_4 = (((x2 * 2.0d0) + t_2) - x1) / t_1
    t_5 = (x1 * x1) * ((4.0d0 * t_4) - 6.0d0)
    if (x1 <= (-5.5d+102)) then
        tmp = x1 + ((x1 * ((x2 * (-12.0d0)) - 2.0d0)) + (x2 * (-6.0d0)))
    else if (x1 <= (-5500000000.0d0)) then
        tmp = x1 + (t_3 + (x1 + (t_0 + ((t_2 * t_4) + (t_1 * (t_5 + (((x1 * 2.0d0) * ((x2 * 2.0d0) - x1)) * 0.0d0)))))))
    else if (x1 <= 1950.0d0) then
        tmp = x1 + (t_3 + (x1 + (4.0d0 * (2.0d0 * (x2 * (x1 * x2))))))
    else if (x1 <= 1.35d+154) then
        tmp = x1 + (t_3 + (x1 + (t_0 + ((3.0d0 * t_2) + (t_1 * ((x1 * 2.0d0) + t_5))))))
    else
        tmp = ((x1 * x1) - ((x2 * x2) * 36.0d0)) / (x1 - (x2 * (-6.0d0)))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = x1 * (x1 * x1);
	double t_1 = 1.0 + (x1 * x1);
	double t_2 = x1 * (x1 * 3.0);
	double t_3 = 3.0 * (((t_2 - (x2 * 2.0)) - x1) / t_1);
	double t_4 = (((x2 * 2.0) + t_2) - x1) / t_1;
	double t_5 = (x1 * x1) * ((4.0 * t_4) - 6.0);
	double tmp;
	if (x1 <= -5.5e+102) {
		tmp = x1 + ((x1 * ((x2 * -12.0) - 2.0)) + (x2 * -6.0));
	} else if (x1 <= -5500000000.0) {
		tmp = x1 + (t_3 + (x1 + (t_0 + ((t_2 * t_4) + (t_1 * (t_5 + (((x1 * 2.0) * ((x2 * 2.0) - x1)) * 0.0)))))));
	} else if (x1 <= 1950.0) {
		tmp = x1 + (t_3 + (x1 + (4.0 * (2.0 * (x2 * (x1 * x2))))));
	} else if (x1 <= 1.35e+154) {
		tmp = x1 + (t_3 + (x1 + (t_0 + ((3.0 * t_2) + (t_1 * ((x1 * 2.0) + t_5))))));
	} else {
		tmp = ((x1 * x1) - ((x2 * x2) * 36.0)) / (x1 - (x2 * -6.0));
	}
	return tmp;
}
def code(x1, x2):
	t_0 = x1 * (x1 * x1)
	t_1 = 1.0 + (x1 * x1)
	t_2 = x1 * (x1 * 3.0)
	t_3 = 3.0 * (((t_2 - (x2 * 2.0)) - x1) / t_1)
	t_4 = (((x2 * 2.0) + t_2) - x1) / t_1
	t_5 = (x1 * x1) * ((4.0 * t_4) - 6.0)
	tmp = 0
	if x1 <= -5.5e+102:
		tmp = x1 + ((x1 * ((x2 * -12.0) - 2.0)) + (x2 * -6.0))
	elif x1 <= -5500000000.0:
		tmp = x1 + (t_3 + (x1 + (t_0 + ((t_2 * t_4) + (t_1 * (t_5 + (((x1 * 2.0) * ((x2 * 2.0) - x1)) * 0.0)))))))
	elif x1 <= 1950.0:
		tmp = x1 + (t_3 + (x1 + (4.0 * (2.0 * (x2 * (x1 * x2))))))
	elif x1 <= 1.35e+154:
		tmp = x1 + (t_3 + (x1 + (t_0 + ((3.0 * t_2) + (t_1 * ((x1 * 2.0) + t_5))))))
	else:
		tmp = ((x1 * x1) - ((x2 * x2) * 36.0)) / (x1 - (x2 * -6.0))
	return tmp
function code(x1, x2)
	t_0 = Float64(x1 * Float64(x1 * x1))
	t_1 = Float64(1.0 + Float64(x1 * x1))
	t_2 = Float64(x1 * Float64(x1 * 3.0))
	t_3 = Float64(3.0 * Float64(Float64(Float64(t_2 - Float64(x2 * 2.0)) - x1) / t_1))
	t_4 = Float64(Float64(Float64(Float64(x2 * 2.0) + t_2) - x1) / t_1)
	t_5 = Float64(Float64(x1 * x1) * Float64(Float64(4.0 * t_4) - 6.0))
	tmp = 0.0
	if (x1 <= -5.5e+102)
		tmp = Float64(x1 + Float64(Float64(x1 * Float64(Float64(x2 * -12.0) - 2.0)) + Float64(x2 * -6.0)));
	elseif (x1 <= -5500000000.0)
		tmp = Float64(x1 + Float64(t_3 + Float64(x1 + Float64(t_0 + Float64(Float64(t_2 * t_4) + Float64(t_1 * Float64(t_5 + Float64(Float64(Float64(x1 * 2.0) * Float64(Float64(x2 * 2.0) - x1)) * 0.0))))))));
	elseif (x1 <= 1950.0)
		tmp = Float64(x1 + Float64(t_3 + Float64(x1 + Float64(4.0 * Float64(2.0 * Float64(x2 * Float64(x1 * x2)))))));
	elseif (x1 <= 1.35e+154)
		tmp = Float64(x1 + Float64(t_3 + Float64(x1 + Float64(t_0 + Float64(Float64(3.0 * t_2) + Float64(t_1 * Float64(Float64(x1 * 2.0) + t_5)))))));
	else
		tmp = Float64(Float64(Float64(x1 * x1) - Float64(Float64(x2 * x2) * 36.0)) / Float64(x1 - Float64(x2 * -6.0)));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = x1 * (x1 * x1);
	t_1 = 1.0 + (x1 * x1);
	t_2 = x1 * (x1 * 3.0);
	t_3 = 3.0 * (((t_2 - (x2 * 2.0)) - x1) / t_1);
	t_4 = (((x2 * 2.0) + t_2) - x1) / t_1;
	t_5 = (x1 * x1) * ((4.0 * t_4) - 6.0);
	tmp = 0.0;
	if (x1 <= -5.5e+102)
		tmp = x1 + ((x1 * ((x2 * -12.0) - 2.0)) + (x2 * -6.0));
	elseif (x1 <= -5500000000.0)
		tmp = x1 + (t_3 + (x1 + (t_0 + ((t_2 * t_4) + (t_1 * (t_5 + (((x1 * 2.0) * ((x2 * 2.0) - x1)) * 0.0)))))));
	elseif (x1 <= 1950.0)
		tmp = x1 + (t_3 + (x1 + (4.0 * (2.0 * (x2 * (x1 * x2))))));
	elseif (x1 <= 1.35e+154)
		tmp = x1 + (t_3 + (x1 + (t_0 + ((3.0 * t_2) + (t_1 * ((x1 * 2.0) + t_5))))));
	else
		tmp = ((x1 * x1) - ((x2 * x2) * 36.0)) / (x1 - (x2 * -6.0));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(3.0 * N[(N[(N[(t$95$2 - N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(N[(x2 * 2.0), $MachinePrecision] + t$95$2), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$5 = N[(N[(x1 * x1), $MachinePrecision] * N[(N[(4.0 * t$95$4), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x1, -5.5e+102], N[(x1 + N[(N[(x1 * N[(N[(x2 * -12.0), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] + N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, -5500000000.0], N[(x1 + N[(t$95$3 + N[(x1 + N[(t$95$0 + N[(N[(t$95$2 * t$95$4), $MachinePrecision] + N[(t$95$1 * N[(t$95$5 + N[(N[(N[(x1 * 2.0), $MachinePrecision] * N[(N[(x2 * 2.0), $MachinePrecision] - x1), $MachinePrecision]), $MachinePrecision] * 0.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1950.0], N[(x1 + N[(t$95$3 + N[(x1 + N[(4.0 * N[(2.0 * N[(x2 * N[(x1 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1.35e+154], N[(x1 + N[(t$95$3 + N[(x1 + N[(t$95$0 + N[(N[(3.0 * t$95$2), $MachinePrecision] + N[(t$95$1 * N[(N[(x1 * 2.0), $MachinePrecision] + t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x1 * x1), $MachinePrecision] - N[(N[(x2 * x2), $MachinePrecision] * 36.0), $MachinePrecision]), $MachinePrecision] / N[(x1 - N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x1 \leq -5500000000:\\
\;\;\;\;x1 + \left(t_3 + \left(x1 + \left(t_0 + \left(t_2 \cdot t_4 + t_1 \cdot \left(t_5 + \left(\left(x1 \cdot 2\right) \cdot \left(x2 \cdot 2 - x1\right)\right) \cdot 0\right)\right)\right)\right)\right)\\

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

\mathbf{elif}\;x1 \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x1 + \left(t_3 + \left(x1 + \left(t_0 + \left(3 \cdot t_2 + t_1 \cdot \left(x1 \cdot 2 + t_5\right)\right)\right)\right)\right)\\

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


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

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 4.1%

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

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

        \[\leadsto x1 + \left(\left(4 \cdot \left(\color{blue}{\left(x2 \cdot x1\right)} \cdot -3\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-*l*4.1%

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

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

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

    if -5.49999999999999981e102 < x1 < -5.5e9

    1. Initial program 99.2%

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

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

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

    if -5.5e9 < x1 < 1950

    1. Initial program 99.2%

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 83.9%

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

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

        \[\leadsto x1 + \left(\left(4 \cdot \left(2 \cdot \left(\color{blue}{\left(x2 \cdot x2\right)} \cdot x1\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. associate-*l*98.6%

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

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

    if 1950 < x1 < 1.35000000000000003e154

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

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

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

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

    if 1.35000000000000003e154 < 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(x1 \cdot \left(x2 \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 5.6%

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

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

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

        \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    7. Applied egg-rr77.4%

      \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    8. Step-by-step derivation
      1. swap-sqr77.4%

        \[\leadsto \frac{x1 \cdot x1 - \color{blue}{\left(x2 \cdot x2\right) \cdot \left(-6 \cdot -6\right)}}{x1 - x2 \cdot -6} \]
      2. metadata-eval77.4%

        \[\leadsto \frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot \color{blue}{36}}{x1 - x2 \cdot -6} \]
    9. Simplified77.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq -5500000000:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(\left(x1 \cdot \left(x1 \cdot 3\right)\right) \cdot \frac{\left(x2 \cdot 2 + x1 \cdot \left(x1 \cdot 3\right)\right) - x1}{1 + x1 \cdot x1} + \left(1 + x1 \cdot x1\right) \cdot \left(\left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x2 \cdot 2 + x1 \cdot \left(x1 \cdot 3\right)\right) - x1}{1 + x1 \cdot x1} - 6\right) + \left(\left(x1 \cdot 2\right) \cdot \left(x2 \cdot 2 - x1\right)\right) \cdot 0\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1950:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + 4 \cdot \left(2 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left(1 + x1 \cdot x1\right) \cdot \left(x1 \cdot 2 + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x2 \cdot 2 + x1 \cdot \left(x1 \cdot 3\right)\right) - x1}{1 + x1 \cdot x1} - 6\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot 36}{x1 - x2 \cdot -6}\\ \end{array} \]

Alternative 11: 78.7% accurate, 1.6× speedup?

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

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

\mathbf{elif}\;x1 \leq -37000000:\\
\;\;\;\;t_3\\

\mathbf{elif}\;x1 \leq 9600:\\
\;\;\;\;x1 + \left(t_2 + \left(x1 + 4 \cdot \left(2 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\right)\right)\right)\\

\mathbf{elif}\;x1 \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_3\\

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


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

    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(x1 \cdot \left(x2 \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 2.2%

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

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

        \[\leadsto x1 + \left(\left(4 \cdot \left(\color{blue}{\left(x2 \cdot x1\right)} \cdot -3\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-*l*2.2%

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

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

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

    if -3.10000000000000026e107 < x1 < -3.7e7 or 9600 < x1 < 1.35000000000000003e154

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

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

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

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

    if -3.7e7 < x1 < 9600

    1. Initial program 99.2%

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 83.9%

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

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

        \[\leadsto x1 + \left(\left(4 \cdot \left(2 \cdot \left(\color{blue}{\left(x2 \cdot x2\right)} \cdot x1\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. associate-*l*98.6%

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

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

    if 1.35000000000000003e154 < 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(x1 \cdot \left(x2 \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 5.6%

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

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

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

        \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    7. Applied egg-rr77.4%

      \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    8. Step-by-step derivation
      1. swap-sqr77.4%

        \[\leadsto \frac{x1 \cdot x1 - \color{blue}{\left(x2 \cdot x2\right) \cdot \left(-6 \cdot -6\right)}}{x1 - x2 \cdot -6} \]
      2. metadata-eval77.4%

        \[\leadsto \frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot \color{blue}{36}}{x1 - x2 \cdot -6} \]
    9. Simplified77.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -3.1 \cdot 10^{+107}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq -37000000:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left(1 + x1 \cdot x1\right) \cdot \left(x1 \cdot 2 + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x2 \cdot 2 + x1 \cdot \left(x1 \cdot 3\right)\right) - x1}{1 + x1 \cdot x1} - 6\right)\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 9600:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + 4 \cdot \left(2 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left(1 + x1 \cdot x1\right) \cdot \left(x1 \cdot 2 + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(x2 \cdot 2 + x1 \cdot \left(x1 \cdot 3\right)\right) - x1}{1 + x1 \cdot x1} - 6\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot 36}{x1 - x2 \cdot -6}\\ \end{array} \]

Alternative 12: 76.9% accurate, 1.6× speedup?

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

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

\mathbf{elif}\;x1 \leq -68000000:\\
\;\;\;\;t_3\\

\mathbf{elif}\;x1 \leq 42000000000000:\\
\;\;\;\;x1 + \left(t_2 + \left(x1 + 4 \cdot \left(2 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\right)\right)\right)\\

\mathbf{elif}\;x1 \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_3\\

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


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

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 4.1%

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

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

        \[\leadsto x1 + \left(\left(4 \cdot \left(\color{blue}{\left(x2 \cdot x1\right)} \cdot -3\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-*l*4.1%

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

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

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

    if -5.49999999999999981e102 < x1 < -6.8e7 or 4.2e13 < x1 < 1.35000000000000003e154

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

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

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

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

    if -6.8e7 < x1 < 4.2e13

    1. Initial program 99.2%

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 82.7%

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

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

        \[\leadsto x1 + \left(\left(4 \cdot \left(2 \cdot \left(\color{blue}{\left(x2 \cdot x2\right)} \cdot x1\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. associate-*l*97.2%

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

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

    if 1.35000000000000003e154 < 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(x1 \cdot \left(x2 \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 5.6%

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

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

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

        \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    7. Applied egg-rr77.4%

      \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    8. Step-by-step derivation
      1. swap-sqr77.4%

        \[\leadsto \frac{x1 \cdot x1 - \color{blue}{\left(x2 \cdot x2\right) \cdot \left(-6 \cdot -6\right)}}{x1 - x2 \cdot -6} \]
      2. metadata-eval77.4%

        \[\leadsto \frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot \color{blue}{36}}{x1 - x2 \cdot -6} \]
    9. Simplified77.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -5.5 \cdot 10^{+102}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq -68000000:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(\left(x1 \cdot \left(x1 \cdot 3\right)\right) \cdot \frac{\left(x2 \cdot 2 + x1 \cdot \left(x1 \cdot 3\right)\right) - x1}{1 + x1 \cdot x1} + \left(1 + x1 \cdot x1\right) \cdot \left(x1 \cdot 2 + 6 \cdot \left(x1 \cdot x1\right)\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 42000000000000:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + 4 \cdot \left(2 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(\left(x1 \cdot \left(x1 \cdot 3\right)\right) \cdot \frac{\left(x2 \cdot 2 + x1 \cdot \left(x1 \cdot 3\right)\right) - x1}{1 + x1 \cdot x1} + \left(1 + x1 \cdot x1\right) \cdot \left(x1 \cdot 2 + 6 \cdot \left(x1 \cdot x1\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot 36}{x1 - x2 \cdot -6}\\ \end{array} \]

Alternative 13: 68.2% accurate, 3.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq -1.75 \cdot 10^{+75}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + 4 \cdot \left(2 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot 36}{x1 - x2 \cdot -6}\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (<= x1 -1.75e+75)
   (+ x1 (+ (* x1 (- (* x2 -12.0) 2.0)) (* x2 -6.0)))
   (if (<= x1 1.35e+154)
     (+
      x1
      (+
       (* 3.0 (/ (- (- (* x1 (* x1 3.0)) (* x2 2.0)) x1) (+ 1.0 (* x1 x1))))
       (+ x1 (* 4.0 (* 2.0 (* x2 (* x1 x2)))))))
     (/ (- (* x1 x1) (* (* x2 x2) 36.0)) (- x1 (* x2 -6.0))))))
double code(double x1, double x2) {
	double tmp;
	if (x1 <= -1.75e+75) {
		tmp = x1 + ((x1 * ((x2 * -12.0) - 2.0)) + (x2 * -6.0));
	} else if (x1 <= 1.35e+154) {
		tmp = x1 + ((3.0 * ((((x1 * (x1 * 3.0)) - (x2 * 2.0)) - x1) / (1.0 + (x1 * x1)))) + (x1 + (4.0 * (2.0 * (x2 * (x1 * x2))))));
	} else {
		tmp = ((x1 * x1) - ((x2 * x2) * 36.0)) / (x1 - (x2 * -6.0));
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if (x1 <= (-1.75d+75)) then
        tmp = x1 + ((x1 * ((x2 * (-12.0d0)) - 2.0d0)) + (x2 * (-6.0d0)))
    else if (x1 <= 1.35d+154) then
        tmp = x1 + ((3.0d0 * ((((x1 * (x1 * 3.0d0)) - (x2 * 2.0d0)) - x1) / (1.0d0 + (x1 * x1)))) + (x1 + (4.0d0 * (2.0d0 * (x2 * (x1 * x2))))))
    else
        tmp = ((x1 * x1) - ((x2 * x2) * 36.0d0)) / (x1 - (x2 * (-6.0d0)))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if (x1 <= -1.75e+75) {
		tmp = x1 + ((x1 * ((x2 * -12.0) - 2.0)) + (x2 * -6.0));
	} else if (x1 <= 1.35e+154) {
		tmp = x1 + ((3.0 * ((((x1 * (x1 * 3.0)) - (x2 * 2.0)) - x1) / (1.0 + (x1 * x1)))) + (x1 + (4.0 * (2.0 * (x2 * (x1 * x2))))));
	} else {
		tmp = ((x1 * x1) - ((x2 * x2) * 36.0)) / (x1 - (x2 * -6.0));
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if x1 <= -1.75e+75:
		tmp = x1 + ((x1 * ((x2 * -12.0) - 2.0)) + (x2 * -6.0))
	elif x1 <= 1.35e+154:
		tmp = x1 + ((3.0 * ((((x1 * (x1 * 3.0)) - (x2 * 2.0)) - x1) / (1.0 + (x1 * x1)))) + (x1 + (4.0 * (2.0 * (x2 * (x1 * x2))))))
	else:
		tmp = ((x1 * x1) - ((x2 * x2) * 36.0)) / (x1 - (x2 * -6.0))
	return tmp
function code(x1, x2)
	tmp = 0.0
	if (x1 <= -1.75e+75)
		tmp = Float64(x1 + Float64(Float64(x1 * Float64(Float64(x2 * -12.0) - 2.0)) + Float64(x2 * -6.0)));
	elseif (x1 <= 1.35e+154)
		tmp = Float64(x1 + Float64(Float64(3.0 * Float64(Float64(Float64(Float64(x1 * Float64(x1 * 3.0)) - Float64(x2 * 2.0)) - x1) / Float64(1.0 + Float64(x1 * x1)))) + Float64(x1 + Float64(4.0 * Float64(2.0 * Float64(x2 * Float64(x1 * x2)))))));
	else
		tmp = Float64(Float64(Float64(x1 * x1) - Float64(Float64(x2 * x2) * 36.0)) / Float64(x1 - Float64(x2 * -6.0)));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if (x1 <= -1.75e+75)
		tmp = x1 + ((x1 * ((x2 * -12.0) - 2.0)) + (x2 * -6.0));
	elseif (x1 <= 1.35e+154)
		tmp = x1 + ((3.0 * ((((x1 * (x1 * 3.0)) - (x2 * 2.0)) - x1) / (1.0 + (x1 * x1)))) + (x1 + (4.0 * (2.0 * (x2 * (x1 * x2))))));
	else
		tmp = ((x1 * x1) - ((x2 * x2) * 36.0)) / (x1 - (x2 * -6.0));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[LessEqual[x1, -1.75e+75], N[(x1 + N[(N[(x1 * N[(N[(x2 * -12.0), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] + N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1.35e+154], N[(x1 + N[(N[(3.0 * N[(N[(N[(N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision] - N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x1 + N[(4.0 * N[(2.0 * N[(x2 * N[(x1 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x1 * x1), $MachinePrecision] - N[(N[(x2 * x2), $MachinePrecision] * 36.0), $MachinePrecision]), $MachinePrecision] / N[(x1 - N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -1.75 \cdot 10^{+75}:\\
\;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\

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

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


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

    1. Initial program 15.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 1.7%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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.7%

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

        \[\leadsto x1 + \left(\left(4 \cdot \color{blue}{\left(\left(x1 \cdot x2\right) \cdot -3\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. *-commutative3.7%

        \[\leadsto x1 + \left(\left(4 \cdot \left(\color{blue}{\left(x2 \cdot x1\right)} \cdot -3\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-*l*3.7%

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

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

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

    if -1.7499999999999999e75 < x1 < 1.35000000000000003e154

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 69.7%

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

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

        \[\leadsto x1 + \left(\left(4 \cdot \left(2 \cdot \left(\color{blue}{\left(x2 \cdot x2\right)} \cdot x1\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. associate-*l*80.5%

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

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

    if 1.35000000000000003e154 < 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(x1 \cdot \left(x2 \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 5.6%

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

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

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

        \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    7. Applied egg-rr77.4%

      \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    8. Step-by-step derivation
      1. swap-sqr77.4%

        \[\leadsto \frac{x1 \cdot x1 - \color{blue}{\left(x2 \cdot x2\right) \cdot \left(-6 \cdot -6\right)}}{x1 - x2 \cdot -6} \]
      2. metadata-eval77.4%

        \[\leadsto \frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot \color{blue}{36}}{x1 - x2 \cdot -6} \]
    9. Simplified77.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.75 \cdot 10^{+75}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq 1.35 \cdot 10^{+154}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(x1 \cdot \left(x1 \cdot 3\right) - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} + \left(x1 + 4 \cdot \left(2 \cdot \left(x2 \cdot \left(x1 \cdot x2\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot 36}{x1 - x2 \cdot -6}\\ \end{array} \]

Alternative 14: 63.6% accurate, 4.7× speedup?

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

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

\mathbf{elif}\;x1 \leq -1.95 \cdot 10^{-190}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x1 \leq 2 \cdot 10^{-226}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x1 \leq 7.5 \cdot 10^{+169}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -1.7499999999999999e75 or -1.94999999999999997e-190 < x1 < 1.99999999999999984e-226

    1. Initial program 50.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 30.5%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 40.8%

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

        \[\leadsto x1 + \left(\left(4 \cdot \color{blue}{\left(\left(x1 \cdot x2\right) \cdot -3\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. *-commutative40.8%

        \[\leadsto x1 + \left(\left(4 \cdot \left(\color{blue}{\left(x2 \cdot x1\right)} \cdot -3\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-*l*40.8%

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

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

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

    if -1.7499999999999999e75 < x1 < -1.94999999999999997e-190 or 1.99999999999999984e-226 < x1 < 7.49999999999999992e169

    1. Initial program 95.2%

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 70.0%

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

    if 7.49999999999999992e169 < 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(x1 \cdot \left(x2 \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 6.2%

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

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

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

        \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    7. Applied egg-rr85.2%

      \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    8. Step-by-step derivation
      1. swap-sqr85.2%

        \[\leadsto \frac{x1 \cdot x1 - \color{blue}{\left(x2 \cdot x2\right) \cdot \left(-6 \cdot -6\right)}}{x1 - x2 \cdot -6} \]
      2. metadata-eval85.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.75 \cdot 10^{+75}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq -1.95 \cdot 10^{-190}:\\ \;\;\;\;x1 + \left(x2 \cdot -6 + x1 \cdot \left(4 \cdot \left(x2 \cdot \left(x2 \cdot 2 - 3\right)\right) - 2\right)\right)\\ \mathbf{elif}\;x1 \leq 2 \cdot 10^{-226}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq 7.5 \cdot 10^{+169}:\\ \;\;\;\;x1 + \left(x2 \cdot -6 + x1 \cdot \left(4 \cdot \left(x2 \cdot \left(x2 \cdot 2 - 3\right)\right) - 2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot 36}{x1 - x2 \cdot -6}\\ \end{array} \]

Alternative 15: 55.2% accurate, 5.5× speedup?

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

\\
\begin{array}{l}
t_0 := x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\
\mathbf{if}\;x1 \leq -1.45 \cdot 10^{+75}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;x1 \leq 5 \cdot 10^{-38}:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x1 < -1.4499999999999999e75 or -3.04999999999999976e-16 < x1 < 5.00000000000000033e-38

    1. Initial program 69.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 53.9%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 53.5%

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

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

        \[\leadsto x1 + \left(\left(4 \cdot \left(\color{blue}{\left(x2 \cdot x1\right)} \cdot -3\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-*l*53.5%

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

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

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

    if -1.4499999999999999e75 < x1 < -3.04999999999999976e-16

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 36.6%

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

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

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

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

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

    if 5.00000000000000033e-38 < x1 < 7.49999999999999992e169

    1. Initial program 88.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 44.1%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 43.8%

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

    if 7.49999999999999992e169 < 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(x1 \cdot \left(x2 \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 6.2%

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

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

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

        \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    7. Applied egg-rr85.2%

      \[\leadsto \color{blue}{\frac{x1 \cdot x1 - \left(x2 \cdot -6\right) \cdot \left(x2 \cdot -6\right)}{x1 - x2 \cdot -6}} \]
    8. Step-by-step derivation
      1. swap-sqr85.2%

        \[\leadsto \frac{x1 \cdot x1 - \color{blue}{\left(x2 \cdot x2\right) \cdot \left(-6 \cdot -6\right)}}{x1 - x2 \cdot -6} \]
      2. metadata-eval85.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.45 \cdot 10^{+75}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq -3.05 \cdot 10^{-16}:\\ \;\;\;\;x1 + x1 \cdot \left(\left(x2 \cdot x2\right) \cdot 8\right)\\ \mathbf{elif}\;x1 \leq 5 \cdot 10^{-38}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq 7.5 \cdot 10^{+169}:\\ \;\;\;\;x1 + x1 \cdot \left(1 + 4 \cdot \left(x2 \cdot \left(x2 \cdot 2 - 3\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x1 \cdot x1 - \left(x2 \cdot x2\right) \cdot 36}{x1 - x2 \cdot -6}\\ \end{array} \]

Alternative 16: 51.6% accurate, 6.0× speedup?

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

\\
\begin{array}{l}
t_0 := x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\
\mathbf{if}\;x1 \leq -1.75 \cdot 10^{+75}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;x1 \leq 3 \cdot 10^{-41}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -1.7499999999999999e75 or -7.19999999999999948e-29 < x1 < 2.99999999999999989e-41

    1. Initial program 69.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 53.9%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 53.5%

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

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

        \[\leadsto x1 + \left(\left(4 \cdot \left(\color{blue}{\left(x2 \cdot x1\right)} \cdot -3\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-*l*53.5%

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

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

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

    if -1.7499999999999999e75 < x1 < -7.19999999999999948e-29

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 36.6%

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

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

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

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

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

    if 2.99999999999999989e-41 < x1

    1. Initial program 54.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 27.3%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 45.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.75 \cdot 10^{+75}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{elif}\;x1 \leq -7.2 \cdot 10^{-29}:\\ \;\;\;\;x1 + x1 \cdot \left(\left(x2 \cdot x2\right) \cdot 8\right)\\ \mathbf{elif}\;x1 \leq 3 \cdot 10^{-41}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + x1 \cdot \left(1 + 4 \cdot \left(x2 \cdot \left(x2 \cdot 2 - 3\right)\right)\right)\\ \end{array} \]

Alternative 17: 51.8% accurate, 6.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -1.75 \cdot 10^{+75} \lor \neg \left(x1 \leq -2.2 \cdot 10^{-13}\right) \land x1 \leq 5.4 \cdot 10^{-37}:\\
\;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\

\mathbf{else}:\\
\;\;\;\;x1 + x1 \cdot \left(\left(x2 \cdot x2\right) \cdot 8\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -1.7499999999999999e75 or -2.19999999999999997e-13 < x1 < 5.40000000000000032e-37

    1. Initial program 69.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 53.9%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 53.5%

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

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

        \[\leadsto x1 + \left(\left(4 \cdot \left(\color{blue}{\left(x2 \cdot x1\right)} \cdot -3\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-*l*53.5%

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

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

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

    if -1.7499999999999999e75 < x1 < -2.19999999999999997e-13 or 5.40000000000000032e-37 < x1

    1. Initial program 63.2%

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 43.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.75 \cdot 10^{+75} \lor \neg \left(x1 \leq -2.2 \cdot 10^{-13}\right) \land x1 \leq 5.4 \cdot 10^{-37}:\\ \;\;\;\;x1 + \left(x1 \cdot \left(x2 \cdot -12 - 2\right) + x2 \cdot -6\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + x1 \cdot \left(\left(x2 \cdot x2\right) \cdot 8\right)\\ \end{array} \]

Alternative 18: 41.2% accurate, 7.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 + x1 \cdot \left(\left(x2 \cdot x2\right) \cdot 8\right)\\ \mathbf{if}\;x1 \leq -1.75 \cdot 10^{+75}:\\ \;\;\;\;x1 + x1 \cdot \left(1 + x2 \cdot -12\right)\\ \mathbf{elif}\;x1 \leq -2.2 \cdot 10^{-19}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x1 \leq -9.2 \cdot 10^{-179}:\\ \;\;\;\;x1 + x1 \cdot -2\\ \mathbf{elif}\;x1 \leq 2.1 \cdot 10^{-52}:\\ \;\;\;\;x2 \cdot -6\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (+ x1 (* x1 (* (* x2 x2) 8.0)))))
   (if (<= x1 -1.75e+75)
     (+ x1 (* x1 (+ 1.0 (* x2 -12.0))))
     (if (<= x1 -2.2e-19)
       t_0
       (if (<= x1 -9.2e-179)
         (+ x1 (* x1 -2.0))
         (if (<= x1 2.1e-52) (* x2 -6.0) t_0))))))
double code(double x1, double x2) {
	double t_0 = x1 + (x1 * ((x2 * x2) * 8.0));
	double tmp;
	if (x1 <= -1.75e+75) {
		tmp = x1 + (x1 * (1.0 + (x2 * -12.0)));
	} else if (x1 <= -2.2e-19) {
		tmp = t_0;
	} else if (x1 <= -9.2e-179) {
		tmp = x1 + (x1 * -2.0);
	} else if (x1 <= 2.1e-52) {
		tmp = x2 * -6.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 * ((x2 * x2) * 8.0d0))
    if (x1 <= (-1.75d+75)) then
        tmp = x1 + (x1 * (1.0d0 + (x2 * (-12.0d0))))
    else if (x1 <= (-2.2d-19)) then
        tmp = t_0
    else if (x1 <= (-9.2d-179)) then
        tmp = x1 + (x1 * (-2.0d0))
    else if (x1 <= 2.1d-52) then
        tmp = x2 * (-6.0d0)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = x1 + (x1 * ((x2 * x2) * 8.0));
	double tmp;
	if (x1 <= -1.75e+75) {
		tmp = x1 + (x1 * (1.0 + (x2 * -12.0)));
	} else if (x1 <= -2.2e-19) {
		tmp = t_0;
	} else if (x1 <= -9.2e-179) {
		tmp = x1 + (x1 * -2.0);
	} else if (x1 <= 2.1e-52) {
		tmp = x2 * -6.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x1, x2):
	t_0 = x1 + (x1 * ((x2 * x2) * 8.0))
	tmp = 0
	if x1 <= -1.75e+75:
		tmp = x1 + (x1 * (1.0 + (x2 * -12.0)))
	elif x1 <= -2.2e-19:
		tmp = t_0
	elif x1 <= -9.2e-179:
		tmp = x1 + (x1 * -2.0)
	elif x1 <= 2.1e-52:
		tmp = x2 * -6.0
	else:
		tmp = t_0
	return tmp
function code(x1, x2)
	t_0 = Float64(x1 + Float64(x1 * Float64(Float64(x2 * x2) * 8.0)))
	tmp = 0.0
	if (x1 <= -1.75e+75)
		tmp = Float64(x1 + Float64(x1 * Float64(1.0 + Float64(x2 * -12.0))));
	elseif (x1 <= -2.2e-19)
		tmp = t_0;
	elseif (x1 <= -9.2e-179)
		tmp = Float64(x1 + Float64(x1 * -2.0));
	elseif (x1 <= 2.1e-52)
		tmp = Float64(x2 * -6.0);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = x1 + (x1 * ((x2 * x2) * 8.0));
	tmp = 0.0;
	if (x1 <= -1.75e+75)
		tmp = x1 + (x1 * (1.0 + (x2 * -12.0)));
	elseif (x1 <= -2.2e-19)
		tmp = t_0;
	elseif (x1 <= -9.2e-179)
		tmp = x1 + (x1 * -2.0);
	elseif (x1 <= 2.1e-52)
		tmp = x2 * -6.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(x1 + N[(x1 * N[(N[(x2 * x2), $MachinePrecision] * 8.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x1, -1.75e+75], N[(x1 + N[(x1 * N[(1.0 + N[(x2 * -12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, -2.2e-19], t$95$0, If[LessEqual[x1, -9.2e-179], N[(x1 + N[(x1 * -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 2.1e-52], N[(x2 * -6.0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x1 + x1 \cdot \left(\left(x2 \cdot x2\right) \cdot 8\right)\\
\mathbf{if}\;x1 \leq -1.75 \cdot 10^{+75}:\\
\;\;\;\;x1 + x1 \cdot \left(1 + x2 \cdot -12\right)\\

\mathbf{elif}\;x1 \leq -2.2 \cdot 10^{-19}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x1 \leq -9.2 \cdot 10^{-179}:\\
\;\;\;\;x1 + x1 \cdot -2\\

\mathbf{elif}\;x1 \leq 2.1 \cdot 10^{-52}:\\
\;\;\;\;x2 \cdot -6\\

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


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

    1. Initial program 15.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 1.7%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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.7%

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

        \[\leadsto x1 + \left(\left(4 \cdot \color{blue}{\left(\left(x1 \cdot x2\right) \cdot -3\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. *-commutative3.7%

        \[\leadsto x1 + \left(\left(4 \cdot \left(\color{blue}{\left(x2 \cdot x1\right)} \cdot -3\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-*l*3.7%

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

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

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

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

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

    if -1.7499999999999999e75 < x1 < -2.1999999999999998e-19 or 2.0999999999999999e-52 < x1

    1. Initial program 63.2%

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 43.7%

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

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

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

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

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

    if -2.1999999999999998e-19 < x1 < -9.1999999999999995e-179

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 53.4%

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

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

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

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

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

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

        \[\leadsto x1 + \left(x1 + \frac{3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right) - x1\right)}{\color{blue}{x1 \cdot x1} + 1}\right) \]
      7. fma-udef53.4%

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

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

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

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

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

    if -9.1999999999999995e-179 < x1 < 2.0999999999999999e-52

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 65.2%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.75 \cdot 10^{+75}:\\ \;\;\;\;x1 + x1 \cdot \left(1 + x2 \cdot -12\right)\\ \mathbf{elif}\;x1 \leq -2.2 \cdot 10^{-19}:\\ \;\;\;\;x1 + x1 \cdot \left(\left(x2 \cdot x2\right) \cdot 8\right)\\ \mathbf{elif}\;x1 \leq -9.2 \cdot 10^{-179}:\\ \;\;\;\;x1 + x1 \cdot -2\\ \mathbf{elif}\;x1 \leq 2.1 \cdot 10^{-52}:\\ \;\;\;\;x2 \cdot -6\\ \mathbf{else}:\\ \;\;\;\;x1 + x1 \cdot \left(\left(x2 \cdot x2\right) \cdot 8\right)\\ \end{array} \]

Alternative 19: 37.6% accurate, 9.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq -9.2 \cdot 10^{-179}:\\ \;\;\;\;x1 + x1 \cdot -2\\ \mathbf{elif}\;x1 \leq 1.6 \cdot 10^{-64}:\\ \;\;\;\;x2 \cdot -6\\ \mathbf{else}:\\ \;\;\;\;x1 + x1 \cdot \left(\left(x2 \cdot x2\right) \cdot 8\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (<= x1 -9.2e-179)
   (+ x1 (* x1 -2.0))
   (if (<= x1 1.6e-64) (* x2 -6.0) (+ x1 (* x1 (* (* x2 x2) 8.0))))))
double code(double x1, double x2) {
	double tmp;
	if (x1 <= -9.2e-179) {
		tmp = x1 + (x1 * -2.0);
	} else if (x1 <= 1.6e-64) {
		tmp = x2 * -6.0;
	} else {
		tmp = x1 + (x1 * ((x2 * x2) * 8.0));
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if (x1 <= (-9.2d-179)) then
        tmp = x1 + (x1 * (-2.0d0))
    else if (x1 <= 1.6d-64) then
        tmp = x2 * (-6.0d0)
    else
        tmp = x1 + (x1 * ((x2 * x2) * 8.0d0))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if (x1 <= -9.2e-179) {
		tmp = x1 + (x1 * -2.0);
	} else if (x1 <= 1.6e-64) {
		tmp = x2 * -6.0;
	} else {
		tmp = x1 + (x1 * ((x2 * x2) * 8.0));
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if x1 <= -9.2e-179:
		tmp = x1 + (x1 * -2.0)
	elif x1 <= 1.6e-64:
		tmp = x2 * -6.0
	else:
		tmp = x1 + (x1 * ((x2 * x2) * 8.0))
	return tmp
function code(x1, x2)
	tmp = 0.0
	if (x1 <= -9.2e-179)
		tmp = Float64(x1 + Float64(x1 * -2.0));
	elseif (x1 <= 1.6e-64)
		tmp = Float64(x2 * -6.0);
	else
		tmp = Float64(x1 + Float64(x1 * Float64(Float64(x2 * x2) * 8.0)));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if (x1 <= -9.2e-179)
		tmp = x1 + (x1 * -2.0);
	elseif (x1 <= 1.6e-64)
		tmp = x2 * -6.0;
	else
		tmp = x1 + (x1 * ((x2 * x2) * 8.0));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[LessEqual[x1, -9.2e-179], N[(x1 + N[(x1 * -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 1.6e-64], N[(x2 * -6.0), $MachinePrecision], N[(x1 + N[(x1 * N[(N[(x2 * x2), $MachinePrecision] * 8.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -9.2 \cdot 10^{-179}:\\
\;\;\;\;x1 + x1 \cdot -2\\

\mathbf{elif}\;x1 \leq 1.6 \cdot 10^{-64}:\\
\;\;\;\;x2 \cdot -6\\

\mathbf{else}:\\
\;\;\;\;x1 + x1 \cdot \left(\left(x2 \cdot x2\right) \cdot 8\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -9.1999999999999995e-179

    1. Initial program 50.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 31.1%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 13.9%

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

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

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

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

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

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

        \[\leadsto x1 + \left(x1 + \frac{3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right) - x1\right)}{\color{blue}{x1 \cdot x1} + 1}\right) \]
      7. fma-udef13.9%

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

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

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

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

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

    if -9.1999999999999995e-179 < x1 < 1.59999999999999988e-64

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 65.2%

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

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

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

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

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

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

    if 1.59999999999999988e-64 < x1

    1. Initial program 54.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 27.3%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 45.4%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -9.2 \cdot 10^{-179}:\\ \;\;\;\;x1 + x1 \cdot -2\\ \mathbf{elif}\;x1 \leq 1.6 \cdot 10^{-64}:\\ \;\;\;\;x2 \cdot -6\\ \mathbf{else}:\\ \;\;\;\;x1 + x1 \cdot \left(\left(x2 \cdot x2\right) \cdot 8\right)\\ \end{array} \]

Alternative 20: 31.3% accurate, 13.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x2 \leq -1.15 \cdot 10^{-173}:\\ \;\;\;\;x2 \cdot -6\\ \mathbf{elif}\;x2 \leq 1.85 \cdot 10^{-73}:\\ \;\;\;\;x1 + x1 \cdot -2\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (<= x2 -1.15e-173)
   (* x2 -6.0)
   (if (<= x2 1.85e-73) (+ x1 (* x1 -2.0)) (* x2 -6.0))))
double code(double x1, double x2) {
	double tmp;
	if (x2 <= -1.15e-173) {
		tmp = x2 * -6.0;
	} else if (x2 <= 1.85e-73) {
		tmp = x1 + (x1 * -2.0);
	} else {
		tmp = x2 * -6.0;
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if (x2 <= (-1.15d-173)) then
        tmp = x2 * (-6.0d0)
    else if (x2 <= 1.85d-73) then
        tmp = x1 + (x1 * (-2.0d0))
    else
        tmp = x2 * (-6.0d0)
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if (x2 <= -1.15e-173) {
		tmp = x2 * -6.0;
	} else if (x2 <= 1.85e-73) {
		tmp = x1 + (x1 * -2.0);
	} else {
		tmp = x2 * -6.0;
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if x2 <= -1.15e-173:
		tmp = x2 * -6.0
	elif x2 <= 1.85e-73:
		tmp = x1 + (x1 * -2.0)
	else:
		tmp = x2 * -6.0
	return tmp
function code(x1, x2)
	tmp = 0.0
	if (x2 <= -1.15e-173)
		tmp = Float64(x2 * -6.0);
	elseif (x2 <= 1.85e-73)
		tmp = Float64(x1 + Float64(x1 * -2.0));
	else
		tmp = Float64(x2 * -6.0);
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if (x2 <= -1.15e-173)
		tmp = x2 * -6.0;
	elseif (x2 <= 1.85e-73)
		tmp = x1 + (x1 * -2.0);
	else
		tmp = x2 * -6.0;
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[LessEqual[x2, -1.15e-173], N[(x2 * -6.0), $MachinePrecision], If[LessEqual[x2, 1.85e-73], N[(x1 + N[(x1 * -2.0), $MachinePrecision]), $MachinePrecision], N[(x2 * -6.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x2 \leq -1.15 \cdot 10^{-173}:\\
\;\;\;\;x2 \cdot -6\\

\mathbf{elif}\;x2 \leq 1.85 \cdot 10^{-73}:\\
\;\;\;\;x1 + x1 \cdot -2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x2 < -1.14999999999999994e-173 or 1.85e-73 < x2

    1. Initial program 65.2%

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 29.0%

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

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

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

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

        \[\leadsto \color{blue}{x2 \cdot -6} \]
    8. Simplified28.9%

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

    if -1.14999999999999994e-173 < x2 < 1.85e-73

    1. Initial program 71.2%

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 37.3%

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

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

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

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

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

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

        \[\leadsto x1 + \left(x1 + \frac{3 \cdot \left(x1 \cdot \left(x1 \cdot 3\right) - x1\right)}{\color{blue}{x1 \cdot x1} + 1}\right) \]
      7. fma-udef37.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x2 \leq -1.15 \cdot 10^{-173}:\\ \;\;\;\;x2 \cdot -6\\ \mathbf{elif}\;x2 \leq 1.85 \cdot 10^{-73}:\\ \;\;\;\;x1 + x1 \cdot -2\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6\\ \end{array} \]

Alternative 21: 31.6% accurate, 13.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x2 \leq -1.05 \cdot 10^{-173}:\\ \;\;\;\;x2 \cdot -6\\ \mathbf{elif}\;x2 \leq 5.2 \cdot 10^{-83}:\\ \;\;\;\;x1 + x1 \cdot -2\\ \mathbf{else}:\\ \;\;\;\;x1 + x2 \cdot -6\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (<= x2 -1.05e-173)
   (* x2 -6.0)
   (if (<= x2 5.2e-83) (+ x1 (* x1 -2.0)) (+ x1 (* x2 -6.0)))))
double code(double x1, double x2) {
	double tmp;
	if (x2 <= -1.05e-173) {
		tmp = x2 * -6.0;
	} else if (x2 <= 5.2e-83) {
		tmp = x1 + (x1 * -2.0);
	} else {
		tmp = x1 + (x2 * -6.0);
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if (x2 <= (-1.05d-173)) then
        tmp = x2 * (-6.0d0)
    else if (x2 <= 5.2d-83) then
        tmp = x1 + (x1 * (-2.0d0))
    else
        tmp = x1 + (x2 * (-6.0d0))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if (x2 <= -1.05e-173) {
		tmp = x2 * -6.0;
	} else if (x2 <= 5.2e-83) {
		tmp = x1 + (x1 * -2.0);
	} else {
		tmp = x1 + (x2 * -6.0);
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if x2 <= -1.05e-173:
		tmp = x2 * -6.0
	elif x2 <= 5.2e-83:
		tmp = x1 + (x1 * -2.0)
	else:
		tmp = x1 + (x2 * -6.0)
	return tmp
function code(x1, x2)
	tmp = 0.0
	if (x2 <= -1.05e-173)
		tmp = Float64(x2 * -6.0);
	elseif (x2 <= 5.2e-83)
		tmp = Float64(x1 + Float64(x1 * -2.0));
	else
		tmp = Float64(x1 + Float64(x2 * -6.0));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if (x2 <= -1.05e-173)
		tmp = x2 * -6.0;
	elseif (x2 <= 5.2e-83)
		tmp = x1 + (x1 * -2.0);
	else
		tmp = x1 + (x2 * -6.0);
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[LessEqual[x2, -1.05e-173], N[(x2 * -6.0), $MachinePrecision], If[LessEqual[x2, 5.2e-83], N[(x1 + N[(x1 * -2.0), $MachinePrecision]), $MachinePrecision], N[(x1 + N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x2 \leq -1.05 \cdot 10^{-173}:\\
\;\;\;\;x2 \cdot -6\\

\mathbf{elif}\;x2 \leq 5.2 \cdot 10^{-83}:\\
\;\;\;\;x1 + x1 \cdot -2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x2 < -1.05000000000000001e-173

    1. Initial program 65.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 45.5%

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

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

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

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

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

        \[\leadsto \color{blue}{x2 \cdot -6} \]
    8. Simplified31.9%

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

    if -1.05000000000000001e-173 < x2 < 5.20000000000000018e-83

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

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 38.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.20000000000000018e-83 < x2

    1. Initial program 63.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 40.7%

      \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 25.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x2 \leq -1.05 \cdot 10^{-173}:\\ \;\;\;\;x2 \cdot -6\\ \mathbf{elif}\;x2 \leq 5.2 \cdot 10^{-83}:\\ \;\;\;\;x1 + x1 \cdot -2\\ \mathbf{else}:\\ \;\;\;\;x1 + x2 \cdot -6\\ \end{array} \]

Alternative 22: 26.1% accurate, 42.3× speedup?

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

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

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

    \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 23.9%

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

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

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

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

      \[\leadsto \color{blue}{x2 \cdot -6} \]
  8. Simplified23.9%

    \[\leadsto \color{blue}{x2 \cdot -6} \]
  9. Final simplification23.9%

    \[\leadsto x2 \cdot -6 \]

Alternative 23: 3.3% accurate, 127.0× speedup?

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

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

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

    \[\leadsto x1 + \left(\left(\color{blue}{4 \cdot \left(x1 \cdot \left(x2 \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 23.9%

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

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

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

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

    \[\leadsto x1 \]

Reproduce

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