Specifying precision in vector<mpf_class>?

Ballabio Gerardo - Dip. di Scienza dei Materiali gerardo.ballabio@unimib.it
Thu, 21 Aug 2003 17:30:02 +0200


On 2003.08.18 12:46, Niels Möller wrote:
> > So that an mpf_class<64> might NOT have a precision of 64? That
> > looks somewhat perverse to me.
> 
> Well, that's a question of taste, of course.
> 
> Both actual precision and default precision make sense as
> compile-time parameters (i.e. C++ template parameters). Both also 
> make some sense as run-time parameters, but in my opinion, it is 
> more sane to change the actual precision of particular variables at 
> run-time, than to change a global default precision at run-time. I 
> guess that's because I generally dislike global library variables.

Well, I just wasn't thinking about default precision.

With the precision as a template parameter, there'd be no way at all 
to define an mpf_class with a default precision (except by using a 
default template parameter like this:

   template <int N = 64> class mpf_class { ... };

but then, the default precision would be hardcoded and couldn't be 
changed by any means, ever).

Actually, the "default precision" feature would be present in the C 
interface, but missing from the C++ interface. Is this acceptable?

Gerardo