GMP suggestions

Nic Schraudolph nic at
Thu May 20 10:57:05 CEST 2010


I've just converted a major piece of numerical code ("Blossom V" at 
  to use mpq_class and would like to express my appreciation! GMP is a  
truly impressive piece of software engineering.

 From my experience with this conversion, I have two suggestions for  
small further improvements:

1. GMP's C++ interface should instantiate the std::numeric_limits<>  
template for mpz_class, mpq_class, and mpf_class, so as to communicate  
the numerical properties of these classes in standard fashion. This  
should be easy to do.

2. If possible without sacrificing speed, mpq_t should support signed  
infinity (perhaps taking the form +/- 1/0). In numerical programming  
one often needs a number that is guaranteed to be greater than any  
other of its class (simple example: to initialize a minimum-finding  
loop). Without an infinity, this becomes impossible in a class with  
theoretically infinite capacity.

For the same reason, having an infinity would of course also be nice  
for mpz_t and mpf_t. I understand that for the latter this is already  
being considered, but want to point out that having an infinity is  
just as useful for the integers and rationals...

With thanks, and best wishes,

- nic

More information about the gmp-discuss mailing list