Ticket #8711: boost_multiprecision_max_negative.patch

File boost_multiprecision_max_negative.patch, 733 bytes (added by Jan Bouwer <JBouwer@…>, 9 years ago)

A naive patch suggestion.

  • multiprecision/cpp_int.hpp

    old new  
    212212   BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(double_limb_type i)BOOST_NOEXCEPT
    213213      : m_data(i), m_limbs(i > max_limb_value ? 2 : 1), m_sign(false), m_internal(true) { }
    214214   BOOST_MP_FORCEINLINE BOOST_CONSTEXPR cpp_int_base(signed_double_limb_type i)BOOST_NOEXCEPT
    215       : m_data(i), m_limbs(i < 0 ? (-i > max_limb_value ? 2 : 1) : (i > max_limb_value ? 2 : 1)),
     215      : m_data(i), m_limbs(i < 0 ? (-i > max_limb_value || i == -i ? 2 : 1) : (i > max_limb_value ? 2 : 1)),
    216216        m_sign(i < 0), m_internal(true) { }
    217217#endif
    218218   //