From 8fec9d93cd2a0ab4d8237bd25724a8ed66f43344 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 9 Mar 2026 08:36:02 -0400 Subject: [PATCH 1/2] Fix scalar div for octonions --- include/boost/math/octonion.hpp | 4 ++++ 1 file changed, 4 insertions(+) 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); \ } From 0074609cda2ebfbe26bfc4f76a0317e96a63ffc8 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 9 Mar 2026 08:36:15 -0400 Subject: [PATCH 2/2] Add division test suite mirroring multiplication --- test/octonion_test.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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)