From fb71e3937eb754ad8c2b311822827e9a739ddd85 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 7 Feb 2023 15:42:49 +0000 Subject: [PATCH] Add numerator() and denominator() --- .../include/CGAL/CORE_algebraic_number_traits.h | 8 ++++---- CGAL_Core/include/CGAL/CORE/BigRat.h | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/CORE_algebraic_number_traits.h b/Arrangement_on_surface_2/include/CGAL/CORE_algebraic_number_traits.h index c3fd592a7d6..a35bc24144c 100644 --- a/Arrangement_on_surface_2/include/CGAL/CORE_algebraic_number_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/CORE_algebraic_number_traits.h @@ -106,7 +106,7 @@ public: ix1 = scaled_x1.BigIntValue(); ix2 = scaled_x2.BigIntValue(); - if (CORE::abs (ix2 - ix1) > one) + if (CGAL::abs (ix2 - ix1) > one) break; // Scale the values by a factor of 2. @@ -179,9 +179,9 @@ public: temp_gcd = numer_gcd; denom_lcm *= denom; - denom_lcm /= CORE::gcd (temp_lcm, denom); + denom_lcm /= CGAL::gcd (temp_lcm, denom); - numer_gcd = CORE::gcd (temp_gcd, numer); + numer_gcd = CGAL::gcd (temp_gcd, numer); } ++q_iter; @@ -334,7 +334,7 @@ public: temp_lcm = denom_lcm; denom_lcm *= denom; - denom_lcm /= CORE::gcd (temp_lcm, denom); + denom_lcm /= CGAL::gcd (temp_lcm, denom); } index--; diff --git a/CGAL_Core/include/CGAL/CORE/BigRat.h b/CGAL_Core/include/CGAL/CORE/BigRat.h index 4de07c5e44e..3de5f13d156 100644 --- a/CGAL_Core/include/CGAL/CORE/BigRat.h +++ b/CGAL_Core/include/CGAL/CORE/BigRat.h @@ -35,6 +35,15 @@ namespace CORE { #endif + BigInt numerator(const BigRat& q) + { + return boost::multiprecision::numerator(q); + } + + BigInt denominator(const BigRat& q) + { + return boost::multiprecision::denominator(q); + } /// BigIntValue inline BigInt BigIntValue(const BigRat& br) {