diff --git a/Nef_3/test/Nef_3/test_nef_3_io_EPEC.cpp b/Nef_3/test/Nef_3/test_nef_3_io_EPEC.cpp index 03e0ff91ee5..ca62860f079 100644 --- a/Nef_3/test/Nef_3/test_nef_3_io_EPEC.cpp +++ b/Nef_3/test/Nef_3/test_nef_3_io_EPEC.cpp @@ -15,8 +15,11 @@ void test_write_read() typedef CGAL::Polyhedron_3< Kernel > Polyhedron; typedef typename Kernel::Point_3 Point; - typename Kernel::RT n( std::string("6369051672525773")); - typename Kernel::RT d( std::string("4503599627370496")); + typename Kernel::RT n, d; + std::istringstream str_n("6369051672525773"); + str_n >> n; + std::istringstream str_d("4503599627370496"); + str_d >> d; Point p(n, 0, 0, d); Point q(0, n, 0, d); diff --git a/Number_types/include/CGAL/mpq_class.h b/Number_types/include/CGAL/mpq_class.h index bc653c8e955..6a0de04cf8f 100644 --- a/Number_types/include/CGAL/mpq_class.h +++ b/Number_types/include/CGAL/mpq_class.h @@ -273,6 +273,19 @@ public: } }; +// Copied from leda_rational.h +namespace internal { + // See: Stream_support/include/CGAL/IO/io.h + template + void read_float_or_quotient(std::istream & is, ET& et); + + template <> + inline void read_float_or_quotient(std::istream & is, mpq_class& et) + { + internal::read_float_or_quotient(is, et); + } +} // namespace internal + } //namespace CGAL #undef CGAL_CHECK_GMP_EXPR diff --git a/Number_types/test/Number_types/mpq_class.cpp b/Number_types/test/Number_types/mpq_class.cpp index a6c759768b1..31b46847615 100644 --- a/Number_types/test/Number_types/mpq_class.cpp +++ b/Number_types/test/Number_types/mpq_class.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -33,6 +34,16 @@ int main() { mpq_class q; std::istringstream in("12.34"); in >> CGAL::iformat(q); + assert(in); + assert(q.get_num() == 617); + assert(q.get_den() == 50); + } + { + CGAL::Lazy_exact_nt x; + std::istringstream in("12.34"); + in >> x; + mpq_class q = x.exact(); + assert(in); assert(q.get_num() == 617); assert(q.get_den() == 50); }