Rosa's FloatVsDoubleBenchmark

Percentage Accurate: 69.4% → 99.3%
Time: 19.0s
Alternatives: 19
Speedup: 5.1×

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 19 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.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.3% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 99.4%

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

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

    1. Initial program 0.0%

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

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

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

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

Alternative 2: 98.3% accurate, 1.0× speedup?

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

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

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

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


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

    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. Simplified20.6%

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

      \[\leadsto \color{blue}{6 \cdot {x1}^{4}} \]

    if -5.60000000000000037e102 < x1 < 5.00000000000000018e153

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

Alternative 3: 96.8% accurate, 1.1× speedup?

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

\mathbf{else}:\\
\;\;\;\;x1 + \left(3 \cdot \frac{\left(t\_0 - 2 \cdot x2\right) - x1}{t\_1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(t\_0 \cdot t\_2 + t\_1 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot 6\right)\right)\right)\right)\right)\\


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

    1. Initial program 17.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. Simplified26.2%

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

      \[\leadsto \color{blue}{6 \cdot {x1}^{4}} \]

    if -5e102 < x1 < 3.0000000000000002e64

    1. Initial program 99.4%

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

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

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

Alternative 4: 96.8% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x1 \cdot \left(x1 \cdot 3\right)\\ t_1 := x1 \cdot x1 + 1\\ t_2 := \frac{\left(t\_0 + 2 \cdot x2\right) - x1}{t\_1}\\ \mathbf{if}\;x1 \leq -5 \cdot 10^{+101} \lor \neg \left(x1 \leq 3 \cdot 10^{+64}\right):\\ \;\;\;\;6 \cdot {x1}^{4}\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(3 \cdot \frac{\left(t\_0 - 2 \cdot x2\right) - x1}{t\_1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot t\_0 + t\_1 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot 6\right)\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (let* ((t_0 (* x1 (* x1 3.0)))
        (t_1 (+ (* x1 x1) 1.0))
        (t_2 (/ (- (+ t_0 (* 2.0 x2)) x1) t_1)))
   (if (or (<= x1 -5e+101) (not (<= x1 3e+64)))
     (* 6.0 (pow x1 4.0))
     (+
      x1
      (+
       (* 3.0 (/ (- (- t_0 (* 2.0 x2)) x1) t_1))
       (+
        x1
        (+
         (* x1 (* x1 x1))
         (+
          (* 3.0 t_0)
          (*
           t_1
           (+ (* (* (* x1 2.0) t_2) (- t_2 3.0)) (* (* x1 x1) 6.0)))))))))))
double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = (x1 * x1) + 1.0;
	double t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	double tmp;
	if ((x1 <= -5e+101) || !(x1 <= 3e+64)) {
		tmp = 6.0 * pow(x1, 4.0);
	} else {
		tmp = x1 + ((3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_1 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * 6.0)))))));
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = x1 * (x1 * 3.0d0)
    t_1 = (x1 * x1) + 1.0d0
    t_2 = ((t_0 + (2.0d0 * x2)) - x1) / t_1
    if ((x1 <= (-5d+101)) .or. (.not. (x1 <= 3d+64))) then
        tmp = 6.0d0 * (x1 ** 4.0d0)
    else
        tmp = x1 + ((3.0d0 * (((t_0 - (2.0d0 * x2)) - x1) / t_1)) + (x1 + ((x1 * (x1 * x1)) + ((3.0d0 * t_0) + (t_1 * ((((x1 * 2.0d0) * t_2) * (t_2 - 3.0d0)) + ((x1 * x1) * 6.0d0)))))))
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double t_0 = x1 * (x1 * 3.0);
	double t_1 = (x1 * x1) + 1.0;
	double t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	double tmp;
	if ((x1 <= -5e+101) || !(x1 <= 3e+64)) {
		tmp = 6.0 * Math.pow(x1, 4.0);
	} else {
		tmp = x1 + ((3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_1 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * 6.0)))))));
	}
	return tmp;
}
def code(x1, x2):
	t_0 = x1 * (x1 * 3.0)
	t_1 = (x1 * x1) + 1.0
	t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1
	tmp = 0
	if (x1 <= -5e+101) or not (x1 <= 3e+64):
		tmp = 6.0 * math.pow(x1, 4.0)
	else:
		tmp = x1 + ((3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_1 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * 6.0)))))))
	return tmp
