Bug in mpz_out_str...

Vincent Lefevre vincent at vinc17.org
Mon Nov 15 16:53:01 CET 2010


On 2010-11-11 14:33:19 +0100, Torbjorn Granlund wrote:
> It is a philosophical question if a library should always behave in a
> nice way if asked to do things that is undefined according to the
> documentation.
> 
> I agree that it is a little strange that the current code checks for
> undefined bases > 62, when it does not check for other undefined bases.
> 
> Undefined bases:
> 
>   (1) -oo ... -37
>   (2) -1
>   (3) +1
>   (4) +63 ... +oo
> 
> Of these, we only recognise case 4.  What is right to do?  GMP doesn't
> do a whole lot of checks of consistency of arguments, and I am not sure
> we should change that.
> 
> Opinions?

I think the safest solution is to avoid undefined behavior when this
doesn't introduce a performance penalty.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


More information about the gmp-bugs mailing list