
(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 9 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 (/ (- (fma x1 (* x1 3.0) (* 2.0 x2)) x1) (fma x1 x1 1.0)))
(t_1 (* x1 (* x1 3.0)))
(t_2 (+ (* x1 x1) 1.0))
(t_3 (/ (- (+ t_1 (* 2.0 x2)) x1) t_2))
(t_4 (* 3.0 (* x1 x1))))
(if (<=
(+
x1
(+
(+
x1
(+
(+
(*
t_2
(+
(* (* (* x1 2.0) t_3) (- t_3 3.0))
(* (* x1 x1) (- (* t_3 4.0) 6.0))))
(* t_1 t_3))
(* x1 (* x1 x1))))
(* 3.0 (/ (- (- t_1 (* 2.0 x2)) x1) t_2))))
INFINITY)
(+
x1
(fma
3.0
(/ (- t_4 (fma 2.0 x2 x1)) (fma x1 x1 1.0))
(+
x1
(fma
(fma x1 x1 1.0)
(fma x1 (* x1 (fma t_0 4.0 -6.0)) (* (* x1 (* 2.0 t_0)) (+ t_0 -3.0)))
(fma t_4 t_0 (pow x1 3.0))))))
(*
x1
(+
(+ -1.0 (* -2.0 (+ -1.0 (* 3.0 (- 3.0 (* 2.0 x2))))))
(*
x1
(+ 9.0 (+ (* 4.0 (- (* 2.0 x2) 3.0)) (* x1 (- (* x1 6.0) 3.0))))))))))
double code(double x1, double x2) {
double t_0 = (fma(x1, (x1 * 3.0), (2.0 * x2)) - x1) / fma(x1, x1, 1.0);
double t_1 = x1 * (x1 * 3.0);
double t_2 = (x1 * x1) + 1.0;
double t_3 = ((t_1 + (2.0 * x2)) - x1) / t_2;
double t_4 = 3.0 * (x1 * x1);
double tmp;
if ((x1 + ((x1 + (((t_2 * ((((x1 * 2.0) * t_3) * (t_3 - 3.0)) + ((x1 * x1) * ((t_3 * 4.0) - 6.0)))) + (t_1 * t_3)) + (x1 * (x1 * x1)))) + (3.0 * (((t_1 - (2.0 * x2)) - x1) / t_2)))) <= ((double) INFINITY)) {
tmp = x1 + fma(3.0, ((t_4 - fma(2.0, x2, x1)) / fma(x1, x1, 1.0)), (x1 + fma(fma(x1, x1, 1.0), fma(x1, (x1 * fma(t_0, 4.0, -6.0)), ((x1 * (2.0 * t_0)) * (t_0 + -3.0))), fma(t_4, t_0, pow(x1, 3.0)))));
} else {
tmp = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))))));
}
return tmp;
}
function code(x1, x2) t_0 = Float64(Float64(fma(x1, Float64(x1 * 3.0), Float64(2.0 * x2)) - x1) / fma(x1, x1, 1.0)) t_1 = Float64(x1 * Float64(x1 * 3.0)) t_2 = Float64(Float64(x1 * x1) + 1.0) t_3 = Float64(Float64(Float64(t_1 + Float64(2.0 * x2)) - x1) / t_2) t_4 = Float64(3.0 * Float64(x1 * x1)) tmp = 0.0 if (Float64(x1 + Float64(Float64(x1 + Float64(Float64(Float64(t_2 * Float64(Float64(Float64(Float64(x1 * 2.0) * t_3) * Float64(t_3 - 3.0)) + Float64(Float64(x1 * x1) * Float64(Float64(t_3 * 4.0) - 6.0)))) + Float64(t_1 * t_3)) + Float64(x1 * Float64(x1 * x1)))) + Float64(3.0 * Float64(Float64(Float64(t_1 - Float64(2.0 * x2)) - x1) / t_2)))) <= Inf) tmp = Float64(x1 + fma(3.0, Float64(Float64(t_4 - fma(2.0, x2, x1)) / fma(x1, x1, 1.0)), Float64(x1 + fma(fma(x1, x1, 1.0), fma(x1, Float64(x1 * fma(t_0, 4.0, -6.0)), Float64(Float64(x1 * Float64(2.0 * t_0)) * Float64(t_0 + -3.0))), fma(t_4, t_0, (x1 ^ 3.0)))))); else tmp = Float64(x1 * Float64(Float64(-1.0 + Float64(-2.0 * Float64(-1.0 + Float64(3.0 * Float64(3.0 - Float64(2.0 * x2)))))) + Float64(x1 * Float64(9.0 + Float64(Float64(4.0 * Float64(Float64(2.0 * x2) - 3.0)) + Float64(x1 * Float64(Float64(x1 * 6.0) - 3.0))))))); end return tmp end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(N[(x1 * N[(x1 * 3.0), $MachinePrecision] + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(t$95$1 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(3.0 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x1 + N[(N[(x1 + N[(N[(N[(t$95$2 * N[(N[(N[(N[(x1 * 2.0), $MachinePrecision] * t$95$3), $MachinePrecision] * N[(t$95$3 - 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * N[(N[(t$95$3 * 4.0), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * t$95$3), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(3.0 * N[(N[(N[(t$95$1 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(x1 + N[(3.0 * N[(N[(t$95$4 - N[(2.0 * x2 + x1), $MachinePrecision]), $MachinePrecision] / N[(x1 * x1 + 1.0), $MachinePrecision]), $MachinePrecision] + N[(x1 + N[(N[(x1 * x1 + 1.0), $MachinePrecision] * N[(x1 * N[(x1 * N[(t$95$0 * 4.0 + -6.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$4 * t$95$0 + N[Power[x1, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x1 * N[(N[(-1.0 + N[(-2.0 * N[(-1.0 + N[(3.0 * N[(3.0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(9.0 + N[(N[(4.0 * N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(N[(x1 * 6.0), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(x1, x1 \cdot 3, 2 \cdot x2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}\\
t_1 := x1 \cdot \left(x1 \cdot 3\right)\\
t_2 := x1 \cdot x1 + 1\\
t_3 := \frac{\left(t\_1 + 2 \cdot x2\right) - x1}{t\_2}\\
t_4 := 3 \cdot \left(x1 \cdot x1\right)\\
\mathbf{if}\;x1 + \left(\left(x1 + \left(\left(t\_2 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t\_3\right) \cdot \left(t\_3 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(t\_3 \cdot 4 - 6\right)\right) + t\_1 \cdot t\_3\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right) + 3 \cdot \frac{\left(t\_1 - 2 \cdot x2\right) - x1}{t\_2}\right) \leq \infty:\\
\;\;\;\;x1 + \mathsf{fma}\left(3, \frac{t\_4 - \mathsf{fma}\left(2, x2, x1\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1, x1 \cdot \mathsf{fma}\left(t\_0, 4, -6\right), \left(x1 \cdot \left(2 \cdot t\_0\right)\right) \cdot \left(t\_0 + -3\right)\right), \mathsf{fma}\left(t\_4, t\_0, {x1}^{3}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x1 \cdot \left(\left(-1 + -2 \cdot \left(-1 + 3 \cdot \left(3 - 2 \cdot x2\right)\right)\right) + x1 \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\right)\\
\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%
Simplified99.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%
Simplified0.0%
Taylor expanded in x1 around -inf 100.0%
Taylor expanded in x1 around 0 100.0%
Final simplification99.8%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (* x1 (* x1 3.0)))
(t_1 (+ (* x1 x1) 1.0))
(t_2 (/ (- (+ t_0 (* 2.0 x2)) x1) t_1))
(t_3
(+
x1
(+
(+
x1
(+
(+
(*
t_1
(+
(* (* (* x1 2.0) t_2) (- t_2 3.0))
(* (* x1 x1) (- (* t_2 4.0) 6.0))))
(* t_0 t_2))
(* x1 (* x1 x1))))
(* 3.0 (/ (- (- t_0 (* 2.0 x2)) x1) t_1))))))
(if (<= t_3 INFINITY)
t_3
(*
x1
(+
(+ -1.0 (* -2.0 (+ -1.0 (* 3.0 (- 3.0 (* 2.0 x2))))))
(*
x1
(+ 9.0 (+ (* 4.0 (- (* 2.0 x2) 3.0)) (* x1 (- (* x1 6.0) 3.0))))))))))
double code(double x1, double x2) {
double t_0 = x1 * (x1 * 3.0);
double t_1 = (x1 * x1) + 1.0;
double t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
double t_3 = x1 + ((x1 + (((t_1 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((t_2 * 4.0) - 6.0)))) + (t_0 * t_2)) + (x1 * (x1 * x1)))) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)));
double tmp;
if (t_3 <= ((double) INFINITY)) {
tmp = t_3;
} else {
tmp = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))))));
}
return tmp;
}
public static double code(double x1, double x2) {
double t_0 = x1 * (x1 * 3.0);
double t_1 = (x1 * x1) + 1.0;
double t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1;
double t_3 = x1 + ((x1 + (((t_1 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((t_2 * 4.0) - 6.0)))) + (t_0 * t_2)) + (x1 * (x1 * x1)))) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1)));
double tmp;
if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = t_3;
} else {
tmp = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0))))));
}
return tmp;
}
def code(x1, x2): t_0 = x1 * (x1 * 3.0) t_1 = (x1 * x1) + 1.0 t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1 t_3 = x1 + ((x1 + (((t_1 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((t_2 * 4.0) - 6.0)))) + (t_0 * t_2)) + (x1 * (x1 * x1)))) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1))) tmp = 0 if t_3 <= math.inf: tmp = t_3 else: tmp = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0)))))) return tmp
function code(x1, x2) t_0 = Float64(x1 * Float64(x1 * 3.0)) t_1 = Float64(Float64(x1 * x1) + 1.0) t_2 = Float64(Float64(Float64(t_0 + Float64(2.0 * x2)) - x1) / t_1) t_3 = Float64(x1 + Float64(Float64(x1 + Float64(Float64(Float64(t_1 * Float64(Float64(Float64(Float64(x1 * 2.0) * t_2) * Float64(t_2 - 3.0)) + Float64(Float64(x1 * x1) * Float64(Float64(t_2 * 4.0) - 6.0)))) + Float64(t_0 * t_2)) + Float64(x1 * Float64(x1 * x1)))) + Float64(3.0 * Float64(Float64(Float64(t_0 - Float64(2.0 * x2)) - x1) / t_1)))) tmp = 0.0 if (t_3 <= Inf) tmp = t_3; else tmp = Float64(x1 * Float64(Float64(-1.0 + Float64(-2.0 * Float64(-1.0 + Float64(3.0 * Float64(3.0 - Float64(2.0 * x2)))))) + Float64(x1 * Float64(9.0 + Float64(Float64(4.0 * Float64(Float64(2.0 * x2) - 3.0)) + Float64(x1 * Float64(Float64(x1 * 6.0) - 3.0))))))); end return tmp end
function tmp_2 = code(x1, x2) t_0 = x1 * (x1 * 3.0); t_1 = (x1 * x1) + 1.0; t_2 = ((t_0 + (2.0 * x2)) - x1) / t_1; t_3 = x1 + ((x1 + (((t_1 * ((((x1 * 2.0) * t_2) * (t_2 - 3.0)) + ((x1 * x1) * ((t_2 * 4.0) - 6.0)))) + (t_0 * t_2)) + (x1 * (x1 * x1)))) + (3.0 * (((t_0 - (2.0 * x2)) - x1) / t_1))); tmp = 0.0; if (t_3 <= Inf) tmp = t_3; else tmp = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + ((4.0 * ((2.0 * x2) - 3.0)) + (x1 * ((x1 * 6.0) - 3.0)))))); end tmp_2 = tmp; end
code[x1_, x2_] := Block[{t$95$0 = N[(x1 * N[(x1 * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x1 * x1), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$0 + N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(x1 + N[(N[(x1 + N[(N[(N[(t$95$1 * N[(N[(N[(N[(x1 * 2.0), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(t$95$2 - 3.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x1 * x1), $MachinePrecision] * N[(N[(t$95$2 * 4.0), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * t$95$2), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(x1 * x1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(3.0 * N[(N[(N[(t$95$0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision] - x1), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, Infinity], t$95$3, N[(x1 * N[(N[(-1.0 + N[(-2.0 * N[(-1.0 + N[(3.0 * N[(3.0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(9.0 + N[(N[(4.0 * N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(N[(x1 * 6.0), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x1 \cdot \left(x1 \cdot 3\right)\\
t_1 := x1 \cdot x1 + 1\\
t_2 := \frac{\left(t\_0 + 2 \cdot x2\right) - x1}{t\_1}\\
t_3 := x1 + \left(\left(x1 + \left(\left(t\_1 \cdot \left(\left(\left(x1 \cdot 2\right) \cdot t\_2\right) \cdot \left(t\_2 - 3\right) + \left(x1 \cdot x1\right) \cdot \left(t\_2 \cdot 4 - 6\right)\right) + t\_0 \cdot t\_2\right) + x1 \cdot \left(x1 \cdot x1\right)\right)\right) + 3 \cdot \frac{\left(t\_0 - 2 \cdot x2\right) - x1}{t\_1}\right)\\
\mathbf{if}\;t\_3 \leq \infty:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;x1 \cdot \left(\left(-1 + -2 \cdot \left(-1 + 3 \cdot \left(3 - 2 \cdot x2\right)\right)\right) + x1 \cdot \left(9 + \left(4 \cdot \left(2 \cdot x2 - 3\right) + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\right)\\
\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%
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%
Simplified0.0%
Taylor expanded in x1 around -inf 100.0%
Taylor expanded in x1 around 0 100.0%
Final simplification99.5%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (- (* 2.0 x2) 3.0))
(t_1 (- 3.0 (* 2.0 x2)))
(t_2
(+
(*
x1
(+
-1.0
(+
(* 4.0 (* x2 t_0))
(*
x1
(-
(+
(* 2.0 (+ (* x2 -2.0) t_1))
(+ (* 3.0 (- 3.0 (* x2 -2.0))) (+ (* x2 6.0) (* x2 8.0))))
6.0)))))
(* x2 -6.0)))
(t_3
(*
x1
(+
(+ -1.0 (* -2.0 (+ -1.0 (* 3.0 t_1))))
(* x1 (+ 9.0 (+ (* 4.0 t_0) (* x1 (- (* x1 6.0) 3.0)))))))))
(if (<= x1 -55000000.0)
t_3
(if (<= x1 -5.7e-236)
t_2
(if (<= x1 6.1e-279) (* x2 -6.0) (if (<= x1 57000.0) t_2 t_3))))))
double code(double x1, double x2) {
double t_0 = (2.0 * x2) - 3.0;
double t_1 = 3.0 - (2.0 * x2);
double t_2 = (x1 * (-1.0 + ((4.0 * (x2 * t_0)) + (x1 * (((2.0 * ((x2 * -2.0) + t_1)) + ((3.0 * (3.0 - (x2 * -2.0))) + ((x2 * 6.0) + (x2 * 8.0)))) - 6.0))))) + (x2 * -6.0);
double t_3 = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * t_1)))) + (x1 * (9.0 + ((4.0 * t_0) + (x1 * ((x1 * 6.0) - 3.0))))));
double tmp;
if (x1 <= -55000000.0) {
tmp = t_3;
} else if (x1 <= -5.7e-236) {
tmp = t_2;
} else if (x1 <= 6.1e-279) {
tmp = x2 * -6.0;
} else if (x1 <= 57000.0) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(x1, x2)
real(8), intent (in) :: x1
real(8), intent (in) :: x2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (2.0d0 * x2) - 3.0d0
t_1 = 3.0d0 - (2.0d0 * x2)
t_2 = (x1 * ((-1.0d0) + ((4.0d0 * (x2 * t_0)) + (x1 * (((2.0d0 * ((x2 * (-2.0d0)) + t_1)) + ((3.0d0 * (3.0d0 - (x2 * (-2.0d0)))) + ((x2 * 6.0d0) + (x2 * 8.0d0)))) - 6.0d0))))) + (x2 * (-6.0d0))
t_3 = x1 * (((-1.0d0) + ((-2.0d0) * ((-1.0d0) + (3.0d0 * t_1)))) + (x1 * (9.0d0 + ((4.0d0 * t_0) + (x1 * ((x1 * 6.0d0) - 3.0d0))))))
if (x1 <= (-55000000.0d0)) then
tmp = t_3
else if (x1 <= (-5.7d-236)) then
tmp = t_2
else if (x1 <= 6.1d-279) then
tmp = x2 * (-6.0d0)
else if (x1 <= 57000.0d0) then
tmp = t_2
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x1, double x2) {
double t_0 = (2.0 * x2) - 3.0;
double t_1 = 3.0 - (2.0 * x2);
double t_2 = (x1 * (-1.0 + ((4.0 * (x2 * t_0)) + (x1 * (((2.0 * ((x2 * -2.0) + t_1)) + ((3.0 * (3.0 - (x2 * -2.0))) + ((x2 * 6.0) + (x2 * 8.0)))) - 6.0))))) + (x2 * -6.0);
double t_3 = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * t_1)))) + (x1 * (9.0 + ((4.0 * t_0) + (x1 * ((x1 * 6.0) - 3.0))))));
double tmp;
if (x1 <= -55000000.0) {
tmp = t_3;
} else if (x1 <= -5.7e-236) {
tmp = t_2;
} else if (x1 <= 6.1e-279) {
tmp = x2 * -6.0;
} else if (x1 <= 57000.0) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
def code(x1, x2): t_0 = (2.0 * x2) - 3.0 t_1 = 3.0 - (2.0 * x2) t_2 = (x1 * (-1.0 + ((4.0 * (x2 * t_0)) + (x1 * (((2.0 * ((x2 * -2.0) + t_1)) + ((3.0 * (3.0 - (x2 * -2.0))) + ((x2 * 6.0) + (x2 * 8.0)))) - 6.0))))) + (x2 * -6.0) t_3 = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * t_1)))) + (x1 * (9.0 + ((4.0 * t_0) + (x1 * ((x1 * 6.0) - 3.0)))))) tmp = 0 if x1 <= -55000000.0: tmp = t_3 elif x1 <= -5.7e-236: tmp = t_2 elif x1 <= 6.1e-279: tmp = x2 * -6.0 elif x1 <= 57000.0: tmp = t_2 else: tmp = t_3 return tmp
function code(x1, x2) t_0 = Float64(Float64(2.0 * x2) - 3.0) t_1 = Float64(3.0 - Float64(2.0 * x2)) t_2 = Float64(Float64(x1 * Float64(-1.0 + Float64(Float64(4.0 * Float64(x2 * t_0)) + Float64(x1 * Float64(Float64(Float64(2.0 * Float64(Float64(x2 * -2.0) + t_1)) + Float64(Float64(3.0 * Float64(3.0 - Float64(x2 * -2.0))) + Float64(Float64(x2 * 6.0) + Float64(x2 * 8.0)))) - 6.0))))) + Float64(x2 * -6.0)) t_3 = Float64(x1 * Float64(Float64(-1.0 + Float64(-2.0 * Float64(-1.0 + Float64(3.0 * t_1)))) + Float64(x1 * Float64(9.0 + Float64(Float64(4.0 * t_0) + Float64(x1 * Float64(Float64(x1 * 6.0) - 3.0))))))) tmp = 0.0 if (x1 <= -55000000.0) tmp = t_3; elseif (x1 <= -5.7e-236) tmp = t_2; elseif (x1 <= 6.1e-279) tmp = Float64(x2 * -6.0); elseif (x1 <= 57000.0) tmp = t_2; else tmp = t_3; end return tmp end
function tmp_2 = code(x1, x2) t_0 = (2.0 * x2) - 3.0; t_1 = 3.0 - (2.0 * x2); t_2 = (x1 * (-1.0 + ((4.0 * (x2 * t_0)) + (x1 * (((2.0 * ((x2 * -2.0) + t_1)) + ((3.0 * (3.0 - (x2 * -2.0))) + ((x2 * 6.0) + (x2 * 8.0)))) - 6.0))))) + (x2 * -6.0); t_3 = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * t_1)))) + (x1 * (9.0 + ((4.0 * t_0) + (x1 * ((x1 * 6.0) - 3.0)))))); tmp = 0.0; if (x1 <= -55000000.0) tmp = t_3; elseif (x1 <= -5.7e-236) tmp = t_2; elseif (x1 <= 6.1e-279) tmp = x2 * -6.0; elseif (x1 <= 57000.0) tmp = t_2; else tmp = t_3; end tmp_2 = tmp; end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]}, Block[{t$95$1 = N[(3.0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x1 * N[(-1.0 + N[(N[(4.0 * N[(x2 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(N[(N[(2.0 * N[(N[(x2 * -2.0), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(3.0 * N[(3.0 - N[(x2 * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x2 * 6.0), $MachinePrecision] + N[(x2 * 8.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x2 * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x1 * N[(N[(-1.0 + N[(-2.0 * N[(-1.0 + N[(3.0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(9.0 + N[(N[(4.0 * t$95$0), $MachinePrecision] + N[(x1 * N[(N[(x1 * 6.0), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x1, -55000000.0], t$95$3, If[LessEqual[x1, -5.7e-236], t$95$2, If[LessEqual[x1, 6.1e-279], N[(x2 * -6.0), $MachinePrecision], If[LessEqual[x1, 57000.0], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot x2 - 3\\
t_1 := 3 - 2 \cdot x2\\
t_2 := x1 \cdot \left(-1 + \left(4 \cdot \left(x2 \cdot t\_0\right) + x1 \cdot \left(\left(2 \cdot \left(x2 \cdot -2 + t\_1\right) + \left(3 \cdot \left(3 - x2 \cdot -2\right) + \left(x2 \cdot 6 + x2 \cdot 8\right)\right)\right) - 6\right)\right)\right) + x2 \cdot -6\\
t_3 := x1 \cdot \left(\left(-1 + -2 \cdot \left(-1 + 3 \cdot t\_1\right)\right) + x1 \cdot \left(9 + \left(4 \cdot t\_0 + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\right)\\
\mathbf{if}\;x1 \leq -55000000:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;x1 \leq -5.7 \cdot 10^{-236}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x1 \leq 6.1 \cdot 10^{-279}:\\
\;\;\;\;x2 \cdot -6\\
\mathbf{elif}\;x1 \leq 57000:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if x1 < -5.5e7 or 57000 < x1 Initial program 47.6%
Simplified47.6%
Taylor expanded in x1 around -inf 95.7%
Taylor expanded in x1 around 0 95.7%
if -5.5e7 < x1 < -5.69999999999999987e-236 or 6.0999999999999999e-279 < x1 < 57000Initial program 99.3%
Simplified99.8%
Taylor expanded in x1 around 0 95.1%
if -5.69999999999999987e-236 < x1 < 6.0999999999999999e-279Initial program 99.7%
Simplified99.8%
Taylor expanded in x1 around 0 93.5%
*-commutative93.5%
Simplified93.5%
Final simplification95.2%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (- (* 2.0 x2) 3.0))
(t_1 (+ (* x2 -6.0) (* x1 (+ -1.0 (* 4.0 (* x2 t_0))))))
(t_2
(*
x1
(+
(+ -1.0 (* -2.0 (+ -1.0 (* 3.0 (- 3.0 (* 2.0 x2))))))
(* x1 (+ 9.0 (+ (* 4.0 t_0) (* x1 (- (* x1 6.0) 3.0)))))))))
(if (<= x1 -52000000.0)
t_2
(if (<= x1 -6e-236)
t_1
(if (<= x1 2.4e-280) (* x2 -6.0) (if (<= x1 22000.0) t_1 t_2))))))
double code(double x1, double x2) {
double t_0 = (2.0 * x2) - 3.0;
double t_1 = (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * t_0))));
double t_2 = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + ((4.0 * t_0) + (x1 * ((x1 * 6.0) - 3.0))))));
double tmp;
if (x1 <= -52000000.0) {
tmp = t_2;
} else if (x1 <= -6e-236) {
tmp = t_1;
} else if (x1 <= 2.4e-280) {
tmp = x2 * -6.0;
} else if (x1 <= 22000.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x1, x2)
real(8), intent (in) :: x1
real(8), intent (in) :: x2
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (2.0d0 * x2) - 3.0d0
t_1 = (x2 * (-6.0d0)) + (x1 * ((-1.0d0) + (4.0d0 * (x2 * t_0))))
t_2 = x1 * (((-1.0d0) + ((-2.0d0) * ((-1.0d0) + (3.0d0 * (3.0d0 - (2.0d0 * x2)))))) + (x1 * (9.0d0 + ((4.0d0 * t_0) + (x1 * ((x1 * 6.0d0) - 3.0d0))))))
if (x1 <= (-52000000.0d0)) then
tmp = t_2
else if (x1 <= (-6d-236)) then
tmp = t_1
else if (x1 <= 2.4d-280) then
tmp = x2 * (-6.0d0)
else if (x1 <= 22000.0d0) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x1, double x2) {
double t_0 = (2.0 * x2) - 3.0;
double t_1 = (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * t_0))));
double t_2 = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + ((4.0 * t_0) + (x1 * ((x1 * 6.0) - 3.0))))));
double tmp;
if (x1 <= -52000000.0) {
tmp = t_2;
} else if (x1 <= -6e-236) {
tmp = t_1;
} else if (x1 <= 2.4e-280) {
tmp = x2 * -6.0;
} else if (x1 <= 22000.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x1, x2): t_0 = (2.0 * x2) - 3.0 t_1 = (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * t_0)))) t_2 = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + ((4.0 * t_0) + (x1 * ((x1 * 6.0) - 3.0)))))) tmp = 0 if x1 <= -52000000.0: tmp = t_2 elif x1 <= -6e-236: tmp = t_1 elif x1 <= 2.4e-280: tmp = x2 * -6.0 elif x1 <= 22000.0: tmp = t_1 else: tmp = t_2 return tmp
function code(x1, x2) t_0 = Float64(Float64(2.0 * x2) - 3.0) t_1 = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(-1.0 + Float64(4.0 * Float64(x2 * t_0))))) t_2 = Float64(x1 * Float64(Float64(-1.0 + Float64(-2.0 * Float64(-1.0 + Float64(3.0 * Float64(3.0 - Float64(2.0 * x2)))))) + Float64(x1 * Float64(9.0 + Float64(Float64(4.0 * t_0) + Float64(x1 * Float64(Float64(x1 * 6.0) - 3.0))))))) tmp = 0.0 if (x1 <= -52000000.0) tmp = t_2; elseif (x1 <= -6e-236) tmp = t_1; elseif (x1 <= 2.4e-280) tmp = Float64(x2 * -6.0); elseif (x1 <= 22000.0) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x1, x2) t_0 = (2.0 * x2) - 3.0; t_1 = (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * t_0)))); t_2 = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + ((4.0 * t_0) + (x1 * ((x1 * 6.0) - 3.0)))))); tmp = 0.0; if (x1 <= -52000000.0) tmp = t_2; elseif (x1 <= -6e-236) tmp = t_1; elseif (x1 <= 2.4e-280) tmp = x2 * -6.0; elseif (x1 <= 22000.0) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(-1.0 + N[(4.0 * N[(x2 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x1 * N[(N[(-1.0 + N[(-2.0 * N[(-1.0 + N[(3.0 * N[(3.0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(9.0 + N[(N[(4.0 * t$95$0), $MachinePrecision] + N[(x1 * N[(N[(x1 * 6.0), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x1, -52000000.0], t$95$2, If[LessEqual[x1, -6e-236], t$95$1, If[LessEqual[x1, 2.4e-280], N[(x2 * -6.0), $MachinePrecision], If[LessEqual[x1, 22000.0], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot x2 - 3\\
t_1 := x2 \cdot -6 + x1 \cdot \left(-1 + 4 \cdot \left(x2 \cdot t\_0\right)\right)\\
t_2 := x1 \cdot \left(\left(-1 + -2 \cdot \left(-1 + 3 \cdot \left(3 - 2 \cdot x2\right)\right)\right) + x1 \cdot \left(9 + \left(4 \cdot t\_0 + x1 \cdot \left(x1 \cdot 6 - 3\right)\right)\right)\right)\\
\mathbf{if}\;x1 \leq -52000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x1 \leq -6 \cdot 10^{-236}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x1 \leq 2.4 \cdot 10^{-280}:\\
\;\;\;\;x2 \cdot -6\\
\mathbf{elif}\;x1 \leq 22000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x1 < -5.2e7 or 22000 < x1 Initial program 47.6%
Simplified47.6%
Taylor expanded in x1 around -inf 95.7%
Taylor expanded in x1 around 0 95.7%
if -5.2e7 < x1 < -6.00000000000000027e-236 or 2.3999999999999998e-280 < x1 < 22000Initial program 99.3%
Simplified99.8%
Taylor expanded in x1 around 0 94.9%
if -6.00000000000000027e-236 < x1 < 2.3999999999999998e-280Initial program 99.7%
Simplified99.8%
Taylor expanded in x1 around 0 93.5%
*-commutative93.5%
Simplified93.5%
Final simplification95.1%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (- (* 2.0 x2) 3.0)))
(if (<= x1 -2.2e+63)
(*
x1
(+
(+ -1.0 (* -2.0 (+ -1.0 (* 3.0 (- 3.0 (* 2.0 x2))))))
(* x1 (+ 9.0 (+ (* 4.0 t_0) (* x1 -3.0))))))
(if (or (<= x1 -5.2e-236) (not (<= x1 6e-279)))
(+ (* x2 -6.0) (* x1 (+ -1.0 (* 4.0 (* x2 t_0)))))
(* x2 -6.0)))))
double code(double x1, double x2) {
double t_0 = (2.0 * x2) - 3.0;
double tmp;
if (x1 <= -2.2e+63) {
tmp = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + ((4.0 * t_0) + (x1 * -3.0)))));
} else if ((x1 <= -5.2e-236) || !(x1 <= 6e-279)) {
tmp = (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * t_0))));
} else {
tmp = x2 * -6.0;
}
return tmp;
}
real(8) function code(x1, x2)
real(8), intent (in) :: x1
real(8), intent (in) :: x2
real(8) :: t_0
real(8) :: tmp
t_0 = (2.0d0 * x2) - 3.0d0
if (x1 <= (-2.2d+63)) then
tmp = x1 * (((-1.0d0) + ((-2.0d0) * ((-1.0d0) + (3.0d0 * (3.0d0 - (2.0d0 * x2)))))) + (x1 * (9.0d0 + ((4.0d0 * t_0) + (x1 * (-3.0d0))))))
else if ((x1 <= (-5.2d-236)) .or. (.not. (x1 <= 6d-279))) then
tmp = (x2 * (-6.0d0)) + (x1 * ((-1.0d0) + (4.0d0 * (x2 * t_0))))
else
tmp = x2 * (-6.0d0)
end if
code = tmp
end function
public static double code(double x1, double x2) {
double t_0 = (2.0 * x2) - 3.0;
double tmp;
if (x1 <= -2.2e+63) {
tmp = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + ((4.0 * t_0) + (x1 * -3.0)))));
} else if ((x1 <= -5.2e-236) || !(x1 <= 6e-279)) {
tmp = (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * t_0))));
} else {
tmp = x2 * -6.0;
}
return tmp;
}
def code(x1, x2): t_0 = (2.0 * x2) - 3.0 tmp = 0 if x1 <= -2.2e+63: tmp = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + ((4.0 * t_0) + (x1 * -3.0))))) elif (x1 <= -5.2e-236) or not (x1 <= 6e-279): tmp = (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * t_0)))) else: tmp = x2 * -6.0 return tmp
function code(x1, x2) t_0 = Float64(Float64(2.0 * x2) - 3.0) tmp = 0.0 if (x1 <= -2.2e+63) tmp = Float64(x1 * Float64(Float64(-1.0 + Float64(-2.0 * Float64(-1.0 + Float64(3.0 * Float64(3.0 - Float64(2.0 * x2)))))) + Float64(x1 * Float64(9.0 + Float64(Float64(4.0 * t_0) + Float64(x1 * -3.0)))))); elseif ((x1 <= -5.2e-236) || !(x1 <= 6e-279)) tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(-1.0 + Float64(4.0 * Float64(x2 * t_0))))); else tmp = Float64(x2 * -6.0); end return tmp end
function tmp_2 = code(x1, x2) t_0 = (2.0 * x2) - 3.0; tmp = 0.0; if (x1 <= -2.2e+63) tmp = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + ((4.0 * t_0) + (x1 * -3.0))))); elseif ((x1 <= -5.2e-236) || ~((x1 <= 6e-279))) tmp = (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * t_0)))); else tmp = x2 * -6.0; end tmp_2 = tmp; end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]}, If[LessEqual[x1, -2.2e+63], N[(x1 * N[(N[(-1.0 + N[(-2.0 * N[(-1.0 + N[(3.0 * N[(3.0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(9.0 + N[(N[(4.0 * t$95$0), $MachinePrecision] + N[(x1 * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x1, -5.2e-236], N[Not[LessEqual[x1, 6e-279]], $MachinePrecision]], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(-1.0 + N[(4.0 * N[(x2 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x2 * -6.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot x2 - 3\\
\mathbf{if}\;x1 \leq -2.2 \cdot 10^{+63}:\\
\;\;\;\;x1 \cdot \left(\left(-1 + -2 \cdot \left(-1 + 3 \cdot \left(3 - 2 \cdot x2\right)\right)\right) + x1 \cdot \left(9 + \left(4 \cdot t\_0 + x1 \cdot -3\right)\right)\right)\\
\mathbf{elif}\;x1 \leq -5.2 \cdot 10^{-236} \lor \neg \left(x1 \leq 6 \cdot 10^{-279}\right):\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + 4 \cdot \left(x2 \cdot t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x2 \cdot -6\\
\end{array}
\end{array}
if x1 < -2.1999999999999999e63Initial program 24.4%
Simplified24.4%
Taylor expanded in x1 around -inf 98.1%
Taylor expanded in x1 around 0 76.6%
if -2.1999999999999999e63 < x1 < -5.2000000000000001e-236 or 5.9999999999999999e-279 < x1 Initial program 88.7%
Simplified89.1%
Taylor expanded in x1 around 0 75.8%
if -5.2000000000000001e-236 < x1 < 5.9999999999999999e-279Initial program 99.7%
Simplified99.8%
Taylor expanded in x1 around 0 93.5%
*-commutative93.5%
Simplified93.5%
Final simplification77.7%
(FPCore (x1 x2)
:precision binary64
(let* ((t_0 (- (* 2.0 x2) 3.0)))
(if (<= x1 -9.5e+124)
(*
x1
(+
(+ -1.0 (* -2.0 (+ -1.0 (* 3.0 (- 3.0 (* 2.0 x2))))))
(* x1 (+ 9.0 (* 4.0 t_0)))))
(if (or (<= x1 -5e-236) (not (<= x1 6.1e-279)))
(+ (* x2 -6.0) (* x1 (+ -1.0 (* 4.0 (* x2 t_0)))))
(* x2 -6.0)))))
double code(double x1, double x2) {
double t_0 = (2.0 * x2) - 3.0;
double tmp;
if (x1 <= -9.5e+124) {
tmp = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + (4.0 * t_0))));
} else if ((x1 <= -5e-236) || !(x1 <= 6.1e-279)) {
tmp = (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * t_0))));
} else {
tmp = x2 * -6.0;
}
return tmp;
}
real(8) function code(x1, x2)
real(8), intent (in) :: x1
real(8), intent (in) :: x2
real(8) :: t_0
real(8) :: tmp
t_0 = (2.0d0 * x2) - 3.0d0
if (x1 <= (-9.5d+124)) then
tmp = x1 * (((-1.0d0) + ((-2.0d0) * ((-1.0d0) + (3.0d0 * (3.0d0 - (2.0d0 * x2)))))) + (x1 * (9.0d0 + (4.0d0 * t_0))))
else if ((x1 <= (-5d-236)) .or. (.not. (x1 <= 6.1d-279))) then
tmp = (x2 * (-6.0d0)) + (x1 * ((-1.0d0) + (4.0d0 * (x2 * t_0))))
else
tmp = x2 * (-6.0d0)
end if
code = tmp
end function
public static double code(double x1, double x2) {
double t_0 = (2.0 * x2) - 3.0;
double tmp;
if (x1 <= -9.5e+124) {
tmp = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + (4.0 * t_0))));
} else if ((x1 <= -5e-236) || !(x1 <= 6.1e-279)) {
tmp = (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * t_0))));
} else {
tmp = x2 * -6.0;
}
return tmp;
}
def code(x1, x2): t_0 = (2.0 * x2) - 3.0 tmp = 0 if x1 <= -9.5e+124: tmp = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + (4.0 * t_0)))) elif (x1 <= -5e-236) or not (x1 <= 6.1e-279): tmp = (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * t_0)))) else: tmp = x2 * -6.0 return tmp
function code(x1, x2) t_0 = Float64(Float64(2.0 * x2) - 3.0) tmp = 0.0 if (x1 <= -9.5e+124) tmp = Float64(x1 * Float64(Float64(-1.0 + Float64(-2.0 * Float64(-1.0 + Float64(3.0 * Float64(3.0 - Float64(2.0 * x2)))))) + Float64(x1 * Float64(9.0 + Float64(4.0 * t_0))))); elseif ((x1 <= -5e-236) || !(x1 <= 6.1e-279)) tmp = Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(-1.0 + Float64(4.0 * Float64(x2 * t_0))))); else tmp = Float64(x2 * -6.0); end return tmp end
function tmp_2 = code(x1, x2) t_0 = (2.0 * x2) - 3.0; tmp = 0.0; if (x1 <= -9.5e+124) tmp = x1 * ((-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) + (x1 * (9.0 + (4.0 * t_0)))); elseif ((x1 <= -5e-236) || ~((x1 <= 6.1e-279))) tmp = (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * t_0)))); else tmp = x2 * -6.0; end tmp_2 = tmp; end
code[x1_, x2_] := Block[{t$95$0 = N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]}, If[LessEqual[x1, -9.5e+124], N[(x1 * N[(N[(-1.0 + N[(-2.0 * N[(-1.0 + N[(3.0 * N[(3.0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x1 * N[(9.0 + N[(4.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x1, -5e-236], N[Not[LessEqual[x1, 6.1e-279]], $MachinePrecision]], N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(-1.0 + N[(4.0 * N[(x2 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x2 * -6.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot x2 - 3\\
\mathbf{if}\;x1 \leq -9.5 \cdot 10^{+124}:\\
\;\;\;\;x1 \cdot \left(\left(-1 + -2 \cdot \left(-1 + 3 \cdot \left(3 - 2 \cdot x2\right)\right)\right) + x1 \cdot \left(9 + 4 \cdot t\_0\right)\right)\\
\mathbf{elif}\;x1 \leq -5 \cdot 10^{-236} \lor \neg \left(x1 \leq 6.1 \cdot 10^{-279}\right):\\
\;\;\;\;x2 \cdot -6 + x1 \cdot \left(-1 + 4 \cdot \left(x2 \cdot t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x2 \cdot -6\\
\end{array}
\end{array}
if x1 < -9.50000000000000004e124Initial program 0.0%
Simplified0.0%
Taylor expanded in x1 around -inf 100.0%
Taylor expanded in x1 around 0 30.6%
if -9.50000000000000004e124 < x1 < -4.9999999999999998e-236 or 6.0999999999999999e-279 < x1 Initial program 87.6%
Simplified88.0%
Taylor expanded in x1 around 0 70.9%
if -4.9999999999999998e-236 < x1 < 6.0999999999999999e-279Initial program 99.7%
Simplified99.8%
Taylor expanded in x1 around 0 93.5%
*-commutative93.5%
Simplified93.5%
Final simplification67.5%
(FPCore (x1 x2) :precision binary64 (if (or (<= x1 -3.2e-51) (not (<= x1 6e-12))) (* x1 (+ -1.0 (* -2.0 (+ -1.0 (* 3.0 (- 3.0 (* 2.0 x2))))))) (* x2 -6.0)))
double code(double x1, double x2) {
double tmp;
if ((x1 <= -3.2e-51) || !(x1 <= 6e-12)) {
tmp = x1 * (-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2))))));
} else {
tmp = x2 * -6.0;
}
return tmp;
}
real(8) function code(x1, x2)
real(8), intent (in) :: x1
real(8), intent (in) :: x2
real(8) :: tmp
if ((x1 <= (-3.2d-51)) .or. (.not. (x1 <= 6d-12))) then
tmp = x1 * ((-1.0d0) + ((-2.0d0) * ((-1.0d0) + (3.0d0 * (3.0d0 - (2.0d0 * x2))))))
else
tmp = x2 * (-6.0d0)
end if
code = tmp
end function
public static double code(double x1, double x2) {
double tmp;
if ((x1 <= -3.2e-51) || !(x1 <= 6e-12)) {
tmp = x1 * (-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2))))));
} else {
tmp = x2 * -6.0;
}
return tmp;
}
def code(x1, x2): tmp = 0 if (x1 <= -3.2e-51) or not (x1 <= 6e-12): tmp = x1 * (-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))) else: tmp = x2 * -6.0 return tmp
function code(x1, x2) tmp = 0.0 if ((x1 <= -3.2e-51) || !(x1 <= 6e-12)) tmp = Float64(x1 * Float64(-1.0 + Float64(-2.0 * Float64(-1.0 + Float64(3.0 * Float64(3.0 - Float64(2.0 * x2))))))); else tmp = Float64(x2 * -6.0); end return tmp end
function tmp_2 = code(x1, x2) tmp = 0.0; if ((x1 <= -3.2e-51) || ~((x1 <= 6e-12))) tmp = x1 * (-1.0 + (-2.0 * (-1.0 + (3.0 * (3.0 - (2.0 * x2)))))); else tmp = x2 * -6.0; end tmp_2 = tmp; end
code[x1_, x2_] := If[Or[LessEqual[x1, -3.2e-51], N[Not[LessEqual[x1, 6e-12]], $MachinePrecision]], N[(x1 * N[(-1.0 + N[(-2.0 * N[(-1.0 + N[(3.0 * N[(3.0 - N[(2.0 * x2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x2 * -6.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x1 \leq -3.2 \cdot 10^{-51} \lor \neg \left(x1 \leq 6 \cdot 10^{-12}\right):\\
\;\;\;\;x1 \cdot \left(-1 + -2 \cdot \left(-1 + 3 \cdot \left(3 - 2 \cdot x2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x2 \cdot -6\\
\end{array}
\end{array}
if x1 < -3.2e-51 or 6.0000000000000003e-12 < x1 Initial program 54.7%
Simplified54.8%
Taylor expanded in x1 around -inf 84.4%
Taylor expanded in x1 around 0 16.5%
if -3.2e-51 < x1 < 6.0000000000000003e-12Initial program 99.4%
Simplified99.8%
Taylor expanded in x1 around 0 54.2%
*-commutative54.2%
Simplified54.2%
Final simplification34.9%
(FPCore (x1 x2) :precision binary64 (+ (* x2 -6.0) (* x1 (+ -1.0 (* 4.0 (* x2 (- (* 2.0 x2) 3.0)))))))
double code(double x1, double x2) {
return (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0)))));
}
real(8) function code(x1, x2)
real(8), intent (in) :: x1
real(8), intent (in) :: x2
code = (x2 * (-6.0d0)) + (x1 * ((-1.0d0) + (4.0d0 * (x2 * ((2.0d0 * x2) - 3.0d0)))))
end function
public static double code(double x1, double x2) {
return (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0)))));
}
def code(x1, x2): return (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0)))))
function code(x1, x2) return Float64(Float64(x2 * -6.0) + Float64(x1 * Float64(-1.0 + Float64(4.0 * Float64(x2 * Float64(Float64(2.0 * x2) - 3.0)))))) end
function tmp = code(x1, x2) tmp = (x2 * -6.0) + (x1 * (-1.0 + (4.0 * (x2 * ((2.0 * x2) - 3.0))))); end
code[x1_, x2_] := N[(N[(x2 * -6.0), $MachinePrecision] + N[(x1 * N[(-1.0 + N[(4.0 * N[(x2 * N[(N[(2.0 * x2), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x2 \cdot -6 + x1 \cdot \left(-1 + 4 \cdot \left(x2 \cdot \left(2 \cdot x2 - 3\right)\right)\right)
\end{array}
Initial program 76.5%
Simplified76.8%
Taylor expanded in x1 around 0 62.0%
Final simplification62.0%
(FPCore (x1 x2) :precision binary64 (* x2 -6.0))
double code(double x1, double x2) {
return x2 * -6.0;
}
real(8) function code(x1, x2)
real(8), intent (in) :: x1
real(8), intent (in) :: x2
code = x2 * (-6.0d0)
end function
public static double code(double x1, double x2) {
return x2 * -6.0;
}
def code(x1, x2): return x2 * -6.0
function code(x1, x2) return Float64(x2 * -6.0) end
function tmp = code(x1, x2) tmp = x2 * -6.0; end
code[x1_, x2_] := N[(x2 * -6.0), $MachinePrecision]
\begin{array}{l}
\\
x2 \cdot -6
\end{array}
Initial program 76.5%
Simplified76.8%
Taylor expanded in x1 around 0 27.7%
*-commutative27.7%
Simplified27.7%
herbie shell --seed 2024111
(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))))))