Skip to content

support for 64 bit Integer and 128Bit floating Point #7833

Open
@schnedann

Description

@schnedann

Issue Details

I tried to tinker around with the examples of cgal and when I modified statements like

Source Code

typedef CGAL::Box_intersection_d::Box_d<double,2> Box;

to use long int (int64_t) or long double, the compiler throws errors

But I was able to patch Box_intersection_d/include/CGAL/Box_intersection_d/box_limits.h

as following

diff --git a/Box_intersection_d/include/CGAL/Box_intersection_d/box_limits.h b/Box_intersection_d/include/CGAL/Box_intersection_d/box_limits.h
index 205ebb73e94..3bdaa8c0551 100644
--- a/Box_intersection_d/include/CGAL/Box_intersection_d/box_limits.h
+++ b/Box_intersection_d/include/CGAL/Box_intersection_d/box_limits.h
@@ -38,10 +38,22 @@ template<>
 struct box_limits<unsigned int> {
     static int inf() { return 0; }
     static int sup() { return (std::numeric_limits<unsigned int>::max)(); }
 };
 
+template<>
+struct box_limits<long int> {
+    static long int inf() { return (std::numeric_limits<long int>::min)(); }
+    static long int sup() { return (std::numeric_limits<long int>::max)(); }
+};
+
+template<>
+struct box_limits<unsigned long int> {
+    static long int inf() { return 0; }
+    static long int sup() { return (std::numeric_limits<unsigned long int>::max)(); }
+};
+
 template<>
 struct box_limits<float> {
     static float inf() { return -sup(); }
     static float sup() { return (std::numeric_limits<float>::max)(); }
 };
@@ -50,10 +62,16 @@ template<>
 struct box_limits<double> {
     static double inf() { return -sup(); }
     static double sup() { return (std::numeric_limits<double>::max)(); }
 };
 
+template<>
+struct box_limits<long double> {
+    static long double inf() { return -sup(); }
+    static long double sup() { return (std::numeric_limits<long double>::max)(); }
+};
+
 } // end namespace Box_intersection_d
 
 
 } //namespace CGAL

I suggest to extend cgal to support all types in <cstdint> like intXX_t, uintXX_t plus all floating point types
Box_intersection_d__box_limits_h.patch.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions