Use Exact_integer; Do not divide a Vector in case of Homogeneous

This commit is contained in:
Andreas Fabri 2024-01-12 08:04:00 +00:00
parent 310ef4c219
commit 703eae4aeb
3 changed files with 10 additions and 54 deletions

View File

@ -10,23 +10,9 @@
#include <CGAL/Exact_integer.h> #include <CGAL/Exact_integer.h>
#include <CGAL/Exact_rational.h> #include <CGAL/Exact_rational.h>
#if defined( CGAL_USE_LEDA) || defined ( CGAL_USE_GMP )
typedef CGAL::Exact_integer RT; typedef CGAL::Exact_integer RT;
typedef CGAL::Exact_rational FT; typedef CGAL::Exact_rational FT;
#else
// The following are too slow :
// #include <CGAL/MP_Float.h>
// #include <CGAL/Quotient.h>
// typedef CGAL::MP_Float RT;
// typedef CGAL::Quotient<RT> FT;
typedef double RT;
typedef double FT;
#endif
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
CGAL_KD_SETDTHREAD(151); CGAL_KD_SETDTHREAD(151);
@ -72,8 +58,6 @@ int main(int argc, char* argv[])
Vector v21(v13),v22(v13); Vector v21(v13),v22(v13);
v21 *= 13; v21 *= 13;
CGAL_TEST(v21 == NT(13)*v22){} CGAL_TEST(v21 == NT(13)*v22){}
v21 /= 13;
CGAL_TEST(v21 == v22){}
if (IOTEST) CGAL_IO_TEST(v1,v2,CGAL::IO::ASCII); if (IOTEST) CGAL_IO_TEST(v1,v2,CGAL::IO::ASCII);
} }

View File

@ -5,22 +5,12 @@
#include <CGAL/double.h> #include <CGAL/double.h>
#include <CGAL/test_macros.h> #include <CGAL/test_macros.h>
#ifdef CGAL_USE_LEDA #include <CGAL/Exact_integer.h>
#include <CGAL/leda_integer.h> #include <CGAL/Exact_rational.h>
#include <CGAL/leda_rational.h>
typedef leda_integer RT_; typedef CGAL::Exact_integer RT_;
typedef leda_rational FT_; typedef CGAL::Exact_rational FT_;
#else
#ifdef CGAL_USE_GMP
#include <CGAL/Gmpz.h>
#include <CGAL/Quotient.h>
typedef CGAL::Gmpz RT_;
typedef CGAL::Quotient<RT_> FT_;
#else
typedef double RT_;
typedef double FT_;
#endif
#endif
int main() int main()
{ CGAL_KD_SETDTHREAD(2); { CGAL_KD_SETDTHREAD(2);

View File

@ -5,28 +5,11 @@
#include <CGAL/test_macros.h> #include <CGAL/test_macros.h>
#include <CGAL/use.h> #include <CGAL/use.h>
#ifdef CGAL_USE_LEDA #include <CGAL/Exact_integer.h>
#include <CGAL/Exact_rational.h>
#include <CGAL/leda_integer.h> typedef CGAL::Exact_integer RT;
#include <CGAL/leda_real.h> typedef CGAL::Exact_rational FT;
typedef leda_integer RT;
typedef leda_real FT;
#elif defined CGAL_USE_GMP
#include <CGAL/Gmpz.h>
#include <CGAL/Gmpq.h>
typedef CGAL::Gmpz RT;
typedef CGAL::Gmpq FT;
#else
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
typedef CGAL::MP_Float RT;
typedef CGAL::Quotient<RT> FT;
#endif
int main() int main()
{ CGAL::IO::set_pretty_mode ( std::cerr ); { CGAL::IO::set_pretty_mode ( std::cerr );
@ -383,4 +366,3 @@ int main()
} }
CGAL_TEST_END; CGAL_TEST_END;
} }