I am using boost::multiprecision::cpp_int
, and I cannot find confirmation that division of two positive cpp_int
's truncates towards 0
; i.e., that
boost::multiprecision::cpp_int A {11};
boost::multiprecision::cpp_int B {4};
boost::multiprecision::cpp_int C = A / B; // 2, right?
In C++, were A
and B
builtin integer
types, the standard requires truncation towards 0
, so that the answer would be C
equals 2
.
I assume that cpp_int
works the same way - that the answer is 2
for cpp_int
, also.
However, I cannot find confirmation of this assumption. I have also looked for a few minutes in the source code for boost::multiprecision::cpp_int
, but I did not find it trivial to confirm the behavior.
I would like to confirm that boost::multiprecision::cpp_int
works as expected when dividing two positive integers - namely, that it truncates the result towards 0
.
Thanks!