mini-gmp and mpq

Andreas Fabri andreas.fabri at
Wed Feb 14 19:07:25 UTC 2018


In the CGAL project ( != Daniele Panozzos project) we combine
double interval arithmetic with mpq when interval arithmetic
fails (say a comparison of two overlapping intervals)
in order to be fast and correct, and we would need:
1) the construction of a mpq from a double
2) the conversion of a mpq to its closest double
3) the conversion of a mpq to a tight double interval.



On 2/14/2018 7:53 PM, Marco Bodrato wrote:
> Ciao,
> Il Mar, 13 Febbraio 2018 7:38 pm, Daniele Panozzo ha scritto:
>> Is there any plan to extend mini-gmp to rationals (mpq)? This would really
>> make it perfect for my use case.
> Curious request. We sometimes discussed about modularising mini-gmp. This
> request would benefit of such a modularisation.
> It shouldn't be too difficoult to add the mpq layer; at least if you don't
> need to deal with floats types nor strings.
> I tried to write some functions, just to see how difficoult it could be. I
> attach a possible implementation. Would it fit your needs?
> Of course, extending mini-gmp would not only mean writing some simple
> functions, but also integrating them in the existing code and, this is
> REALLY IMPORTANT, writing some tests!
> The attached code was NOT TESTED in any way! It can be a starting point.
> Ĝis,
> m
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at

Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project

phone: +33.492.954.912    skype: andreas.fabri

More information about the gmp-discuss mailing list