|
Boost Users : |
Subject: [Boost-users] [mp_math] Wrong sign for mp_int<> after addition.
From: Jeroen N. Witmond (jnw_at_[hidden])
Date: 2009-01-11 06:37:30
Greetings,
I've stumbled across a problem in mp_math in the sandbox, revision 50541. The
code below (a Boost.Test test case) demonstrates that the problem is present
only for mp_int<> and not for int. The message I get is
wrong-value.cpp(16): error in
"Mixed_integers<N5boost7mp_math6mp_intISaIvENS0_13mp_int_traitsIjyEEEE>": check
j == 4 failed [-4 != 4]
Regards,
Jeroen.
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE Wrong_sign
#include <boost/test/unit_test.hpp>
#include <boost/mp_math/mp_int.hpp>
#include <boost/mpl/list.hpp>
typedef boost::mpl::list< int, boost::mp_math::mp_int<> > test_types;
BOOST_AUTO_TEST_CASE_TEMPLATE( Mixed_integers, Type, test_types )
{
Type i(-1);
BOOST_CHECK_EQUAL(i, -1);
Type j = i + 5;
BOOST_CHECK_EQUAL(j, 4); // Line 16.
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net