Fix overflow handling with negative values as reported in http://lists.boost.org/boost-users/2007/05/28205.php