id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 12157,Dividing zero by zero produces one in boost::multiprecision::cpp_dec_float,vfaion@…,John Maddock,"When using Boost multiprecision, dividing 0/0 produces 1. I would expected the result to be inf. When dividing other numbers by zero it does produce inf. {{{ #include #include typedef boost::multiprecision::number> BigFloat; int main() { BigFloat zero(0); BigFloat one(1); std::cout << zero / zero << std::endl; std::cout << one / zero << std::endl; } }}} I looked at operator/ from here: http://www.boost.org/doc/libs/1_60_0/boost/multiprecision/cpp_dec_float.hpp I think adding the case ""if(iszero() && v.iszero())"" as below could solve this issue. {{{ template cpp_dec_float& cpp_dec_float::operator/=(const cpp_dec_float& v) { if(iszero() && v.iszero()) { *this = inf(); return *this; } const bool u_and_v_are_finite_and_identical = ( (isfinite)() && (fpclass == v.fpclass) && (exp == v.exp) && (cmp_data(v.data) == static_cast(0))); if(u_and_v_are_finite_and_identical) { if(neg != v.neg) { *this = one(); negate(); } else *this = one(); return *this; } else { if(iszero()) { if((v.isnan)() || v.iszero()) { return *this = v; } return *this; } cpp_dec_float t(v); t.calculate_inv(); return operator*=(t); } } }}}",Bugs,closed,Boost 1.62.0,multiprecision,Boost 1.60.0,Problem,fixed,divide,