Range safety checking, accessing mpf_t exponents?

Bart Kus me at bartk.us
Mon Sep 20 06:46:46 CEST 2010


  Hello,

I'm trying to wrap around GMP with some range safety checking routines.  
I can't have silent overflows resulting in unspecified behavior.  To do 
this for addition, as an example, I'd like to throw an exception when 
the arguments are both positive and their exponents are in the range of 
2^62 and also positive (64-bit arch).  I don't see any way of getting 
exponent information from mpf_class though.  Is there some 
less-well-documented function(s) to do so?

Or perhaps more broadly, has anyone written pre-exec range checking for 
GMP operations already?  Or a patch to support infinity reporting?

Thanks,

--Bart



More information about the gmp-discuss mailing list