function code(x1, x2)
	t_0 = Float64(x1 * Float64(x1 * 3.0))
	t_1 = Float64(Float64(x1 * x1) + 1.0)
	t_2 = Float64(Float64(Float64(t_0 + Float64(2.0 * x2)) - x1) / t_1)
	tmp = 0.0
	if ((x1 <= -5e+101) || !(x1 <= 3e+64))
		tmp = Float64(6.0 * (x1 ^ 4.0));
	else
		tmp = Float64(x1 + Float64(Float64(3.0 * Float64(Float64(Float64(t_0 - Float64(2.0 * x2)) - x1) / t_1)) + Float64(x1 + Float64(Float64(x1 * Float64(x1 * x1)) + Float64(Float64(3.0 * t_0) + Float64(t_1 * Float64(Float64(Float64(Float64(x1 * 2.0) * t_2) * Float64(t_2 - 3.0)) + Float64(Float64(x1 * x1) * 6.0))))))));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	t_0 = x1 * (x1 * 3.0);
	t_1 = (x1 * x1) + 1.0;
	t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
	tmp = 0.0;
	if ((x1 <= -5e+101) || ~((x1 <= 3e+64)))
		tmp = 6.0 * (x1 ^ 4.0);
	else
		tmp = x1 + ((3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)) + (x1 + ((x1 * (x1 * x1)) + ((3.0 * t_0) + (t_1 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * 6.0)))))));
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := Block[{t$95$0 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$0 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[Or[LessEqual[x1, -5e+101], N[Not[LessEqual[x1, 3e+64]], $MachinePrecision]], N[(6.0 * N[Power[x1, 4.0], $MachinePrecision]), $MachinePrecision], N[(x1 + N[(N[(3.0 * N[(N[(N[(t$95$0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(x1 + N[(N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + N[(N[(3.0 * t$95$0), $MachinePrecision] + N[(t$95$1 * N[(N[(N[(N[(x1 * 2.0), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(t$95$2 - 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;x1 + \left(3 \cdot \frac{\left(t\_0 - 2 \cdot x2\right) - x1}{t\_1} + \left(x1 + \left(x1 \cdot \left(x1 \cdot x1\right) + \left(3 \cdot t\_0 + t\_1 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot 6\right)\right)\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -4.99999999999999989e101 or 3.0000000000000002e64 < x1

    1. Initial program 17.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. Simplified26.2%

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

      \[\leadsto \color{blue}{6 \cdot {x1}^{4}} \]

    if -4.99999999999999989e101 < x1 < 3.0000000000000002e64

    1. Initial program 99.4%

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

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

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

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

Alternative 5: 95.3% accurate, 1.3× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;x1 + t\_1\\


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

    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. Simplified20.6%

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

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

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

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

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

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

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

    if -5.60000000000000037e102 < x1 < 5.00000000000000018e153

    1. Initial program 99.4%

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

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

      \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot 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 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 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. Simplified0.0%

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

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

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

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

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

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

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

Alternative 6: 74.7% accurate, 3.4× speedup?

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

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

\mathbf{elif}\;x1 \leq -9.5 \cdot 10^{-226}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x1 \leq 2.1 \cdot 10^{-230}:\\
\;\;\;\;x2 \cdot \left(\left(-6\right) - \frac{x1}{x2}\right)\\

\mathbf{elif}\;x1 \leq 2.05 \cdot 10^{+106}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x1 < -1.24999999999999997e101 or 2.0500000000000001e106 < x1

    1. Initial program 9.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. Simplified19.2%

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

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

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

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

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

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

    if -1.24999999999999997e101 < x1 < -9.5000000000000007e-226 or 2.0999999999999998e-230 < x1 < 2.0500000000000001e106

    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. Simplified91.0%

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

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

    if -9.5000000000000007e-226 < x1 < 2.0999999999999998e-230

    1. Initial program 99.7%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-6, x2, x1 \cdot \mathsf{fma}\left(x2 \cdot -4, 3 + \color{blue}{\left(-2\right)} \cdot x2, -1\right)\right) \]
      6. cancel-sign-sub-inv69.8%

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

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

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

      \[\leadsto \mathsf{fma}\left(-6, x2, x1 \cdot \color{blue}{-1}\right) \]
    8. Taylor expanded in x2 around -inf 95.0%

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

        \[\leadsto \color{blue}{-x2 \cdot \left(6 + \frac{x1}{x2}\right)} \]
      2. *-commutative95.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.25 \cdot 10^{+101}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9 - 2\right)\\ \mathbf{elif}\;x1 \leq -9.5 \cdot 10^{-226}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + -4 \cdot \left(x2 \cdot \left(3 + x2 \cdot -2\right)\right)\right)\\ \mathbf{elif}\;x1 \leq 2.1 \cdot 10^{-230}:\\ \;\;\;\;x2 \cdot \left(\left(-6\right) - \frac{x1}{x2}\right)\\ \mathbf{elif}\;x1 \leq 2.05 \cdot 10^{+106}:\\ \;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + -4 \cdot \left(x2 \cdot \left(3 + x2 \cdot -2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9 - 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 83.0% accurate, 4.2× speedup?

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

\\
\begin{array}{l}
t_0 := x1 \cdot \left(x1 \cdot 9 - 2\right)\\
\mathbf{if}\;x1 \leq -1.5 \cdot 10^{+99}:\\
\;\;\;\;x1 + x2 \cdot \left(\left(x1 \cdot -12 + \frac{t\_0}{x2}\right) - 6\right)\\

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


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

    1. Initial program 2.9%

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

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

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

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

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

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

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

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

    if -1.50000000000000007e99 < x1

    1. Initial program 85.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. Simplified75.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.5 \cdot 10^{+99}:\\ \;\;\;\;x1 + x2 \cdot \left(\left(x1 \cdot -12 + \frac{x1 \cdot \left(x1 \cdot 9 - 2\right)}{x2}\right) - 6\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x2 \cdot -6 + \left(x1 \cdot \left(x1 \cdot 9 - 2\right) + x2 \cdot \left(x1 \cdot -12 + 8 \cdot \left(x1 \cdot x2\right)\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 82.7% accurate, 4.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -1.5 \cdot 10^{+99} \lor \neg \left(x1 \leq 8.5 \cdot 10^{+16}\right):\\
\;\;\;\;x1 + x2 \cdot \left(\left(x1 \cdot -12 + \frac{x1 \cdot \left(x1 \cdot 9 - 2\right)}{x2}\right) - 6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -1.50000000000000007e99 or 8.5e16 < x1

    1. Initial program 26.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. Simplified33.3%

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

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

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

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

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

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

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

    if -1.50000000000000007e99 < x1 < 8.5e16

    1. Initial program 99.4%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-6, x2, x1 \cdot \mathsf{fma}\left(x2 \cdot -4, 3 + \color{blue}{\left(-2\right)} \cdot x2, -1\right)\right) \]
      6. cancel-sign-sub-inv76.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.5 \cdot 10^{+99} \lor \neg \left(x1 \leq 8.5 \cdot 10^{+16}\right):\\ \;\;\;\;x1 + x2 \cdot \left(\left(x1 \cdot -12 + \frac{x1 \cdot \left(x1 \cdot 9 - 2\right)}{x2}\right) - 6\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot \left(\left(x1 \cdot -12 + 8 \cdot \left(x1 \cdot x2\right)\right) - 6\right) - x1\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 83.0% accurate, 4.9× speedup?

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

\\
\begin{array}{l}
t_0 := x1 \cdot \left(x1 \cdot 9 - 2\right)\\
\mathbf{if}\;x1 \leq -1.5 \cdot 10^{+99}:\\
\;\;\;\;x1 + x2 \cdot \left(\left(x1 \cdot -12 + \frac{t\_0}{x2}\right) - 6\right)\\

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


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

    1. Initial program 2.9%

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

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

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

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

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

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

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

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

    if -1.50000000000000007e99 < x1

    1. Initial program 85.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. Simplified75.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -1.5 \cdot 10^{+99}:\\ \;\;\;\;x1 + x2 \cdot \left(\left(x1 \cdot -12 + \frac{x1 \cdot \left(x1 \cdot 9 - 2\right)}{x2}\right) - 6\right)\\ \mathbf{else}:\\ \;\;\;\;x1 + \left(x2 \cdot -6 + \left(x1 \cdot \left(x1 \cdot 9 - 2\right) + x2 \cdot \left(8 \cdot \left(x1 \cdot x2\right)\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 78.9% accurate, 5.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -4.5 \cdot 10^{+99} \lor \neg \left(x1 \leq 2.05 \cdot 10^{+106}\right):\\
\;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9 - 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -4.5e99 or 2.0500000000000001e106 < x1

    1. Initial program 9.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. Simplified19.2%

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

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

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

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

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

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

    if -4.5e99 < x1 < 2.0500000000000001e106

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -4.5 \cdot 10^{+99} \lor \neg \left(x1 \leq 2.05 \cdot 10^{+106}\right):\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9 - 2\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot \left(\left(x1 \cdot -12 + 8 \cdot \left(x1 \cdot x2\right)\right) - 6\right) - x1\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 64.7% accurate, 6.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -2.2 \cdot 10^{+163} \lor \neg \left(x1 \leq 7.4 \cdot 10^{-34}\right):\\
\;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9 - 2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -2.19999999999999986e163 or 7.39999999999999976e-34 < x1

    1. Initial program 33.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. Simplified31.9%

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

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

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

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

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

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

    if -2.19999999999999986e163 < x1 < 7.39999999999999976e-34

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-6, x2, x1 \cdot \mathsf{fma}\left(x2 \cdot -4, 3 + \color{blue}{\left(-2\right)} \cdot x2, -1\right)\right) \]
      6. cancel-sign-sub-inv72.8%

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

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

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

      \[\leadsto \mathsf{fma}\left(-6, x2, x1 \cdot \color{blue}{-1}\right) \]
    8. Taylor expanded in x2 around -inf 62.4%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -2.2 \cdot 10^{+163} \lor \neg \left(x1 \leq 7.4 \cdot 10^{-34}\right):\\ \;\;\;\;x1 + x1 \cdot \left(x1 \cdot 9 - 2\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot \left(\left(-6\right) - \frac{x1}{x2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 50.3% accurate, 7.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x2 \leq -2.75 \cdot 10^{+17} \lor \neg \left(x2 \leq 1.8 \cdot 10^{+15}\right):\\
\;\;\;\;x2 \cdot \left(x1 \cdot -12 - 6\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x2 < -2.75e17 or 1.8e15 < x2

    1. Initial program 71.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. Simplified58.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{-12 \cdot \left(x1 \cdot x2\right) + -1 \cdot x1}\right) \]
    8. Step-by-step derivation
      1. fma-define37.2%

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

        \[\leadsto \mathsf{fma}\left(-6, x2, \mathsf{fma}\left(-12, x1 \cdot x2, \color{blue}{-x1}\right)\right) \]
      3. fmm-undef37.2%

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

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{\left(x1 \cdot x2\right) \cdot -12} - x1\right) \]
    9. Simplified37.2%

      \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{\left(x1 \cdot x2\right) \cdot -12 - x1}\right) \]
    10. Taylor expanded in x2 around inf 37.2%

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

    if -2.75e17 < x2 < 1.8e15

    1. Initial program 75.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. Simplified76.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-6, x2, x1 \cdot \color{blue}{-1}\right) \]
    8. Taylor expanded in x2 around -inf 63.1%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x2 \leq -2.75 \cdot 10^{+17} \lor \neg \left(x2 \leq 1.8 \cdot 10^{+15}\right):\\ \;\;\;\;x2 \cdot \left(x1 \cdot -12 - 6\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot \left(\left(-6\right) - \frac{x1}{x2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 66.1% accurate, 7.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x2 < 6.5999999999999996e117

    1. Initial program 74.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. Simplified73.6%

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

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

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

    if 6.5999999999999996e117 < x2

    1. Initial program 70.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. Simplified44.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 44.3% accurate, 7.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -0.00021 \lor \neg \left(x1 \leq 7.4 \cdot 10^{-34}\right):\\
\;\;\;\;x1 \cdot \left(-1 + x2 \cdot -12\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x1 < -2.1000000000000001e-4 or 7.39999999999999976e-34 < x1

    1. Initial program 44.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. Simplified47.8%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-6, x2, x1 \cdot \mathsf{fma}\left(x2 \cdot -4, 3 + \color{blue}{\left(-2\right)} \cdot x2, -1\right)\right) \]
      6. cancel-sign-sub-inv25.8%

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

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

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

      \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{-12 \cdot \left(x1 \cdot x2\right) + -1 \cdot x1}\right) \]
    8. Step-by-step derivation
      1. fma-define16.2%

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

        \[\leadsto \mathsf{fma}\left(-6, x2, \mathsf{fma}\left(-12, x1 \cdot x2, \color{blue}{-x1}\right)\right) \]
      3. fmm-undef16.2%

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

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{\left(x1 \cdot x2\right) \cdot -12} - x1\right) \]
    9. Simplified16.2%

      \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{\left(x1 \cdot x2\right) \cdot -12 - x1}\right) \]
    10. Taylor expanded in x1 around inf 16.2%

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

    if -2.1000000000000001e-4 < x1 < 7.39999999999999976e-34

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-6, x2, x1 \cdot \color{blue}{-1}\right) \]
    8. Taylor expanded in x2 around 0 73.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -0.00021 \lor \neg \left(x1 \leq 7.4 \cdot 10^{-34}\right):\\ \;\;\;\;x1 \cdot \left(-1 + x2 \cdot -12\right)\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot -6 - x1\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 44.7% accurate, 7.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x1 \leq -0.0062:\\ \;\;\;\;x1 \cdot \left(-1 + x2 \cdot -12\right)\\ \mathbf{elif}\;x1 \leq 4500000:\\ \;\;\;\;x2 \cdot -6 - x1\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot \left(x1 \cdot -12 - 6\right)\\ \end{array} \end{array} \]
(FPCore (x1 x2)
 :precision binary64
 (if (<= x1 -0.0062)
   (* x1 (+ -1.0 (* x2 -12.0)))
   (if (<= x1 4500000.0) (- (* x2 -6.0) x1) (* x2 (- (* x1 -12.0) 6.0)))))
double code(double x1, double x2) {
	double tmp;
	if (x1 <= -0.0062) {
		tmp = x1 * (-1.0 + (x2 * -12.0));
	} else if (x1 <= 4500000.0) {
		tmp = (x2 * -6.0) - x1;
	} else {
		tmp = x2 * ((x1 * -12.0) - 6.0);
	}
	return tmp;
}
real(8) function code(x1, x2)
    real(8), intent (in) :: x1
    real(8), intent (in) :: x2
    real(8) :: tmp
    if (x1 <= (-0.0062d0)) then
        tmp = x1 * ((-1.0d0) + (x2 * (-12.0d0)))
    else if (x1 <= 4500000.0d0) then
        tmp = (x2 * (-6.0d0)) - x1
    else
        tmp = x2 * ((x1 * (-12.0d0)) - 6.0d0)
    end if
    code = tmp
end function
public static double code(double x1, double x2) {
	double tmp;
	if (x1 <= -0.0062) {
		tmp = x1 * (-1.0 + (x2 * -12.0));
	} else if (x1 <= 4500000.0) {
		tmp = (x2 * -6.0) - x1;
	} else {
		tmp = x2 * ((x1 * -12.0) - 6.0);
	}
	return tmp;
}
def code(x1, x2):
	tmp = 0
	if x1 <= -0.0062:
		tmp = x1 * (-1.0 + (x2 * -12.0))
	elif x1 <= 4500000.0:
		tmp = (x2 * -6.0) - x1
	else:
		tmp = x2 * ((x1 * -12.0) - 6.0)
	return tmp
function code(x1, x2)
	tmp = 0.0
	if (x1 <= -0.0062)
		tmp = Float64(x1 * Float64(-1.0 + Float64(x2 * -12.0)));
	elseif (x1 <= 4500000.0)
		tmp = Float64(Float64(x2 * -6.0) - x1);
	else
		tmp = Float64(x2 * Float64(Float64(x1 * -12.0) - 6.0));
	end
	return tmp
end
function tmp_2 = code(x1, x2)
	tmp = 0.0;
	if (x1 <= -0.0062)
		tmp = x1 * (-1.0 + (x2 * -12.0));
	elseif (x1 <= 4500000.0)
		tmp = (x2 * -6.0) - x1;
	else
		tmp = x2 * ((x1 * -12.0) - 6.0);
	end
	tmp_2 = tmp;
end
code[x1_, x2_] := If[LessEqual[x1, -0.0062], N[(x1 * N[(-1.0 + N[(x2 * -12.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x1, 4500000.0], N[(N[(x2 * -6.0), $MachinePrecision] - x1), $MachinePrecision], N[(x2 * N[(N[(x1 * -12.0), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -0.0062:\\
\;\;\;\;x1 \cdot \left(-1 + x2 \cdot -12\right)\\

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

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


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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{-12 \cdot \left(x1 \cdot x2\right) + -1 \cdot x1}\right) \]
    8. Step-by-step derivation
      1. fma-define19.4%

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{\mathsf{fma}\left(-12, x1 \cdot x2, -1 \cdot x1\right)}\right) \]
      2. mul-1-neg19.4%

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

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{-12 \cdot \left(x1 \cdot x2\right) - x1}\right) \]
      4. *-commutative19.4%

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{\left(x1 \cdot x2\right) \cdot -12} - x1\right) \]
    9. Simplified19.4%

      \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{\left(x1 \cdot x2\right) \cdot -12 - x1}\right) \]
    10. Taylor expanded in x1 around inf 19.5%

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

    if -0.00619999999999999978 < x1 < 4.5e6

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-6, x2, x1 \cdot \color{blue}{-1}\right) \]
    8. Taylor expanded in x2 around 0 71.1%

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

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

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

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

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

    if 4.5e6 < x1

    1. Initial program 41.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. Simplified39.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{-12 \cdot \left(x1 \cdot x2\right) + -1 \cdot x1}\right) \]
    8. Step-by-step derivation
      1. fma-define11.7%

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{\mathsf{fma}\left(-12, x1 \cdot x2, -1 \cdot x1\right)}\right) \]
      2. mul-1-neg11.7%

        \[\leadsto \mathsf{fma}\left(-6, x2, \mathsf{fma}\left(-12, x1 \cdot x2, \color{blue}{-x1}\right)\right) \]
      3. fmm-undef11.7%

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{-12 \cdot \left(x1 \cdot x2\right) - x1}\right) \]
      4. *-commutative11.7%

        \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{\left(x1 \cdot x2\right) \cdot -12} - x1\right) \]
    9. Simplified11.7%

      \[\leadsto \mathsf{fma}\left(-6, x2, \color{blue}{\left(x1 \cdot x2\right) \cdot -12 - x1}\right) \]
    10. Taylor expanded in x2 around inf 12.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x1 \leq -0.0062:\\ \;\;\;\;x1 \cdot \left(-1 + x2 \cdot -12\right)\\ \mathbf{elif}\;x1 \leq 4500000:\\ \;\;\;\;x2 \cdot -6 - x1\\ \mathbf{else}:\\ \;\;\;\;x2 \cdot \left(x1 \cdot -12 - 6\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 31.9% accurate, 9.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x2 \leq -2.6 \cdot 10^{-124} \lor \neg \left(x2 \leq 5.3 \cdot 10^{-121}\right):\\
\;\;\;\;x2 \cdot -6\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x2 < -2.6e-124 or 5.2999999999999996e-121 < x2

    1. Initial program 72.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. Simplified63.3%

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

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

    if -2.6e-124 < x2 < 5.2999999999999996e-121

    1. Initial program 76.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. Simplified78.6%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-6, x2, x1 \cdot \mathsf{fma}\left(x2 \cdot -4, 3 + \color{blue}{\left(-2\right)} \cdot x2, -1\right)\right) \]
      6. cancel-sign-sub-inv58.5%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot x1} \]
    8. Step-by-step derivation
      1. mul-1-neg47.5%

        \[\leadsto \color{blue}{-x1} \]
    9. Simplified47.5%

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

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

Alternative 17: 64.4% accurate, 11.5× speedup?

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

\\
x2 \cdot -6 + x1 \cdot \left(x1 \cdot 9 + -1\right)
\end{array}
Derivation
  1. Initial program 73.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. Simplified67.8%

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

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

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

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

Alternative 18: 38.7% accurate, 25.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{fma}\left(-6, x2, x1 \cdot \color{blue}{-1}\right) \]
  8. Taylor expanded in x2 around 0 41.2%

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

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

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

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

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

Alternative 19: 14.5% accurate, 63.5× speedup?

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

\\
-x1
\end{array}
Derivation
  1. Initial program 73.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. Simplified67.8%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-1 \cdot x1} \]
  8. Step-by-step derivation
    1. mul-1-neg17.6%

      \[\leadsto \color{blue}{-x1} \]
  9. Simplified17.6%

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

Reproduce

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