diff --git a/include/boost/math/octonion.hpp b/include/boost/math/octonion.hpp index 5d147df584..4239140564 100644 --- a/include/boost/math/octonion.hpp +++ b/include/boost/math/octonion.hpp @@ -942,6 +942,10 @@ namespace boost b /= rhs; \ c /= rhs; \ d /= rhs; \ + e /= rhs; \ + f /= rhs; \ + g /= rhs; \ + h /= rhs; \ \ return(*this); \ } diff --git a/test/octonion_test.cpp b/test/octonion_test.cpp index 96f43103c5..00ebf535ff 100644 --- a/test/octonion_test.cpp +++ b/test/octonion_test.cpp @@ -699,6 +699,34 @@ BOOST_TEST_CASE_TEMPLATE_FUNCTION(multiplication_test, T) } } +BOOST_TEST_CASE_TEMPLATE_FUNCTION(division_test, T) +{ + #if BOOST_WORKAROUND(__GNUC__, < 3) + #else /* BOOST_WORKAROUND(__GNUC__, < 3) */ + using ::std::numeric_limits; + + using ::boost::math::abs; + #endif /* BOOST_WORKAROUND(__GNUC__, < 3) */ + + + BOOST_TEST_MESSAGE("Testing division for " + << string_type_name::_() << "."); + + BOOST_REQUIRE_PREDICATE(::std::less_equal(), + (abs(::boost::math::octonion(1,0,0,0,0,0,0,0)/ + ::boost::math::octonion(1,0,0,0,0,0,0,0)- + static_cast(1))) + (numeric_limits::epsilon())); + + for (int idx = 1; idx < 8; ++idx) + { + ::boost::math::octonion toto = index_i_element(idx); + + BOOST_REQUIRE_PREDICATE(::std::less_equal(), + (abs(toto/toto-static_cast(1))) + (numeric_limits::epsilon())); + } +} BOOST_TEST_CASE_TEMPLATE_FUNCTION(exp_test, T) { @@ -752,6 +780,7 @@ boost::unit_test::test_suite * init_unit_test_suite(int, char *[]) #define BOOST_OCTONION_TEST \ BOOST_OCTONION_COMMON_GENERATOR(multiplication) \ + BOOST_OCTONION_COMMON_GENERATOR(division) \ BOOST_OCTONION_COMMON_GENERATOR_NEAR_EPS(exp)