
(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:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (* (* 3.0 x1) x1))
(t_1 (- -1.0 (* x1 x1)))
(t_2 (fma (* x1 x1) 3.0 (fma 2.0 x2 (- x1))))
(t_3 (/ t_2 (fma x1 x1 1.0)))
(t_4 (- (+ (* x2 2.0) t_0) x1))
(t_5 (+ 1.0 (* x1 x1)))
(t_6 (/ t_4 t_5)))
(if (<=
(-
x1
(-
(-
(-
(-
(* (/ t_4 t_1) t_0)
(*
t_1
(-
(* (- 3.0 t_6) (* t_6 (* 2.0 x1)))
(* (- (* 4.0 t_6) 6.0) (* x1 x1)))))
(* (* x1 x1) x1))
x1)
(* (/ (- (- t_0 (* x2 2.0)) x1) t_5) 3.0)))
INFINITY)
(fma
(/ (- (fma -2.0 x2 t_0) x1) (fma x1 x1 1.0))
3.0
(+
(fma
(fma
(fma t_3 4.0 -6.0)
(* x1 x1)
(* (- t_3 3.0) (/ (* 2.0 x1) (/ (fma x1 x1 1.0) t_2))))
(fma x1 x1 1.0)
(fma
x1
(fma
(/ (* (- (fma (* x1 x1) 3.0 (* x2 2.0)) x1) x1) (fma x1 x1 1.0))
3.0
(* x1 x1))
x1))
x1))
(+ (* (fma (fma (fma 6.0 x1 -3.0) x1 -3.0) x1 -18.0) x1) x1))))
double code(double x1, double x2) {
double t_0 = (3.0 * x1) * x1;
double t_1 = -1.0 - (x1 * x1);
double t_2 = fma((x1 * x1), 3.0, fma(2.0, x2, -x1));
double t_3 = t_2 / fma(x1, x1, 1.0);
double t_4 = ((x2 * 2.0) + t_0) - x1;
double t_5 = 1.0 + (x1 * x1);
double t_6 = t_4 / t_5;
double tmp;
if ((x1 - ((((((t_4 / t_1) * t_0) - (t_1 * (((3.0 - t_6) * (t_6 * (2.0 * x1))) - (((4.0 * t_6) - 6.0) * (x1 * x1))))) - ((x1 * x1) * x1)) - x1) - ((((t_0 - (x2 * 2.0)) - x1) / t_5) * 3.0))) <= ((double) INFINITY)) {
tmp = fma(((fma(-2.0, x2, t_0) - x1) / fma(x1, x1, 1.0)), 3.0, (fma(fma(fma(t_3, 4.0, -6.0), (x1 * x1), ((t_3 - 3.0) * ((2.0 * x1) / (fma(x1, x1, 1.0) / t_2)))), fma(x1, x1, 1.0), fma(x1, fma((((fma((x1 * x1), 3.0, (x2 * 2.0)) - x1) * x1) / fma(x1, x1, 1.0)), 3.0, (x1 * x1)), x1)) + x1));
} else {
tmp = (fma(fma(fma(6.0, x1, -3.0), x1, -3.0), x1, -18.0) * x1) + x1;
}
return tmp;
}
function code(x1, x2) t_0 = Float64(Float64(3.0 * x1) * x1) t_1 = Float64(-1.0 - Float64(x1 * x1)) t_2 = fma(Float64(x1 * x1), 3.0, fma(2.0, x2, Float64(-x1))) t_3 = Float64(t_2 / fma(x1, x1, 1.0)) t_4 = Float64(Float64(Float64(x2 * 2.0) + t_0) - x1) t_5 = Float64(1.0 + Float64(x1 * x1)) t_6 = Float64(t_4 / t_5) tmp = 0.0 if (Float64(x1 - Float64(Float64(Float64(Float64(Float64(Float64(t_4 / t_1) * t_0) - Float64(t_1 * Float64(Float64(Float64(3.0 - t_6) * Float64(t_6 * Float64(2.0 * x1))) - Float64(Float64(Float64(4.0 * t_6) - 6.0) * Float64(x1 * x1))))) - Float64(Float64(x1 * x1) * x1)) - x1) - Float64(Float64(Float64(Float64(t_0 - Float64(x2 * 2.0)) - x1) / t_5) * 3.0))) <= Inf) tmp = fma(Float64(Float64(fma(-2.0, x2, t_0) - x1) / fma(x1, x1, 1.0)), 3.0, Float64(fma(fma(fma(t_3, 4.0, -6.0), Float64(x1 * x1), Float64(Float64(t_3 - 3.0) * Float64(Float64(2.0 * x1) / Float64(fma(x1, x1, 1.0) / t_2)))), fma(x1, x1, 1.0), fma(x1, fma(Float64(Float64(Float64(fma(Float64(x1 * x1), 3.0, Float64(x2 * 2.0)) - x1) * x1) / fma(x1, x1, 1.0)), 3.0, Float64(x1 * x1)), x1)) + x1)); else tmp = Float64(Float64(fma(fma(fma(6.0, x1, -3.0), x1, -3.0), x1, -18.0) * x1) + x1); end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 - N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x1 * x1), $MachinePrecision] * 3.0 + N[(2.0 * x2 + (-x1)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(x2 * 2.0), $MachinePrecision] + t$95$0), $MachinePrecision] - x1), $MachinePrecision]}, Block[{t$95$5 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$4 / t$95$5), $MachinePrecision]}, If[LessEqual[N[(x1 - N[(N[(N[(N[(N[(N[(t$95$4 / t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(t$95$1 * N[(N[(N[(3.0 - t$95$6), $MachinePrecision] * N[(t$95$6 * N[(2.0 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(4.0 * t$95$6), $MachinePrecision] - 6.0), $MachinePrecision] * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(x1 * x1), $MachinePrecision] * x1), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] - N[(N[(N[(N[(t$95$0 - N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$5), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(N[(-2.0 * x2 + t$95$0), $MachinePrecision] - x1), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision] * 3.0 + N[(N[(N[(N[(t$95$3 * 4.0 + -6.0), $MachinePrecision] * N[(x1 * x1), $MachinePrecision] + N[(N[(t$95$3 - 3.0), $MachinePrecision] * N[(N[(2.0 * x1), $MachinePrecision] / N[(N[(x1 * x1 + 1.0), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x1 * x1 + 1.0), $MachinePrecision] + N[(x1 * N[(N[(N[(N[(N[(N[(x1 * x1), $MachinePrecision] * 3.0 + N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] * x1), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision] * 3.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(6.0 * x1 + -3.0), $MachinePrecision] * x1 + -3.0), $MachinePrecision] * x1 + -18.0), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(3 \cdot x1\right) \cdot x1\\
t_1 := -1 - x1 \cdot x1\\
t_2 := \mathsf{fma}\left(x1 \cdot x1, 3, \mathsf{fma}\left(2, x2, -x1\right)\right)\\
t_3 := \frac{t\_2}{\mathsf{fma}\left(x1, x1, 1\right)}\\
t_4 := \left(x2 \cdot 2 + t\_0\right) - x1\\
t_5 := 1 + x1 \cdot x1\\
t_6 := \frac{t\_4}{t\_5}\\
\mathbf{if}\;x1 - \left(\left(\left(\left(\frac{t\_4}{t\_1} \cdot t\_0 - t\_1 \cdot \left(\left(3 - t\_6\right) \cdot \left(t\_6 \cdot \left(2 \cdot x1\right)\right) - \left(4 \cdot t\_6 - 6\right) \cdot \left(x1 \cdot x1\right)\right)\right) - \left(x1 \cdot x1\right) \cdot x1\right) - x1\right) - \frac{\left(t\_0 - x2 \cdot 2\right) - x1}{t\_5} \cdot 3\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(-2, x2, t\_0\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 3, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(t\_3, 4, -6\right), x1 \cdot x1, \left(t\_3 - 3\right) \cdot \frac{2 \cdot x1}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{t\_2}}\right), \mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, \mathsf{fma}\left(\frac{\left(\mathsf{fma}\left(x1 \cdot x1, 3, x2 \cdot 2\right) - x1\right) \cdot x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 3, x1 \cdot x1\right), x1\right)\right) + x1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(6, x1, -3\right), x1, -3\right), x1, -18\right) \cdot x1 + x1\\
\end{array}
\end{array}
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.0Initial program 99.4%
Applied rewrites99.7%
Applied rewrites99.7%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6499.7
lift--.f64N/A
lift-fma.f64N/A
associate--l+N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-fma.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
Applied rewrites99.8%
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)))))) Initial program 0.0%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in x1 around 0
Applied rewrites100.0%
Taylor expanded in x2 around 0
Applied rewrites100.0%
Final simplification99.8%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (* (* 3.0 x1) x1))
(t_1 (- -1.0 (* x1 x1)))
(t_2 (- (fma (* x1 x1) 3.0 (* x2 2.0)) x1))
(t_3 (/ t_2 (fma x1 x1 1.0)))
(t_4 (- (+ (* x2 2.0) t_0) x1))
(t_5 (+ 1.0 (* x1 x1)))
(t_6 (/ t_4 t_5)))
(if (<=
(-
x1
(-
(-
(-
(-
(* (/ t_4 t_1) t_0)
(*
t_1
(-
(* (- 3.0 t_6) (* t_6 (* 2.0 x1)))
(* (- (* 4.0 t_6) 6.0) (* x1 x1)))))
(* (* x1 x1) x1))
x1)
(* (/ (- (- t_0 (* x2 2.0)) x1) t_5) 3.0)))
INFINITY)
(fma
(/ (- (fma -2.0 x2 t_0) x1) (fma x1 x1 1.0))
3.0
(+
(fma
(fma (fma t_3 4.0 -6.0) (* x1 x1) (* (* t_3 (* 2.0 x1)) (- t_3 3.0)))
(fma x1 x1 1.0)
(fma x1 (fma (/ (* t_2 x1) (fma x1 x1 1.0)) 3.0 (* x1 x1)) x1))
x1))
(+ (* (fma (fma (fma 6.0 x1 -3.0) x1 -3.0) x1 -18.0) x1) x1))))
double code(double x1, double x2) {
double t_0 = (3.0 * x1) * x1;
double t_1 = -1.0 - (x1 * x1);
double t_2 = fma((x1 * x1), 3.0, (x2 * 2.0)) - x1;
double t_3 = t_2 / fma(x1, x1, 1.0);
double t_4 = ((x2 * 2.0) + t_0) - x1;
double t_5 = 1.0 + (x1 * x1);
double t_6 = t_4 / t_5;
double tmp;
if ((x1 - ((((((t_4 / t_1) * t_0) - (t_1 * (((3.0 - t_6) * (t_6 * (2.0 * x1))) - (((4.0 * t_6) - 6.0) * (x1 * x1))))) - ((x1 * x1) * x1)) - x1) - ((((t_0 - (x2 * 2.0)) - x1) / t_5) * 3.0))) <= ((double) INFINITY)) {
tmp = fma(((fma(-2.0, x2, t_0) - x1) / fma(x1, x1, 1.0)), 3.0, (fma(fma(fma(t_3, 4.0, -6.0), (x1 * x1), ((t_3 * (2.0 * x1)) * (t_3 - 3.0))), fma(x1, x1, 1.0), fma(x1, fma(((t_2 * x1) / fma(x1, x1, 1.0)), 3.0, (x1 * x1)), x1)) + x1));
} else {
tmp = (fma(fma(fma(6.0, x1, -3.0), x1, -3.0), x1, -18.0) * x1) + x1;
}
return tmp;
}
function code(x1, x2) t_0 = Float64(Float64(3.0 * x1) * x1) t_1 = Float64(-1.0 - Float64(x1 * x1)) t_2 = Float64(fma(Float64(x1 * x1), 3.0, Float64(x2 * 2.0)) - x1) t_3 = Float64(t_2 / fma(x1, x1, 1.0)) t_4 = Float64(Float64(Float64(x2 * 2.0) + t_0) - x1) t_5 = Float64(1.0 + Float64(x1 * x1)) t_6 = Float64(t_4 / t_5) tmp = 0.0 if (Float64(x1 - Float64(Float64(Float64(Float64(Float64(Float64(t_4 / t_1) * t_0) - Float64(t_1 * Float64(Float64(Float64(3.0 - t_6) * Float64(t_6 * Float64(2.0 * x1))) - Float64(Float64(Float64(4.0 * t_6) - 6.0) * Float64(x1 * x1))))) - Float64(Float64(x1 * x1) * x1)) - x1) - Float64(Float64(Float64(Float64(t_0 - Float64(x2 * 2.0)) - x1) / t_5) * 3.0))) <= Inf) tmp = fma(Float64(Float64(fma(-2.0, x2, t_0) - x1) / fma(x1, x1, 1.0)), 3.0, Float64(fma(fma(fma(t_3, 4.0, -6.0), Float64(x1 * x1), Float64(Float64(t_3 * Float64(2.0 * x1)) * Float64(t_3 - 3.0))), fma(x1, x1, 1.0), fma(x1, fma(Float64(Float64(t_2 * x1) / fma(x1, x1, 1.0)), 3.0, Float64(x1 * x1)), x1)) + x1)); else tmp = Float64(Float64(fma(fma(fma(6.0, x1, -3.0), x1, -3.0), x1, -18.0) * x1) + x1); end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 - N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x1 * x1), $MachinePrecision] * 3.0 + N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(x2 * 2.0), $MachinePrecision] + t$95$0), $MachinePrecision] - x1), $MachinePrecision]}, Block[{t$95$5 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$4 / t$95$5), $MachinePrecision]}, If[LessEqual[N[(x1 - N[(N[(N[(N[(N[(N[(t$95$4 / t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(t$95$1 * N[(N[(N[(3.0 - t$95$6), $MachinePrecision] * N[(t$95$6 * N[(2.0 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(4.0 * t$95$6), $MachinePrecision] - 6.0), $MachinePrecision] * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(x1 * x1), $MachinePrecision] * x1), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] - N[(N[(N[(N[(t$95$0 - N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$5), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(N[(-2.0 * x2 + t$95$0), $MachinePrecision] - x1), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision] * 3.0 + N[(N[(N[(N[(t$95$3 * 4.0 + -6.0), $MachinePrecision] * N[(x1 * x1), $MachinePrecision] + N[(N[(t$95$3 * N[(2.0 * x1), $MachinePrecision]), $MachinePrecision] * N[(t$95$3 - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x1 * x1 + 1.0), $MachinePrecision] + N[(x1 * N[(N[(N[(t$95$2 * x1), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision] * 3.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(6.0 * x1 + -3.0), $MachinePrecision] * x1 + -3.0), $MachinePrecision] * x1 + -18.0), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(3 \cdot x1\right) \cdot x1\\
t_1 := -1 - x1 \cdot x1\\
t_2 := \mathsf{fma}\left(x1 \cdot x1, 3, x2 \cdot 2\right) - x1\\
t_3 := \frac{t\_2}{\mathsf{fma}\left(x1, x1, 1\right)}\\
t_4 := \left(x2 \cdot 2 + t\_0\right) - x1\\
t_5 := 1 + x1 \cdot x1\\
t_6 := \frac{t\_4}{t\_5}\\
\mathbf{if}\;x1 - \left(\left(\left(\left(\frac{t\_4}{t\_1} \cdot t\_0 - t\_1 \cdot \left(\left(3 - t\_6\right) \cdot \left(t\_6 \cdot \left(2 \cdot x1\right)\right) - \left(4 \cdot t\_6 - 6\right) \cdot \left(x1 \cdot x1\right)\right)\right) - \left(x1 \cdot x1\right) \cdot x1\right) - x1\right) - \frac{\left(t\_0 - x2 \cdot 2\right) - x1}{t\_5} \cdot 3\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(-2, x2, t\_0\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 3, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(t\_3, 4, -6\right), x1 \cdot x1, \left(t\_3 \cdot \left(2 \cdot x1\right)\right) \cdot \left(t\_3 - 3\right)\right), \mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, \mathsf{fma}\left(\frac{t\_2 \cdot x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 3, x1 \cdot x1\right), x1\right)\right) + x1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(6, x1, -3\right), x1, -3\right), x1, -18\right) \cdot x1 + x1\\
\end{array}
\end{array}
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.0Initial program 99.4%
Applied rewrites99.7%
Applied rewrites99.7%
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)))))) Initial program 0.0%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in x1 around 0
Applied rewrites100.0%
Taylor expanded in x2 around 0
Applied rewrites100.0%
Final simplification99.8%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (* (* 3.0 x1) x1))
(t_1 (- -1.0 (* x1 x1)))
(t_2 (/ (- (fma (* x1 x1) 3.0 (* x2 2.0)) x1) (fma x1 x1 1.0)))
(t_3 (- (+ (* x2 2.0) t_0) x1))
(t_4 (+ 1.0 (* x1 x1)))
(t_5 (/ t_3 t_4)))
(if (<=
(-
x1
(-
(-
(-
(-
(* (/ t_3 t_1) t_0)
(*
t_1
(-
(* (- 3.0 t_5) (* t_5 (* 2.0 x1)))
(* (- (* 4.0 t_5) 6.0) (* x1 x1)))))
(* (* x1 x1) x1))
x1)
(* (/ (- (- t_0 (* x2 2.0)) x1) t_4) 3.0)))
INFINITY)
(fma
(/ (- (fma -2.0 x2 t_0) x1) (fma x1 x1 1.0))
3.0
(+
(fma
(fma
(fma t_2 4.0 -6.0)
(* x1 x1)
(*
(*
(/ 1.0 (/ (fma x1 x1 1.0) (fma (* 3.0 x1) x1 (fma x2 2.0 (- x1)))))
(* 2.0 x1))
(- t_2 3.0)))
(fma x1 x1 1.0)
(fma x1 (* x1 x1) x1))
x1))
(+ (* (fma (fma (fma 6.0 x1 -3.0) x1 -3.0) x1 -18.0) x1) x1))))
double code(double x1, double x2) {
double t_0 = (3.0 * x1) * x1;
double t_1 = -1.0 - (x1 * x1);
double t_2 = (fma((x1 * x1), 3.0, (x2 * 2.0)) - x1) / fma(x1, x1, 1.0);
double t_3 = ((x2 * 2.0) + t_0) - x1;
double t_4 = 1.0 + (x1 * x1);
double t_5 = t_3 / t_4;
double tmp;
if ((x1 - ((((((t_3 / t_1) * t_0) - (t_1 * (((3.0 - t_5) * (t_5 * (2.0 * x1))) - (((4.0 * t_5) - 6.0) * (x1 * x1))))) - ((x1 * x1) * x1)) - x1) - ((((t_0 - (x2 * 2.0)) - x1) / t_4) * 3.0))) <= ((double) INFINITY)) {
tmp = fma(((fma(-2.0, x2, t_0) - x1) / fma(x1, x1, 1.0)), 3.0, (fma(fma(fma(t_2, 4.0, -6.0), (x1 * x1), (((1.0 / (fma(x1, x1, 1.0) / fma((3.0 * x1), x1, fma(x2, 2.0, -x1)))) * (2.0 * x1)) * (t_2 - 3.0))), fma(x1, x1, 1.0), fma(x1, (x1 * x1), x1)) + x1));
} else {
tmp = (fma(fma(fma(6.0, x1, -3.0), x1, -3.0), x1, -18.0) * x1) + x1;
}
return tmp;
}
function code(x1, x2) t_0 = Float64(Float64(3.0 * x1) * x1) t_1 = Float64(-1.0 - Float64(x1 * x1)) t_2 = Float64(Float64(fma(Float64(x1 * x1), 3.0, Float64(x2 * 2.0)) - x1) / fma(x1, x1, 1.0)) t_3 = Float64(Float64(Float64(x2 * 2.0) + t_0) - x1) t_4 = Float64(1.0 + Float64(x1 * x1)) t_5 = Float64(t_3 / t_4) tmp = 0.0 if (Float64(x1 - Float64(Float64(Float64(Float64(Float64(Float64(t_3 / t_1) * t_0) - Float64(t_1 * Float64(Float64(Float64(3.0 - t_5) * Float64(t_5 * Float64(2.0 * x1))) - Float64(Float64(Float64(4.0 * t_5) - 6.0) * Float64(x1 * x1))))) - Float64(Float64(x1 * x1) * x1)) - x1) - Float64(Float64(Float64(Float64(t_0 - Float64(x2 * 2.0)) - x1) / t_4) * 3.0))) <= Inf) tmp = fma(Float64(Float64(fma(-2.0, x2, t_0) - x1) / fma(x1, x1, 1.0)), 3.0, Float64(fma(fma(fma(t_2, 4.0, -6.0), Float64(x1 * x1), Float64(Float64(Float64(1.0 / Float64(fma(x1, x1, 1.0) / fma(Float64(3.0 * x1), x1, fma(x2, 2.0, Float64(-x1))))) * Float64(2.0 * x1)) * Float64(t_2 - 3.0))), fma(x1, x1, 1.0), fma(x1, Float64(x1 * x1), x1)) + x1)); else tmp = Float64(Float64(fma(fma(fma(6.0, x1, -3.0), x1, -3.0), x1, -18.0) * x1) + x1); end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 - N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(x1 * x1), $MachinePrecision] * 3.0 + N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(x2 * 2.0), $MachinePrecision] + t$95$0), $MachinePrecision] - x1), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$3 / t$95$4), $MachinePrecision]}, If[LessEqual[N[(x1 - N[(N[(N[(N[(N[(N[(t$95$3 / t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(t$95$1 * N[(N[(N[(3.0 - t$95$5), $MachinePrecision] * N[(t$95$5 * N[(2.0 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(4.0 * t$95$5), $MachinePrecision] - 6.0), $MachinePrecision] * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(x1 * x1), $MachinePrecision] * x1), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] - N[(N[(N[(N[(t$95$0 - N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$4), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(N[(-2.0 * x2 + t$95$0), $MachinePrecision] - x1), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision] * 3.0 + N[(N[(N[(N[(t$95$2 * 4.0 + -6.0), $MachinePrecision] * N[(x1 * x1), $MachinePrecision] + N[(N[(N[(1.0 / N[(N[(x1 * x1 + 1.0), $MachinePrecision] / N[(N[(3.0 * x1), $MachinePrecision] * x1 + N[(x2 * 2.0 + (-x1)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * x1), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x1 * x1 + 1.0), $MachinePrecision] + N[(x1 * N[(x1 * x1), $MachinePrecision] + x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(6.0 * x1 + -3.0), $MachinePrecision] * x1 + -3.0), $MachinePrecision] * x1 + -18.0), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(3 \cdot x1\right) \cdot x1\\
t_1 := -1 - x1 \cdot x1\\
t_2 := \frac{\mathsf{fma}\left(x1 \cdot x1, 3, x2 \cdot 2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\\
t_3 := \left(x2 \cdot 2 + t\_0\right) - x1\\
t_4 := 1 + x1 \cdot x1\\
t_5 := \frac{t\_3}{t\_4}\\
\mathbf{if}\;x1 - \left(\left(\left(\left(\frac{t\_3}{t\_1} \cdot t\_0 - t\_1 \cdot \left(\left(3 - t\_5\right) \cdot \left(t\_5 \cdot \left(2 \cdot x1\right)\right) - \left(4 \cdot t\_5 - 6\right) \cdot \left(x1 \cdot x1\right)\right)\right) - \left(x1 \cdot x1\right) \cdot x1\right) - x1\right) - \frac{\left(t\_0 - x2 \cdot 2\right) - x1}{t\_4} \cdot 3\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(-2, x2, t\_0\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 3, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(t\_2, 4, -6\right), x1 \cdot x1, \left(\frac{1}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{\mathsf{fma}\left(3 \cdot x1, x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}} \cdot \left(2 \cdot x1\right)\right) \cdot \left(t\_2 - 3\right)\right), \mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot x1, x1\right)\right) + x1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(6, x1, -3\right), x1, -3\right), x1, -18\right) \cdot x1 + x1\\
\end{array}
\end{array}
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.0Initial program 99.4%
Applied rewrites99.7%
Applied rewrites99.7%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6499.7
lift--.f64N/A
lift-fma.f64N/A
associate--l+N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lower-fma.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
Taylor expanded in x1 around inf
unpow2N/A
lower-*.f6499.3
Applied rewrites99.3%
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)))))) Initial program 0.0%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in x1 around 0
Applied rewrites100.0%
Taylor expanded in x2 around 0
Applied rewrites100.0%
Final simplification99.6%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (* (* 3.0 x1) x1))
(t_1 (- -1.0 (* x1 x1)))
(t_2 (/ (- (fma (* x1 x1) 3.0 (* x2 2.0)) x1) (fma x1 x1 1.0)))
(t_3 (- (+ (* x2 2.0) t_0) x1))
(t_4 (+ 1.0 (* x1 x1)))
(t_5 (/ t_3 t_4)))
(if (<=
(-
x1
(-
(-
(-
(-
(* (/ t_3 t_1) t_0)
(*
t_1
(-
(* (- 3.0 t_5) (* t_5 (* 2.0 x1)))
(* (- (* 4.0 t_5) 6.0) (* x1 x1)))))
(* (* x1 x1) x1))
x1)
(* (/ (- (- t_0 (* x2 2.0)) x1) t_4) 3.0)))
INFINITY)
(fma
(/ (- (fma -2.0 x2 t_0) x1) (fma x1 x1 1.0))
3.0
(+
(fma
(fma (fma t_2 4.0 -6.0) (* x1 x1) (* (* t_2 (* 2.0 x1)) (- t_2 3.0)))
(fma x1 x1 1.0)
(fma x1 (* (* x2 x1) 6.0) x1))
x1))
(+ (* (fma (fma (fma 6.0 x1 -3.0) x1 -3.0) x1 -18.0) x1) x1))))
double code(double x1, double x2) {
double t_0 = (3.0 * x1) * x1;
double t_1 = -1.0 - (x1 * x1);
double t_2 = (fma((x1 * x1), 3.0, (x2 * 2.0)) - x1) / fma(x1, x1, 1.0);
double t_3 = ((x2 * 2.0) + t_0) - x1;
double t_4 = 1.0 + (x1 * x1);
double t_5 = t_3 / t_4;
double tmp;
if ((x1 - ((((((t_3 / t_1) * t_0) - (t_1 * (((3.0 - t_5) * (t_5 * (2.0 * x1))) - (((4.0 * t_5) - 6.0) * (x1 * x1))))) - ((x1 * x1) * x1)) - x1) - ((((t_0 - (x2 * 2.0)) - x1) / t_4) * 3.0))) <= ((double) INFINITY)) {
tmp = fma(((fma(-2.0, x2, t_0) - x1) / fma(x1, x1, 1.0)), 3.0, (fma(fma(fma(t_2, 4.0, -6.0), (x1 * x1), ((t_2 * (2.0 * x1)) * (t_2 - 3.0))), fma(x1, x1, 1.0), fma(x1, ((x2 * x1) * 6.0), x1)) + x1));
} else {
tmp = (fma(fma(fma(6.0, x1, -3.0), x1, -3.0), x1, -18.0) * x1) + x1;
}
return tmp;
}
function code(x1, x2) t_0 = Float64(Float64(3.0 * x1) * x1) t_1 = Float64(-1.0 - Float64(x1 * x1)) t_2 = Float64(Float64(fma(Float64(x1 * x1), 3.0, Float64(x2 * 2.0)) - x1) / fma(x1, x1, 1.0)) t_3 = Float64(Float64(Float64(x2 * 2.0) + t_0) - x1) t_4 = Float64(1.0 + Float64(x1 * x1)) t_5 = Float64(t_3 / t_4) tmp = 0.0 if (Float64(x1 - Float64(Float64(Float64(Float64(Float64(Float64(t_3 / t_1) * t_0) - Float64(t_1 * Float64(Float64(Float64(3.0 - t_5) * Float64(t_5 * Float64(2.0 * x1))) - Float64(Float64(Float64(4.0 * t_5) - 6.0) * Float64(x1 * x1))))) - Float64(Float64(x1 * x1) * x1)) - x1) - Float64(Float64(Float64(Float64(t_0 - Float64(x2 * 2.0)) - x1) / t_4) * 3.0))) <= Inf) tmp = fma(Float64(Float64(fma(-2.0, x2, t_0) - x1) / fma(x1, x1, 1.0)), 3.0, Float64(fma(fma(fma(t_2, 4.0, -6.0), Float64(x1 * x1), Float64(Float64(t_2 * Float64(2.0 * x1)) * Float64(t_2 - 3.0))), fma(x1, x1, 1.0), fma(x1, Float64(Float64(x2 * x1) * 6.0), x1)) + x1)); else tmp = Float64(Float64(fma(fma(fma(6.0, x1, -3.0), x1, -3.0), x1, -18.0) * x1) + x1); end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 - N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(x1 * x1), $MachinePrecision] * 3.0 + N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(x2 * 2.0), $MachinePrecision] + t$95$0), $MachinePrecision] - x1), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$3 / t$95$4), $MachinePrecision]}, If[LessEqual[N[(x1 - N[(N[(N[(N[(N[(N[(t$95$3 / t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(t$95$1 * N[(N[(N[(3.0 - t$95$5), $MachinePrecision] * N[(t$95$5 * N[(2.0 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(4.0 * t$95$5), $MachinePrecision] - 6.0), $MachinePrecision] * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(x1 * x1), $MachinePrecision] * x1), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] - N[(N[(N[(N[(t$95$0 - N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$4), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(N[(-2.0 * x2 + t$95$0), $MachinePrecision] - x1), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision] * 3.0 + N[(N[(N[(N[(t$95$2 * 4.0 + -6.0), $MachinePrecision] * N[(x1 * x1), $MachinePrecision] + N[(N[(t$95$2 * N[(2.0 * x1), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x1 * x1 + 1.0), $MachinePrecision] + N[(x1 * N[(N[(x2 * x1), $MachinePrecision] * 6.0), $MachinePrecision] + x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(6.0 * x1 + -3.0), $MachinePrecision] * x1 + -3.0), $MachinePrecision] * x1 + -18.0), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(3 \cdot x1\right) \cdot x1\\
t_1 := -1 - x1 \cdot x1\\
t_2 := \frac{\mathsf{fma}\left(x1 \cdot x1, 3, x2 \cdot 2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\\
t_3 := \left(x2 \cdot 2 + t\_0\right) - x1\\
t_4 := 1 + x1 \cdot x1\\
t_5 := \frac{t\_3}{t\_4}\\
\mathbf{if}\;x1 - \left(\left(\left(\left(\frac{t\_3}{t\_1} \cdot t\_0 - t\_1 \cdot \left(\left(3 - t\_5\right) \cdot \left(t\_5 \cdot \left(2 \cdot x1\right)\right) - \left(4 \cdot t\_5 - 6\right) \cdot \left(x1 \cdot x1\right)\right)\right) - \left(x1 \cdot x1\right) \cdot x1\right) - x1\right) - \frac{\left(t\_0 - x2 \cdot 2\right) - x1}{t\_4} \cdot 3\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(-2, x2, t\_0\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 3, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(t\_2, 4, -6\right), x1 \cdot x1, \left(t\_2 \cdot \left(2 \cdot x1\right)\right) \cdot \left(t\_2 - 3\right)\right), \mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, \left(x2 \cdot x1\right) \cdot 6, x1\right)\right) + x1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(6, x1, -3\right), x1, -3\right), x1, -18\right) \cdot x1 + x1\\
\end{array}
\end{array}
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.0Initial program 99.4%
Applied rewrites99.7%
Applied rewrites99.7%
Taylor expanded in x1 around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6496.7
Applied rewrites96.7%
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)))))) Initial program 0.0%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in x1 around 0
Applied rewrites100.0%
Taylor expanded in x2 around 0
Applied rewrites100.0%
Final simplification97.8%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (* (* 3.0 x1) x1))
(t_1 (- -1.0 (* x1 x1)))
(t_2 (- (+ (* x2 2.0) t_0) x1))
(t_3 (+ 1.0 (* x1 x1)))
(t_4 (/ t_2 t_3)))
(if (<=
(-
x1
(-
(-
(-
(-
(* (/ t_2 t_1) t_0)
(*
t_1
(-
(* (- 3.0 t_4) (* t_4 (* 2.0 x1)))
(* (- (* 4.0 t_4) 6.0) (* x1 x1)))))
(* (* x1 x1) x1))
x1)
(* (/ (- (- t_0 (* x2 2.0)) x1) t_3) 3.0)))
INFINITY)
(+ (fma -2.0 x1 (* -6.0 x2)) x1)
(+ (* (fma 12.0 x2 -18.0) x1) x1))))
double code(double x1, double x2) {
double t_0 = (3.0 * x1) * x1;
double t_1 = -1.0 - (x1 * x1);
double t_2 = ((x2 * 2.0) + t_0) - x1;
double t_3 = 1.0 + (x1 * x1);
double t_4 = t_2 / t_3;
double tmp;
if ((x1 - ((((((t_2 / t_1) * t_0) - (t_1 * (((3.0 - t_4) * (t_4 * (2.0 * x1))) - (((4.0 * t_4) - 6.0) * (x1 * x1))))) - ((x1 * x1) * x1)) - x1) - ((((t_0 - (x2 * 2.0)) - x1) / t_3) * 3.0))) <= ((double) INFINITY)) {
tmp = fma(-2.0, x1, (-6.0 * x2)) + x1;
} else {
tmp = (fma(12.0, x2, -18.0) * x1) + x1;
}
return tmp;
}
function code(x1, x2) t_0 = Float64(Float64(3.0 * x1) * x1) t_1 = Float64(-1.0 - Float64(x1 * x1)) t_2 = Float64(Float64(Float64(x2 * 2.0) + t_0) - x1) t_3 = Float64(1.0 + Float64(x1 * x1)) t_4 = Float64(t_2 / t_3) tmp = 0.0 if (Float64(x1 - Float64(Float64(Float64(Float64(Float64(Float64(t_2 / t_1) * t_0) - Float64(t_1 * Float64(Float64(Float64(3.0 - t_4) * Float64(t_4 * Float64(2.0 * x1))) - Float64(Float64(Float64(4.0 * t_4) - 6.0) * Float64(x1 * x1))))) - Float64(Float64(x1 * x1) * x1)) - x1) - Float64(Float64(Float64(Float64(t_0 - Float64(x2 * 2.0)) - x1) / t_3) * 3.0))) <= Inf) tmp = Float64(fma(-2.0, x1, Float64(-6.0 * x2)) + x1); else tmp = Float64(Float64(fma(12.0, x2, -18.0) * x1) + x1); end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 - N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x2 * 2.0), $MachinePrecision] + t$95$0), $MachinePrecision] - x1), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 / t$95$3), $MachinePrecision]}, If[LessEqual[N[(x1 - N[(N[(N[(N[(N[(N[(t$95$2 / t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(t$95$1 * N[(N[(N[(3.0 - t$95$4), $MachinePrecision] * N[(t$95$4 * N[(2.0 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(4.0 * t$95$4), $MachinePrecision] - 6.0), $MachinePrecision] * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(x1 * x1), $MachinePrecision] * x1), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] - N[(N[(N[(N[(t$95$0 - N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$3), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(-2.0 * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], N[(N[(N[(12.0 * x2 + -18.0), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(3 \cdot x1\right) \cdot x1\\
t_1 := -1 - x1 \cdot x1\\
t_2 := \left(x2 \cdot 2 + t\_0\right) - x1\\
t_3 := 1 + x1 \cdot x1\\
t_4 := \frac{t\_2}{t\_3}\\
\mathbf{if}\;x1 - \left(\left(\left(\left(\frac{t\_2}{t\_1} \cdot t\_0 - t\_1 \cdot \left(\left(3 - t\_4\right) \cdot \left(t\_4 \cdot \left(2 \cdot x1\right)\right) - \left(4 \cdot t\_4 - 6\right) \cdot \left(x1 \cdot x1\right)\right)\right) - \left(x1 \cdot x1\right) \cdot x1\right) - x1\right) - \frac{\left(t\_0 - x2 \cdot 2\right) - x1}{t\_3} \cdot 3\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(-2, x1, -6 \cdot x2\right) + x1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(12, x2, -18\right) \cdot x1 + x1\\
\end{array}
\end{array}
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.0Initial program 99.4%
Applied rewrites99.7%
Taylor expanded in x1 around 0
Applied rewrites52.6%
Taylor expanded in x2 around 0
Applied rewrites53.7%
Taylor expanded in x1 around 0
Applied rewrites53.2%
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)))))) Initial program 0.0%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in x1 around 0
Applied rewrites18.3%
Taylor expanded in x2 around 0
Applied rewrites18.3%
Final simplification41.5%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (* (* 3.0 x1) x1))
(t_1 (- -1.0 (* x1 x1)))
(t_2 (- (+ (* x2 2.0) t_0) x1))
(t_3 (+ 1.0 (* x1 x1)))
(t_4 (/ t_2 t_3)))
(if (<=
(-
x1
(-
(-
(-
(-
(* (/ t_2 t_1) t_0)
(*
t_1
(-
(* (- 3.0 t_4) (* t_4 (* 2.0 x1)))
(* (- (* 4.0 t_4) 6.0) (* x1 x1)))))
(* (* x1 x1) x1))
x1)
(* (/ (- (- t_0 (* x2 2.0)) x1) t_3) 3.0)))
5e+259)
(+ (fma -2.0 x1 (* -6.0 x2)) x1)
(+ (* 12.0 (* x2 x1)) x1))))
double code(double x1, double x2) {
double t_0 = (3.0 * x1) * x1;
double t_1 = -1.0 - (x1 * x1);
double t_2 = ((x2 * 2.0) + t_0) - x1;
double t_3 = 1.0 + (x1 * x1);
double t_4 = t_2 / t_3;
double tmp;
if ((x1 - ((((((t_2 / t_1) * t_0) - (t_1 * (((3.0 - t_4) * (t_4 * (2.0 * x1))) - (((4.0 * t_4) - 6.0) * (x1 * x1))))) - ((x1 * x1) * x1)) - x1) - ((((t_0 - (x2 * 2.0)) - x1) / t_3) * 3.0))) <= 5e+259) {
tmp = fma(-2.0, x1, (-6.0 * x2)) + x1;
} else {
tmp = (12.0 * (x2 * x1)) + x1;
}
return tmp;
}
function code(x1, x2) t_0 = Float64(Float64(3.0 * x1) * x1) t_1 = Float64(-1.0 - Float64(x1 * x1)) t_2 = Float64(Float64(Float64(x2 * 2.0) + t_0) - x1) t_3 = Float64(1.0 + Float64(x1 * x1)) t_4 = Float64(t_2 / t_3) tmp = 0.0 if (Float64(x1 - Float64(Float64(Float64(Float64(Float64(Float64(t_2 / t_1) * t_0) - Float64(t_1 * Float64(Float64(Float64(3.0 - t_4) * Float64(t_4 * Float64(2.0 * x1))) - Float64(Float64(Float64(4.0 * t_4) - 6.0) * Float64(x1 * x1))))) - Float64(Float64(x1 * x1) * x1)) - x1) - Float64(Float64(Float64(Float64(t_0 - Float64(x2 * 2.0)) - x1) / t_3) * 3.0))) <= 5e+259) tmp = Float64(fma(-2.0, x1, Float64(-6.0 * x2)) + x1); else tmp = Float64(Float64(12.0 * Float64(x2 * x1)) + x1); end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 - N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x2 * 2.0), $MachinePrecision] + t$95$0), $MachinePrecision] - x1), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 / t$95$3), $MachinePrecision]}, If[LessEqual[N[(x1 - N[(N[(N[(N[(N[(N[(t$95$2 / t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(t$95$1 * N[(N[(N[(3.0 - t$95$4), $MachinePrecision] * N[(t$95$4 * N[(2.0 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(4.0 * t$95$4), $MachinePrecision] - 6.0), $MachinePrecision] * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(x1 * x1), $MachinePrecision] * x1), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] - N[(N[(N[(N[(t$95$0 - N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$3), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+259], N[(N[(-2.0 * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], N[(N[(12.0 * N[(x2 * x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(3 \cdot x1\right) \cdot x1\\
t_1 := -1 - x1 \cdot x1\\
t_2 := \left(x2 \cdot 2 + t\_0\right) - x1\\
t_3 := 1 + x1 \cdot x1\\
t_4 := \frac{t\_2}{t\_3}\\
\mathbf{if}\;x1 - \left(\left(\left(\left(\frac{t\_2}{t\_1} \cdot t\_0 - t\_1 \cdot \left(\left(3 - t\_4\right) \cdot \left(t\_4 \cdot \left(2 \cdot x1\right)\right) - \left(4 \cdot t\_4 - 6\right) \cdot \left(x1 \cdot x1\right)\right)\right) - \left(x1 \cdot x1\right) \cdot x1\right) - x1\right) - \frac{\left(t\_0 - x2 \cdot 2\right) - x1}{t\_3} \cdot 3\right) \leq 5 \cdot 10^{+259}:\\
\;\;\;\;\mathsf{fma}\left(-2, x1, -6 \cdot x2\right) + x1\\
\mathbf{else}:\\
\;\;\;\;12 \cdot \left(x2 \cdot x1\right) + x1\\
\end{array}
\end{array}
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)))))) < 5.00000000000000033e259Initial program 99.3%
Applied rewrites99.7%
Taylor expanded in x1 around 0
Applied rewrites65.1%
Taylor expanded in x2 around 0
Applied rewrites66.7%
Taylor expanded in x1 around 0
Applied rewrites66.3%
if 5.00000000000000033e259 < (+.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)))))) Initial program 28.9%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.3%
Taylor expanded in x1 around 0
Applied rewrites13.7%
Taylor expanded in x2 around inf
Applied rewrites13.7%
Final simplification41.5%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (* (* 3.0 x1) x1))
(t_1 (- -1.0 (* x1 x1)))
(t_2 (- (+ (* x2 2.0) t_0) x1))
(t_3 (+ 1.0 (* x1 x1)))
(t_4 (/ t_2 t_3)))
(if (<=
(-
x1
(-
(-
(-
(-
(* (/ t_2 t_1) t_0)
(*
t_1
(-
(* (- 3.0 t_4) (* t_4 (* 2.0 x1)))
(* (- (* 4.0 t_4) 6.0) (* x1 x1)))))
(* (* x1 x1) x1))
x1)
(* (/ (- (- t_0 (* x2 2.0)) x1) t_3) 3.0)))
5e+259)
(* -6.0 x2)
(+ (* 12.0 (* x2 x1)) x1))))
double code(double x1, double x2) {
double t_0 = (3.0 * x1) * x1;
double t_1 = -1.0 - (x1 * x1);
double t_2 = ((x2 * 2.0) + t_0) - x1;
double t_3 = 1.0 + (x1 * x1);
double t_4 = t_2 / t_3;
double tmp;
if ((x1 - ((((((t_2 / t_1) * t_0) - (t_1 * (((3.0 - t_4) * (t_4 * (2.0 * x1))) - (((4.0 * t_4) - 6.0) * (x1 * x1))))) - ((x1 * x1) * x1)) - x1) - ((((t_0 - (x2 * 2.0)) - x1) / t_3) * 3.0))) <= 5e+259) {
tmp = -6.0 * x2;
} else {
tmp = (12.0 * (x2 * x1)) + x1;
}
return tmp;
}
real(8) function code(x1, x2)
real(8), intent (in) :: x1
real(8), intent (in) :: x2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = (3.0d0 * x1) * x1
t_1 = (-1.0d0) - (x1 * x1)
t_2 = ((x2 * 2.0d0) + t_0) - x1
t_3 = 1.0d0 + (x1 * x1)
t_4 = t_2 / t_3
if ((x1 - ((((((t_2 / t_1) * t_0) - (t_1 * (((3.0d0 - t_4) * (t_4 * (2.0d0 * x1))) - (((4.0d0 * t_4) - 6.0d0) * (x1 * x1))))) - ((x1 * x1) * x1)) - x1) - ((((t_0 - (x2 * 2.0d0)) - x1) / t_3) * 3.0d0))) <= 5d+259) then
tmp = (-6.0d0) * x2
else
tmp = (12.0d0 * (x2 * x1)) + x1
end if
code = tmp
end function
public static double code(double x1, double x2) {
double t_0 = (3.0 * x1) * x1;
double t_1 = -1.0 - (x1 * x1);
double t_2 = ((x2 * 2.0) + t_0) - x1;
double t_3 = 1.0 + (x1 * x1);
double t_4 = t_2 / t_3;
double tmp;
if ((x1 - ((((((t_2 / t_1) * t_0) - (t_1 * (((3.0 - t_4) * (t_4 * (2.0 * x1))) - (((4.0 * t_4) - 6.0) * (x1 * x1))))) - ((x1 * x1) * x1)) - x1) - ((((t_0 - (x2 * 2.0)) - x1) / t_3) * 3.0))) <= 5e+259) {
tmp = -6.0 * x2;
} else {
tmp = (12.0 * (x2 * x1)) + x1;
}
return tmp;
}
def code(x1, x2): t_0 = (3.0 * x1) * x1 t_1 = -1.0 - (x1 * x1) t_2 = ((x2 * 2.0) + t_0) - x1 t_3 = 1.0 + (x1 * x1) t_4 = t_2 / t_3 tmp = 0 if (x1 - ((((((t_2 / t_1) * t_0) - (t_1 * (((3.0 - t_4) * (t_4 * (2.0 * x1))) - (((4.0 * t_4) - 6.0) * (x1 * x1))))) - ((x1 * x1) * x1)) - x1) - ((((t_0 - (x2 * 2.0)) - x1) / t_3) * 3.0))) <= 5e+259: tmp = -6.0 * x2 else: tmp = (12.0 * (x2 * x1)) + x1 return tmp
function code(x1, x2) t_0 = Float64(Float64(3.0 * x1) * x1) t_1 = Float64(-1.0 - Float64(x1 * x1)) t_2 = Float64(Float64(Float64(x2 * 2.0) + t_0) - x1) t_3 = Float64(1.0 + Float64(x1 * x1)) t_4 = Float64(t_2 / t_3) tmp = 0.0 if (Float64(x1 - Float64(Float64(Float64(Float64(Float64(Float64(t_2 / t_1) * t_0) - Float64(t_1 * Float64(Float64(Float64(3.0 - t_4) * Float64(t_4 * Float64(2.0 * x1))) - Float64(Float64(Float64(4.0 * t_4) - 6.0) * Float64(x1 * x1))))) - Float64(Float64(x1 * x1) * x1)) - x1) - Float64(Float64(Float64(Float64(t_0 - Float64(x2 * 2.0)) - x1) / t_3) * 3.0))) <= 5e+259) tmp = Float64(-6.0 * x2); else tmp = Float64(Float64(12.0 * Float64(x2 * x1)) + x1); end return tmp end
function tmp_2 = code(x1, x2) t_0 = (3.0 * x1) * x1; t_1 = -1.0 - (x1 * x1); t_2 = ((x2 * 2.0) + t_0) - x1; t_3 = 1.0 + (x1 * x1); t_4 = t_2 / t_3; tmp = 0.0; if ((x1 - ((((((t_2 / t_1) * t_0) - (t_1 * (((3.0 - t_4) * (t_4 * (2.0 * x1))) - (((4.0 * t_4) - 6.0) * (x1 * x1))))) - ((x1 * x1) * x1)) - x1) - ((((t_0 - (x2 * 2.0)) - x1) / t_3) * 3.0))) <= 5e+259) tmp = -6.0 * x2; else tmp = (12.0 * (x2 * x1)) + x1; end tmp_2 = tmp; end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(3.0 * x1), $MachinePrecision] * x1), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 - N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x2 * 2.0), $MachinePrecision] + t$95$0), $MachinePrecision] - x1), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 + N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 / t$95$3), $MachinePrecision]}, If[LessEqual[N[(x1 - N[(N[(N[(N[(N[(N[(t$95$2 / t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(t$95$1 * N[(N[(N[(3.0 - t$95$4), $MachinePrecision] * N[(t$95$4 * N[(2.0 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(4.0 * t$95$4), $MachinePrecision] - 6.0), $MachinePrecision] * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(x1 * x1), $MachinePrecision] * x1), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] - N[(N[(N[(N[(t$95$0 - N[(x2 * 2.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$3), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+259], N[(-6.0 * x2), $MachinePrecision], N[(N[(12.0 * N[(x2 * x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(3 \cdot x1\right) \cdot x1\\
t_1 := -1 - x1 \cdot x1\\
t_2 := \left(x2 \cdot 2 + t\_0\right) - x1\\
t_3 := 1 + x1 \cdot x1\\
t_4 := \frac{t\_2}{t\_3}\\
\mathbf{if}\;x1 - \left(\left(\left(\left(\frac{t\_2}{t\_1} \cdot t\_0 - t\_1 \cdot \left(\left(3 - t\_4\right) \cdot \left(t\_4 \cdot \left(2 \cdot x1\right)\right) - \left(4 \cdot t\_4 - 6\right) \cdot \left(x1 \cdot x1\right)\right)\right) - \left(x1 \cdot x1\right) \cdot x1\right) - x1\right) - \frac{\left(t\_0 - x2 \cdot 2\right) - x1}{t\_3} \cdot 3\right) \leq 5 \cdot 10^{+259}:\\
\;\;\;\;-6 \cdot x2\\
\mathbf{else}:\\
\;\;\;\;12 \cdot \left(x2 \cdot x1\right) + x1\\
\end{array}
\end{array}
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)))))) < 5.00000000000000033e259Initial program 99.3%
Applied rewrites99.7%
Applied rewrites99.7%
Taylor expanded in x1 around 0
lower-*.f6448.7
Applied rewrites48.7%
if 5.00000000000000033e259 < (+.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)))))) Initial program 28.9%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.3%
Taylor expanded in x1 around 0
Applied rewrites13.7%
Taylor expanded in x2 around inf
Applied rewrites13.7%
Final simplification32.1%
(FPCore (x1 x2)
:precision binary64
(if (<= x1 -2.8e+21)
(+
(*
(*
(-
6.0
(/
(-
3.0
(/ (fma (fma 2.0 x2 -3.0) 4.0 (- 9.0 (/ (fma -12.0 x2 18.0) x1))) x1))
x1))
(* x1 x1))
(* x1 x1))
x1)
(if (<= x1 4e+28)
(+
(fma
(/ (- (fma -2.0 x2 (* (* x1 x1) 3.0)) x1) (fma x1 x1 1.0))
3.0
(+ (* (* (* 8.0 (/ x1 (fma x1 x1 1.0))) x2) x2) x1))
x1)
(+
(*
(fma
(fma (fma 6.0 x1 -3.0) x1 (fma (fma 2.0 x2 -3.0) 4.0 9.0))
x1
(* (fma 2.0 x2 -3.0) 6.0))
x1)
x1))))
double code(double x1, double x2) {
double tmp;
if (x1 <= -2.8e+21) {
tmp = (((6.0 - ((3.0 - (fma(fma(2.0, x2, -3.0), 4.0, (9.0 - (fma(-12.0, x2, 18.0) / x1))) / x1)) / x1)) * (x1 * x1)) * (x1 * x1)) + x1;
} else if (x1 <= 4e+28) {
tmp = fma(((fma(-2.0, x2, ((x1 * x1) * 3.0)) - x1) / fma(x1, x1, 1.0)), 3.0, ((((8.0 * (x1 / fma(x1, x1, 1.0))) * x2) * x2) + x1)) + x1;
} else {
tmp = (fma(fma(fma(6.0, x1, -3.0), x1, fma(fma(2.0, x2, -3.0), 4.0, 9.0)), x1, (fma(2.0, x2, -3.0) * 6.0)) * x1) + x1;
}
return tmp;
}
function code(x1, x2) tmp = 0.0 if (x1 <= -2.8e+21) tmp = Float64(Float64(Float64(Float64(6.0 - Float64(Float64(3.0 - Float64(fma(fma(2.0, x2, -3.0), 4.0, Float64(9.0 - Float64(fma(-12.0, x2, 18.0) / x1))) / x1)) / x1)) * Float64(x1 * x1)) * Float64(x1 * x1)) + x1); elseif (x1 <= 4e+28) tmp = Float64(fma(Float64(Float64(fma(-2.0, x2, Float64(Float64(x1 * x1) * 3.0)) - x1) / fma(x1, x1, 1.0)), 3.0, Float64(Float64(Float64(Float64(8.0 * Float64(x1 / fma(x1, x1, 1.0))) * x2) * x2) + x1)) + x1); else tmp = Float64(Float64(fma(fma(fma(6.0, x1, -3.0), x1, fma(fma(2.0, x2, -3.0), 4.0, 9.0)), x1, Float64(fma(2.0, x2, -3.0) * 6.0)) * x1) + x1); end return tmp end
code[x1_, x2_] := If[LessEqual[x1, -2.8e+21], N[(N[(N[(N[(6.0 - N[(N[(3.0 - N[(N[(N[(2.0 * x2 + -3.0), $MachinePrecision] * 4.0 + N[(9.0 - N[(N[(-12.0 * x2 + 18.0), $MachinePrecision] / x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x1), $MachinePrecision]), $MachinePrecision] / x1), $MachinePrecision]), $MachinePrecision] * N[(x1 * x1), $MachinePrecision]), $MachinePrecision] * N[(x1 * x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], If[LessEqual[x1, 4e+28], N[(N[(N[(N[(N[(-2.0 * x2 + N[(N[(x1 * x1), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision] * 3.0 + N[(N[(N[(N[(8.0 * N[(x1 / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x2), $MachinePrecision] * x2), $MachinePrecision] + x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], N[(N[(N[(N[(N[(6.0 * x1 + -3.0), $MachinePrecision] * x1 + N[(N[(2.0 * x2 + -3.0), $MachinePrecision] * 4.0 + 9.0), $MachinePrecision]), $MachinePrecision] * x1 + N[(N[(2.0 * x2 + -3.0), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -2.8 \cdot 10^{+21}:\\
\;\;\;\;\left(\left(6 - \frac{3 - \frac{\mathsf{fma}\left(\mathsf{fma}\left(2, x2, -3\right), 4, 9 - \frac{\mathsf{fma}\left(-12, x2, 18\right)}{x1}\right)}{x1}}{x1}\right) \cdot \left(x1 \cdot x1\right)\right) \cdot \left(x1 \cdot x1\right) + x1\\
\mathbf{elif}\;x1 \leq 4 \cdot 10^{+28}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(-2, x2, \left(x1 \cdot x1\right) \cdot 3\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 3, \left(\left(8 \cdot \frac{x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right) \cdot x2\right) \cdot x2 + x1\right) + x1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(6, x1, -3\right), x1, \mathsf{fma}\left(\mathsf{fma}\left(2, x2, -3\right), 4, 9\right)\right), x1, \mathsf{fma}\left(2, x2, -3\right) \cdot 6\right) \cdot x1 + x1\\
\end{array}
\end{array}
if x1 < -2.8e21Initial program 22.3%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Applied rewrites100.0%
if -2.8e21 < x1 < 3.99999999999999983e28Initial program 99.4%
Taylor expanded in x2 around inf
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6498.0
Applied rewrites98.0%
lift-+.f64N/A
Applied rewrites98.4%
if 3.99999999999999983e28 < x1 Initial program 42.2%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.1%
Taylor expanded in x1 around 0
Applied rewrites96.2%
Final simplification98.3%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0
(+
(*
(fma
(fma (fma 6.0 x1 -3.0) x1 (fma (fma 2.0 x2 -3.0) 4.0 9.0))
x1
(* (fma 2.0 x2 -3.0) 6.0))
x1)
x1)))
(if (<= x1 -2.8e+21)
t_0
(if (<= x1 4e+28)
(+
(fma
(/ (- (fma -2.0 x2 (* (* x1 x1) 3.0)) x1) (fma x1 x1 1.0))
3.0
(+ (* (* (* 8.0 (/ x1 (fma x1 x1 1.0))) x2) x2) x1))
x1)
t_0))))
double code(double x1, double x2) {
double t_0 = (fma(fma(fma(6.0, x1, -3.0), x1, fma(fma(2.0, x2, -3.0), 4.0, 9.0)), x1, (fma(2.0, x2, -3.0) * 6.0)) * x1) + x1;
double tmp;
if (x1 <= -2.8e+21) {
tmp = t_0;
} else if (x1 <= 4e+28) {
tmp = fma(((fma(-2.0, x2, ((x1 * x1) * 3.0)) - x1) / fma(x1, x1, 1.0)), 3.0, ((((8.0 * (x1 / fma(x1, x1, 1.0))) * x2) * x2) + x1)) + x1;
} else {
tmp = t_0;
}
return tmp;
}
function code(x1, x2) t_0 = Float64(Float64(fma(fma(fma(6.0, x1, -3.0), x1, fma(fma(2.0, x2, -3.0), 4.0, 9.0)), x1, Float64(fma(2.0, x2, -3.0) * 6.0)) * x1) + x1) tmp = 0.0 if (x1 <= -2.8e+21) tmp = t_0; elseif (x1 <= 4e+28) tmp = Float64(fma(Float64(Float64(fma(-2.0, x2, Float64(Float64(x1 * x1) * 3.0)) - x1) / fma(x1, x1, 1.0)), 3.0, Float64(Float64(Float64(Float64(8.0 * Float64(x1 / fma(x1, x1, 1.0))) * x2) * x2) + x1)) + x1); else tmp = t_0; end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(N[(N[(N[(6.0 * x1 + -3.0), $MachinePrecision] * x1 + N[(N[(2.0 * x2 + -3.0), $MachinePrecision] * 4.0 + 9.0), $MachinePrecision]), $MachinePrecision] * x1 + N[(N[(2.0 * x2 + -3.0), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]}, If[LessEqual[x1, -2.8e+21], t$95$0, If[LessEqual[x1, 4e+28], N[(N[(N[(N[(N[(-2.0 * x2 + N[(N[(x1 * x1), $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision] * 3.0 + N[(N[(N[(N[(8.0 * N[(x1 / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x2), $MachinePrecision] * x2), $MachinePrecision] + x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(6, x1, -3\right), x1, \mathsf{fma}\left(\mathsf{fma}\left(2, x2, -3\right), 4, 9\right)\right), x1, \mathsf{fma}\left(2, x2, -3\right) \cdot 6\right) \cdot x1 + x1\\
\mathbf{if}\;x1 \leq -2.8 \cdot 10^{+21}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x1 \leq 4 \cdot 10^{+28}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(-2, x2, \left(x1 \cdot x1\right) \cdot 3\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, 3, \left(\left(8 \cdot \frac{x1}{\mathsf{fma}\left(x1, x1, 1\right)}\right) \cdot x2\right) \cdot x2 + x1\right) + x1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x1 < -2.8e21 or 3.99999999999999983e28 < x1 Initial program 31.6%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.2%
Taylor expanded in x1 around 0
Applied rewrites98.2%
if -2.8e21 < x1 < 3.99999999999999983e28Initial program 99.4%
Taylor expanded in x2 around inf
associate-*r/N/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f6498.0
Applied rewrites98.0%
lift-+.f64N/A
Applied rewrites98.4%
Final simplification98.3%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0
(+
(*
(fma
(fma (fma 6.0 x1 -3.0) x1 (fma (fma 2.0 x2 -3.0) 4.0 9.0))
x1
(* (fma 2.0 x2 -3.0) 6.0))
x1)
x1)))
(if (<= x1 -1.0)
t_0
(if (<= x1 1.0)
(+
(fma
(fma
x1
(fma (fma -8.0 (* x1 x1) 8.0) x2 (fma (fma 24.0 x1 12.0) x1 -12.0))
-6.0)
x2
(* (fma (fma -19.0 x1 9.0) x1 -2.0) x1))
x1)
t_0))))
double code(double x1, double x2) {
double t_0 = (fma(fma(fma(6.0, x1, -3.0), x1, fma(fma(2.0, x2, -3.0), 4.0, 9.0)), x1, (fma(2.0, x2, -3.0) * 6.0)) * x1) + x1;
double tmp;
if (x1 <= -1.0) {
tmp = t_0;
} else if (x1 <= 1.0) {
tmp = fma(fma(x1, fma(fma(-8.0, (x1 * x1), 8.0), x2, fma(fma(24.0, x1, 12.0), x1, -12.0)), -6.0), x2, (fma(fma(-19.0, x1, 9.0), x1, -2.0) * x1)) + x1;
} else {
tmp = t_0;
}
return tmp;
}
function code(x1, x2) t_0 = Float64(Float64(fma(fma(fma(6.0, x1, -3.0), x1, fma(fma(2.0, x2, -3.0), 4.0, 9.0)), x1, Float64(fma(2.0, x2, -3.0) * 6.0)) * x1) + x1) tmp = 0.0 if (x1 <= -1.0) tmp = t_0; elseif (x1 <= 1.0) tmp = Float64(fma(fma(x1, fma(fma(-8.0, Float64(x1 * x1), 8.0), x2, fma(fma(24.0, x1, 12.0), x1, -12.0)), -6.0), x2, Float64(fma(fma(-19.0, x1, 9.0), x1, -2.0) * x1)) + x1); else tmp = t_0; end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(N[(N[(N[(6.0 * x1 + -3.0), $MachinePrecision] * x1 + N[(N[(2.0 * x2 + -3.0), $MachinePrecision] * 4.0 + 9.0), $MachinePrecision]), $MachinePrecision] * x1 + N[(N[(2.0 * x2 + -3.0), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]}, If[LessEqual[x1, -1.0], t$95$0, If[LessEqual[x1, 1.0], N[(N[(N[(x1 * N[(N[(-8.0 * N[(x1 * x1), $MachinePrecision] + 8.0), $MachinePrecision] * x2 + N[(N[(24.0 * x1 + 12.0), $MachinePrecision] * x1 + -12.0), $MachinePrecision]), $MachinePrecision] + -6.0), $MachinePrecision] * x2 + N[(N[(N[(-19.0 * x1 + 9.0), $MachinePrecision] * x1 + -2.0), $MachinePrecision] * x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(6, x1, -3\right), x1, \mathsf{fma}\left(\mathsf{fma}\left(2, x2, -3\right), 4, 9\right)\right), x1, \mathsf{fma}\left(2, x2, -3\right) \cdot 6\right) \cdot x1 + x1\\
\mathbf{if}\;x1 \leq -1:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x1 \leq 1:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x1, \mathsf{fma}\left(\mathsf{fma}\left(-8, x1 \cdot x1, 8\right), x2, \mathsf{fma}\left(\mathsf{fma}\left(24, x1, 12\right), x1, -12\right)\right), -6\right), x2, \mathsf{fma}\left(\mathsf{fma}\left(-19, x1, 9\right), x1, -2\right) \cdot x1\right) + x1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x1 < -1 or 1 < x1 Initial program 35.2%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites94.6%
Taylor expanded in x1 around 0
Applied rewrites94.6%
if -1 < x1 < 1Initial program 99.4%
Applied rewrites99.8%
Taylor expanded in x1 around 0
Applied rewrites71.0%
Taylor expanded in x2 around 0
Applied rewrites98.6%
Final simplification96.5%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0
(+
(*
(fma
(fma (fma 6.0 x1 -3.0) x1 (fma (fma 2.0 x2 -3.0) 4.0 9.0))
x1
(* (fma 2.0 x2 -3.0) 6.0))
x1)
x1)))
(if (<= x1 -2.2e+21)
t_0
(if (<= x1 4e+28)
(+
(fma
(* x1 x1)
x1
(fma (fma (* (fma 2.0 x2 -3.0) x2) 4.0 -2.0) x1 (* -6.0 x2)))
x1)
t_0))))
double code(double x1, double x2) {
double t_0 = (fma(fma(fma(6.0, x1, -3.0), x1, fma(fma(2.0, x2, -3.0), 4.0, 9.0)), x1, (fma(2.0, x2, -3.0) * 6.0)) * x1) + x1;
double tmp;
if (x1 <= -2.2e+21) {
tmp = t_0;
} else if (x1 <= 4e+28) {
tmp = fma((x1 * x1), x1, fma(fma((fma(2.0, x2, -3.0) * x2), 4.0, -2.0), x1, (-6.0 * x2))) + x1;
} else {
tmp = t_0;
}
return tmp;
}
function code(x1, x2) t_0 = Float64(Float64(fma(fma(fma(6.0, x1, -3.0), x1, fma(fma(2.0, x2, -3.0), 4.0, 9.0)), x1, Float64(fma(2.0, x2, -3.0) * 6.0)) * x1) + x1) tmp = 0.0 if (x1 <= -2.2e+21) tmp = t_0; elseif (x1 <= 4e+28) tmp = Float64(fma(Float64(x1 * x1), x1, fma(fma(Float64(fma(2.0, x2, -3.0) * x2), 4.0, -2.0), x1, Float64(-6.0 * x2))) + x1); else tmp = t_0; end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(N[(N[(N[(6.0 * x1 + -3.0), $MachinePrecision] * x1 + N[(N[(2.0 * x2 + -3.0), $MachinePrecision] * 4.0 + 9.0), $MachinePrecision]), $MachinePrecision] * x1 + N[(N[(2.0 * x2 + -3.0), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]}, If[LessEqual[x1, -2.2e+21], t$95$0, If[LessEqual[x1, 4e+28], N[(N[(N[(x1 * x1), $MachinePrecision] * x1 + N[(N[(N[(N[(2.0 * x2 + -3.0), $MachinePrecision] * x2), $MachinePrecision] * 4.0 + -2.0), $MachinePrecision] * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(6, x1, -3\right), x1, \mathsf{fma}\left(\mathsf{fma}\left(2, x2, -3\right), 4, 9\right)\right), x1, \mathsf{fma}\left(2, x2, -3\right) \cdot 6\right) \cdot x1 + x1\\
\mathbf{if}\;x1 \leq -2.2 \cdot 10^{+21}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x1 \leq 4 \cdot 10^{+28}:\\
\;\;\;\;\mathsf{fma}\left(x1 \cdot x1, x1, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(2, x2, -3\right) \cdot x2, 4, -2\right), x1, -6 \cdot x2\right)\right) + x1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x1 < -2.2e21 or 3.99999999999999983e28 < x1 Initial program 31.6%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.2%
Taylor expanded in x1 around 0
Applied rewrites98.2%
if -2.2e21 < x1 < 3.99999999999999983e28Initial program 99.4%
Applied rewrites99.7%
Taylor expanded in x1 around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f6482.5
Applied rewrites82.5%
Final simplification90.2%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (fma (fma 6.0 x1 -3.0) x1 -3.0)))
(if (<= x1 -3.7e+148)
(+ (* (fma (fma -19.0 x1 9.0) x1 -2.0) x1) x1)
(if (<= x1 -2.2e+21)
(+ (* (fma t_0 x1 (fma (fma 8.0 x1 12.0) x2 -18.0)) x1) x1)
(if (<= x1 4e+28)
(+
(fma
(* x1 x1)
x1
(fma (fma (* (fma 2.0 x2 -3.0) x2) 4.0 -2.0) x1 (* -6.0 x2)))
x1)
(+ (* (fma t_0 x1 -18.0) x1) x1))))))
double code(double x1, double x2) {
double t_0 = fma(fma(6.0, x1, -3.0), x1, -3.0);
double tmp;
if (x1 <= -3.7e+148) {
tmp = (fma(fma(-19.0, x1, 9.0), x1, -2.0) * x1) + x1;
} else if (x1 <= -2.2e+21) {
tmp = (fma(t_0, x1, fma(fma(8.0, x1, 12.0), x2, -18.0)) * x1) + x1;
} else if (x1 <= 4e+28) {
tmp = fma((x1 * x1), x1, fma(fma((fma(2.0, x2, -3.0) * x2), 4.0, -2.0), x1, (-6.0 * x2))) + x1;
} else {
tmp = (fma(t_0, x1, -18.0) * x1) + x1;
}
return tmp;
}
function code(x1, x2) t_0 = fma(fma(6.0, x1, -3.0), x1, -3.0) tmp = 0.0 if (x1 <= -3.7e+148) tmp = Float64(Float64(fma(fma(-19.0, x1, 9.0), x1, -2.0) * x1) + x1); elseif (x1 <= -2.2e+21) tmp = Float64(Float64(fma(t_0, x1, fma(fma(8.0, x1, 12.0), x2, -18.0)) * x1) + x1); elseif (x1 <= 4e+28) tmp = Float64(fma(Float64(x1 * x1), x1, fma(fma(Float64(fma(2.0, x2, -3.0) * x2), 4.0, -2.0), x1, Float64(-6.0 * x2))) + x1); else tmp = Float64(Float64(fma(t_0, x1, -18.0) * x1) + x1); end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(6.0 * x1 + -3.0), $MachinePrecision] * x1 + -3.0), $MachinePrecision]}, If[LessEqual[x1, -3.7e+148], N[(N[(N[(N[(-19.0 * x1 + 9.0), $MachinePrecision] * x1 + -2.0), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision], If[LessEqual[x1, -2.2e+21], N[(N[(N[(t$95$0 * x1 + N[(N[(8.0 * x1 + 12.0), $MachinePrecision] * x2 + -18.0), $MachinePrecision]), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision], If[LessEqual[x1, 4e+28], N[(N[(N[(x1 * x1), $MachinePrecision] * x1 + N[(N[(N[(N[(2.0 * x2 + -3.0), $MachinePrecision] * x2), $MachinePrecision] * 4.0 + -2.0), $MachinePrecision] * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], N[(N[(N[(t$95$0 * x1 + -18.0), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(6, x1, -3\right), x1, -3\right)\\
\mathbf{if}\;x1 \leq -3.7 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-19, x1, 9\right), x1, -2\right) \cdot x1 + x1\\
\mathbf{elif}\;x1 \leq -2.2 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, x1, \mathsf{fma}\left(\mathsf{fma}\left(8, x1, 12\right), x2, -18\right)\right) \cdot x1 + x1\\
\mathbf{elif}\;x1 \leq 4 \cdot 10^{+28}:\\
\;\;\;\;\mathsf{fma}\left(x1 \cdot x1, x1, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(2, x2, -3\right) \cdot x2, 4, -2\right), x1, -6 \cdot x2\right)\right) + x1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, x1, -18\right) \cdot x1 + x1\\
\end{array}
\end{array}
if x1 < -3.7000000000000002e148Initial program 0.0%
Applied rewrites10.0%
Taylor expanded in x1 around 0
Applied rewrites67.5%
Taylor expanded in x2 around 0
Applied rewrites100.0%
if -3.7000000000000002e148 < x1 < -2.2e21Initial program 55.3%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in x1 around 0
Applied rewrites99.8%
Taylor expanded in x2 around 0
Applied rewrites99.8%
if -2.2e21 < x1 < 3.99999999999999983e28Initial program 99.4%
Applied rewrites99.7%
Taylor expanded in x1 around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f6482.5
Applied rewrites82.5%
if 3.99999999999999983e28 < x1 Initial program 42.2%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.1%
Taylor expanded in x1 around 0
Applied rewrites96.2%
Taylor expanded in x2 around 0
Applied rewrites93.6%
Final simplification89.6%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (fma (fma 6.0 x1 -3.0) x1 -3.0)))
(if (<= x1 -3.7e+148)
(+ (* (fma (fma -19.0 x1 9.0) x1 -2.0) x1) x1)
(if (<= x1 -2.2e+21)
(+ (* (fma t_0 x1 (fma (fma 8.0 x1 12.0) x2 -18.0)) x1) x1)
(if (<= x1 4e+28)
(fma (fma (* (fma 2.0 x2 -3.0) x2) 4.0 -1.0) x1 (* -6.0 x2))
(+ (* (fma t_0 x1 -18.0) x1) x1))))))
double code(double x1, double x2) {
double t_0 = fma(fma(6.0, x1, -3.0), x1, -3.0);
double tmp;
if (x1 <= -3.7e+148) {
tmp = (fma(fma(-19.0, x1, 9.0), x1, -2.0) * x1) + x1;
} else if (x1 <= -2.2e+21) {
tmp = (fma(t_0, x1, fma(fma(8.0, x1, 12.0), x2, -18.0)) * x1) + x1;
} else if (x1 <= 4e+28) {
tmp = fma(fma((fma(2.0, x2, -3.0) * x2), 4.0, -1.0), x1, (-6.0 * x2));
} else {
tmp = (fma(t_0, x1, -18.0) * x1) + x1;
}
return tmp;
}
function code(x1, x2) t_0 = fma(fma(6.0, x1, -3.0), x1, -3.0) tmp = 0.0 if (x1 <= -3.7e+148) tmp = Float64(Float64(fma(fma(-19.0, x1, 9.0), x1, -2.0) * x1) + x1); elseif (x1 <= -2.2e+21) tmp = Float64(Float64(fma(t_0, x1, fma(fma(8.0, x1, 12.0), x2, -18.0)) * x1) + x1); elseif (x1 <= 4e+28) tmp = fma(fma(Float64(fma(2.0, x2, -3.0) * x2), 4.0, -1.0), x1, Float64(-6.0 * x2)); else tmp = Float64(Float64(fma(t_0, x1, -18.0) * x1) + x1); end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(6.0 * x1 + -3.0), $MachinePrecision] * x1 + -3.0), $MachinePrecision]}, If[LessEqual[x1, -3.7e+148], N[(N[(N[(N[(-19.0 * x1 + 9.0), $MachinePrecision] * x1 + -2.0), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision], If[LessEqual[x1, -2.2e+21], N[(N[(N[(t$95$0 * x1 + N[(N[(8.0 * x1 + 12.0), $MachinePrecision] * x2 + -18.0), $MachinePrecision]), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision], If[LessEqual[x1, 4e+28], N[(N[(N[(N[(2.0 * x2 + -3.0), $MachinePrecision] * x2), $MachinePrecision] * 4.0 + -1.0), $MachinePrecision] * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$0 * x1 + -18.0), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(6, x1, -3\right), x1, -3\right)\\
\mathbf{if}\;x1 \leq -3.7 \cdot 10^{+148}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-19, x1, 9\right), x1, -2\right) \cdot x1 + x1\\
\mathbf{elif}\;x1 \leq -2.2 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, x1, \mathsf{fma}\left(\mathsf{fma}\left(8, x1, 12\right), x2, -18\right)\right) \cdot x1 + x1\\
\mathbf{elif}\;x1 \leq 4 \cdot 10^{+28}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(2, x2, -3\right) \cdot x2, 4, -1\right), x1, -6 \cdot x2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, x1, -18\right) \cdot x1 + x1\\
\end{array}
\end{array}
if x1 < -3.7000000000000002e148Initial program 0.0%
Applied rewrites10.0%
Taylor expanded in x1 around 0
Applied rewrites67.5%
Taylor expanded in x2 around 0
Applied rewrites100.0%
if -3.7000000000000002e148 < x1 < -2.2e21Initial program 55.3%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in x1 around 0
Applied rewrites99.8%
Taylor expanded in x2 around 0
Applied rewrites99.8%
if -2.2e21 < x1 < 3.99999999999999983e28Initial program 99.4%
Applied rewrites99.7%
Taylor expanded in x1 around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f6482.4
Applied rewrites82.4%
if 3.99999999999999983e28 < x1 Initial program 42.2%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.1%
Taylor expanded in x1 around 0
Applied rewrites96.2%
Taylor expanded in x2 around 0
Applied rewrites93.6%
Final simplification89.6%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (+ (* (fma (fma (fma 6.0 x1 -3.0) x1 -3.0) x1 -18.0) x1) x1)))
(if (<= x1 -1.8e+42)
t_0
(if (<= x1 4e+28)
(fma (fma (* (fma 2.0 x2 -3.0) x2) 4.0 -1.0) x1 (* -6.0 x2))
t_0))))
double code(double x1, double x2) {
double t_0 = (fma(fma(fma(6.0, x1, -3.0), x1, -3.0), x1, -18.0) * x1) + x1;
double tmp;
if (x1 <= -1.8e+42) {
tmp = t_0;
} else if (x1 <= 4e+28) {
tmp = fma(fma((fma(2.0, x2, -3.0) * x2), 4.0, -1.0), x1, (-6.0 * x2));
} else {
tmp = t_0;
}
return tmp;
}
function code(x1, x2) t_0 = Float64(Float64(fma(fma(fma(6.0, x1, -3.0), x1, -3.0), x1, -18.0) * x1) + x1) tmp = 0.0 if (x1 <= -1.8e+42) tmp = t_0; elseif (x1 <= 4e+28) tmp = fma(fma(Float64(fma(2.0, x2, -3.0) * x2), 4.0, -1.0), x1, Float64(-6.0 * x2)); else tmp = t_0; end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(N[(N[(N[(6.0 * x1 + -3.0), $MachinePrecision] * x1 + -3.0), $MachinePrecision] * x1 + -18.0), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]}, If[LessEqual[x1, -1.8e+42], t$95$0, If[LessEqual[x1, 4e+28], N[(N[(N[(N[(2.0 * x2 + -3.0), $MachinePrecision] * x2), $MachinePrecision] * 4.0 + -1.0), $MachinePrecision] * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(6, x1, -3\right), x1, -3\right), x1, -18\right) \cdot x1 + x1\\
\mathbf{if}\;x1 \leq -1.8 \cdot 10^{+42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x1 \leq 4 \cdot 10^{+28}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(2, x2, -3\right) \cdot x2, 4, -1\right), x1, -6 \cdot x2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x1 < -1.8e42 or 3.99999999999999983e28 < x1 Initial program 30.5%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.1%
Taylor expanded in x1 around 0
Applied rewrites98.1%
Taylor expanded in x2 around 0
Applied rewrites93.9%
if -1.8e42 < x1 < 3.99999999999999983e28Initial program 99.4%
Applied rewrites99.7%
Taylor expanded in x1 around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f6482.0
Applied rewrites82.0%
Final simplification87.8%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (+ (* (fma (fma (fma 6.0 x1 -3.0) x1 -3.0) x1 -18.0) x1) x1)))
(if (<= x1 -9.6e+20)
t_0
(if (<= x1 1.7)
(+ (fma (fma (fma -19.0 x1 9.0) x1 -2.0) x1 (* -6.0 x2)) x1)
t_0))))
double code(double x1, double x2) {
double t_0 = (fma(fma(fma(6.0, x1, -3.0), x1, -3.0), x1, -18.0) * x1) + x1;
double tmp;
if (x1 <= -9.6e+20) {
tmp = t_0;
} else if (x1 <= 1.7) {
tmp = fma(fma(fma(-19.0, x1, 9.0), x1, -2.0), x1, (-6.0 * x2)) + x1;
} else {
tmp = t_0;
}
return tmp;
}
function code(x1, x2) t_0 = Float64(Float64(fma(fma(fma(6.0, x1, -3.0), x1, -3.0), x1, -18.0) * x1) + x1) tmp = 0.0 if (x1 <= -9.6e+20) tmp = t_0; elseif (x1 <= 1.7) tmp = Float64(fma(fma(fma(-19.0, x1, 9.0), x1, -2.0), x1, Float64(-6.0 * x2)) + x1); else tmp = t_0; end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(N[(N[(N[(6.0 * x1 + -3.0), $MachinePrecision] * x1 + -3.0), $MachinePrecision] * x1 + -18.0), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]}, If[LessEqual[x1, -9.6e+20], t$95$0, If[LessEqual[x1, 1.7], N[(N[(N[(N[(-19.0 * x1 + 9.0), $MachinePrecision] * x1 + -2.0), $MachinePrecision] * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(6, x1, -3\right), x1, -3\right), x1, -18\right) \cdot x1 + x1\\
\mathbf{if}\;x1 \leq -9.6 \cdot 10^{+20}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x1 \leq 1.7:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-19, x1, 9\right), x1, -2\right), x1, -6 \cdot x2\right) + x1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x1 < -9.6e20 or 1.69999999999999996 < x1 Initial program 34.2%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.1%
Taylor expanded in x1 around 0
Applied rewrites96.1%
Taylor expanded in x2 around 0
Applied rewrites90.5%
if -9.6e20 < x1 < 1.69999999999999996Initial program 99.4%
Applied rewrites99.8%
Taylor expanded in x1 around 0
Applied rewrites69.9%
Taylor expanded in x2 around 0
Applied rewrites72.0%
Final simplification81.5%
(FPCore (x1 x2) :precision binary64 (if (<= x1 1.35) (+ (fma (fma (fma -19.0 x1 9.0) x1 -2.0) x1 (* -6.0 x2)) x1) (+ (fma (* x1 x1) x1 (* -6.0 x2)) x1)))
double code(double x1, double x2) {
double tmp;
if (x1 <= 1.35) {
tmp = fma(fma(fma(-19.0, x1, 9.0), x1, -2.0), x1, (-6.0 * x2)) + x1;
} else {
tmp = fma((x1 * x1), x1, (-6.0 * x2)) + x1;
}
return tmp;
}
function code(x1, x2) tmp = 0.0 if (x1 <= 1.35) tmp = Float64(fma(fma(fma(-19.0, x1, 9.0), x1, -2.0), x1, Float64(-6.0 * x2)) + x1); else tmp = Float64(fma(Float64(x1 * x1), x1, Float64(-6.0 * x2)) + x1); end return tmp end
code[x1_, x2_] := If[LessEqual[x1, 1.35], N[(N[(N[(N[(-19.0 * x1 + 9.0), $MachinePrecision] * x1 + -2.0), $MachinePrecision] * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], N[(N[(N[(x1 * x1), $MachinePrecision] * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x1 \leq 1.35:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-19, x1, 9\right), x1, -2\right), x1, -6 \cdot x2\right) + x1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x1 \cdot x1, x1, -6 \cdot x2\right) + x1\\
\end{array}
\end{array}
if x1 < 1.3500000000000001Initial program 72.5%
Applied rewrites81.0%
Taylor expanded in x1 around 0
Applied rewrites66.3%
Taylor expanded in x2 around 0
Applied rewrites74.5%
if 1.3500000000000001 < x1 Initial program 46.7%
Applied rewrites46.7%
Taylor expanded in x1 around 0
lower-*.f6469.1
Applied rewrites69.1%
Final simplification73.2%
(FPCore (x1 x2) :precision binary64 (if (<= x1 1.35) (+ (fma x2 -6.0 (* (fma (fma -19.0 x1 9.0) x1 -2.0) x1)) x1) (+ (fma (* x1 x1) x1 (* -6.0 x2)) x1)))
double code(double x1, double x2) {
double tmp;
if (x1 <= 1.35) {
tmp = fma(x2, -6.0, (fma(fma(-19.0, x1, 9.0), x1, -2.0) * x1)) + x1;
} else {
tmp = fma((x1 * x1), x1, (-6.0 * x2)) + x1;
}
return tmp;
}
function code(x1, x2) tmp = 0.0 if (x1 <= 1.35) tmp = Float64(fma(x2, -6.0, Float64(fma(fma(-19.0, x1, 9.0), x1, -2.0) * x1)) + x1); else tmp = Float64(fma(Float64(x1 * x1), x1, Float64(-6.0 * x2)) + x1); end return tmp end
code[x1_, x2_] := If[LessEqual[x1, 1.35], N[(N[(x2 * -6.0 + N[(N[(N[(-19.0 * x1 + 9.0), $MachinePrecision] * x1 + -2.0), $MachinePrecision] * x1), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], N[(N[(N[(x1 * x1), $MachinePrecision] * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x1 \leq 1.35:\\
\;\;\;\;\mathsf{fma}\left(x2, -6, \mathsf{fma}\left(\mathsf{fma}\left(-19, x1, 9\right), x1, -2\right) \cdot x1\right) + x1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x1 \cdot x1, x1, -6 \cdot x2\right) + x1\\
\end{array}
\end{array}
if x1 < 1.3500000000000001Initial program 72.5%
Applied rewrites81.0%
Taylor expanded in x1 around 0
Applied rewrites66.3%
Taylor expanded in x2 around 0
Applied rewrites74.5%
Applied rewrites74.5%
if 1.3500000000000001 < x1 Initial program 46.7%
Applied rewrites46.7%
Taylor expanded in x1 around 0
lower-*.f6469.1
Applied rewrites69.1%
Final simplification73.1%
(FPCore (x1 x2)
:precision binary64
(if (<= x1 -2.8e+21)
(+ (* (fma (fma -19.0 x1 9.0) x1 -2.0) x1) x1)
(if (<= x1 1.35)
(+ (fma -2.0 x1 (* -6.0 x2)) x1)
(+ (fma (* x1 x1) x1 (* -6.0 x2)) x1))))
double code(double x1, double x2) {
double tmp;
if (x1 <= -2.8e+21) {
tmp = (fma(fma(-19.0, x1, 9.0), x1, -2.0) * x1) + x1;
} else if (x1 <= 1.35) {
tmp = fma(-2.0, x1, (-6.0 * x2)) + x1;
} else {
tmp = fma((x1 * x1), x1, (-6.0 * x2)) + x1;
}
return tmp;
}
function code(x1, x2) tmp = 0.0 if (x1 <= -2.8e+21) tmp = Float64(Float64(fma(fma(-19.0, x1, 9.0), x1, -2.0) * x1) + x1); elseif (x1 <= 1.35) tmp = Float64(fma(-2.0, x1, Float64(-6.0 * x2)) + x1); else tmp = Float64(fma(Float64(x1 * x1), x1, Float64(-6.0 * x2)) + x1); end return tmp end
code[x1_, x2_] := If[LessEqual[x1, -2.8e+21], N[(N[(N[(N[(-19.0 * x1 + 9.0), $MachinePrecision] * x1 + -2.0), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision], If[LessEqual[x1, 1.35], N[(N[(-2.0 * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], N[(N[(N[(x1 * x1), $MachinePrecision] * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -2.8 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-19, x1, 9\right), x1, -2\right) \cdot x1 + x1\\
\mathbf{elif}\;x1 \leq 1.35:\\
\;\;\;\;\mathsf{fma}\left(-2, x1, -6 \cdot x2\right) + x1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x1 \cdot x1, x1, -6 \cdot x2\right) + x1\\
\end{array}
\end{array}
if x1 < -2.8e21Initial program 22.3%
Applied rewrites46.2%
Taylor expanded in x1 around 0
Applied rewrites59.6%
Taylor expanded in x2 around 0
Applied rewrites79.1%
if -2.8e21 < x1 < 1.3500000000000001Initial program 99.4%
Applied rewrites99.8%
Taylor expanded in x1 around 0
Applied rewrites69.9%
Taylor expanded in x2 around 0
Applied rewrites72.0%
Taylor expanded in x1 around 0
Applied rewrites71.7%
if 1.3500000000000001 < x1 Initial program 46.7%
Applied rewrites46.7%
Taylor expanded in x1 around 0
lower-*.f6469.1
Applied rewrites69.1%
Final simplification73.0%
(FPCore (x1 x2)
:precision binary64
(if (<= x1 -1.55e+40)
(+ (* (* (fma 8.0 x1 12.0) x2) x1) x1)
(if (<= x1 1.35)
(+ (fma -2.0 x1 (* -6.0 x2)) x1)
(+ (fma (* x1 x1) x1 (* -6.0 x2)) x1))))
double code(double x1, double x2) {
double tmp;
if (x1 <= -1.55e+40) {
tmp = ((fma(8.0, x1, 12.0) * x2) * x1) + x1;
} else if (x1 <= 1.35) {
tmp = fma(-2.0, x1, (-6.0 * x2)) + x1;
} else {
tmp = fma((x1 * x1), x1, (-6.0 * x2)) + x1;
}
return tmp;
}
function code(x1, x2) tmp = 0.0 if (x1 <= -1.55e+40) tmp = Float64(Float64(Float64(fma(8.0, x1, 12.0) * x2) * x1) + x1); elseif (x1 <= 1.35) tmp = Float64(fma(-2.0, x1, Float64(-6.0 * x2)) + x1); else tmp = Float64(fma(Float64(x1 * x1), x1, Float64(-6.0 * x2)) + x1); end return tmp end
code[x1_, x2_] := If[LessEqual[x1, -1.55e+40], N[(N[(N[(N[(8.0 * x1 + 12.0), $MachinePrecision] * x2), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision], If[LessEqual[x1, 1.35], N[(N[(-2.0 * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], N[(N[(N[(x1 * x1), $MachinePrecision] * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -1.55 \cdot 10^{+40}:\\
\;\;\;\;\left(\mathsf{fma}\left(8, x1, 12\right) \cdot x2\right) \cdot x1 + x1\\
\mathbf{elif}\;x1 \leq 1.35:\\
\;\;\;\;\mathsf{fma}\left(-2, x1, -6 \cdot x2\right) + x1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x1 \cdot x1, x1, -6 \cdot x2\right) + x1\\
\end{array}
\end{array}
if x1 < -1.5499999999999999e40Initial program 21.1%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in x1 around 0
Applied rewrites99.9%
Taylor expanded in x2 around inf
Applied rewrites38.5%
if -1.5499999999999999e40 < x1 < 1.3500000000000001Initial program 99.4%
Applied rewrites99.7%
Taylor expanded in x1 around 0
Applied rewrites69.4%
Taylor expanded in x2 around 0
Applied rewrites71.5%
Taylor expanded in x1 around 0
Applied rewrites71.2%
if 1.3500000000000001 < x1 Initial program 46.7%
Applied rewrites46.7%
Taylor expanded in x1 around 0
lower-*.f6469.1
Applied rewrites69.1%
Final simplification62.3%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (+ (* (* (fma 8.0 x1 12.0) x2) x1) x1)))
(if (<= x1 -1.55e+40)
t_0
(if (<= x1 1.35) (+ (fma -2.0 x1 (* -6.0 x2)) x1) t_0))))
double code(double x1, double x2) {
double t_0 = ((fma(8.0, x1, 12.0) * x2) * x1) + x1;
double tmp;
if (x1 <= -1.55e+40) {
tmp = t_0;
} else if (x1 <= 1.35) {
tmp = fma(-2.0, x1, (-6.0 * x2)) + x1;
} else {
tmp = t_0;
}
return tmp;
}
function code(x1, x2) t_0 = Float64(Float64(Float64(fma(8.0, x1, 12.0) * x2) * x1) + x1) tmp = 0.0 if (x1 <= -1.55e+40) tmp = t_0; elseif (x1 <= 1.35) tmp = Float64(fma(-2.0, x1, Float64(-6.0 * x2)) + x1); else tmp = t_0; end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(N[(N[(8.0 * x1 + 12.0), $MachinePrecision] * x2), $MachinePrecision] * x1), $MachinePrecision] + x1), $MachinePrecision]}, If[LessEqual[x1, -1.55e+40], t$95$0, If[LessEqual[x1, 1.35], N[(N[(-2.0 * x1 + N[(-6.0 * x2), $MachinePrecision]), $MachinePrecision] + x1), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{fma}\left(8, x1, 12\right) \cdot x2\right) \cdot x1 + x1\\
\mathbf{if}\;x1 \leq -1.55 \cdot 10^{+40}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x1 \leq 1.35:\\
\;\;\;\;\mathsf{fma}\left(-2, x1, -6 \cdot x2\right) + x1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x1 < -1.5499999999999999e40 or 1.3500000000000001 < x1 Initial program 33.7%
Taylor expanded in x1 around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.0%
Taylor expanded in x1 around 0
Applied rewrites96.0%
Taylor expanded in x2 around inf
Applied rewrites30.0%
if -1.5499999999999999e40 < x1 < 1.3500000000000001Initial program 99.4%
Applied rewrites99.7%
Taylor expanded in x1 around 0
Applied rewrites69.4%
Taylor expanded in x2 around 0
Applied rewrites71.5%
Taylor expanded in x1 around 0
Applied rewrites71.2%
Final simplification50.3%
(FPCore (x1 x2) :precision binary64 (+ (* -6.0 x2) x1))
double code(double x1, double x2) {
return (-6.0 * x2) + x1;
}
real(8) function code(x1, x2)
real(8), intent (in) :: x1
real(8), intent (in) :: x2
code = ((-6.0d0) * x2) + x1
end function
public static double code(double x1, double x2) {
return (-6.0 * x2) + x1;
}
def code(x1, x2): return (-6.0 * x2) + x1
function code(x1, x2) return Float64(Float64(-6.0 * x2) + x1) end
function tmp = code(x1, x2) tmp = (-6.0 * x2) + x1; end
code[x1_, x2_] := N[(N[(-6.0 * x2), $MachinePrecision] + x1), $MachinePrecision]
\begin{array}{l}
\\
-6 \cdot x2 + x1
\end{array}
Initial program 66.0%
Taylor expanded in x1 around 0
lower-*.f6427.0
Applied rewrites27.0%
Final simplification27.0%
(FPCore (x1 x2) :precision binary64 (* -6.0 x2))
double code(double x1, double x2) {
return -6.0 * x2;
}
real(8) function code(x1, x2)
real(8), intent (in) :: x1
real(8), intent (in) :: x2
code = (-6.0d0) * x2
end function
public static double code(double x1, double x2) {
return -6.0 * x2;
}
def code(x1, x2): return -6.0 * x2
function code(x1, x2) return Float64(-6.0 * x2) end
function tmp = code(x1, x2) tmp = -6.0 * x2; end
code[x1_, x2_] := N[(-6.0 * x2), $MachinePrecision]
\begin{array}{l}
\\
-6 \cdot x2
\end{array}
Initial program 66.0%
Applied rewrites72.5%
Applied rewrites72.5%
Taylor expanded in x1 around 0
lower-*.f6426.8
Applied rewrites26.8%
herbie shell --seed 2024295
(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))))))