Bob Smith wrote:
> I'm puzzled by the description of this function which says that the base
> may vary from 2..36 and -2..-36, but then goes on to describe the
> allowed chars in the string for bases 37..62.
>
> Also, I see that you use the same odd rules as does GMP for different
> bases. That is,
>
> Bases Allowed in String
> ---------------------------------
> 2..36 0..9a..z
> 37..62 0..9A..Za..z
> -2..-36 0..9A..Z
> -37..-62 unspecified
>
> Can anyone explain why not use one sequence for all bases (other than
> that's the way GMP did it)? If the latter explanation, does anyone know
> why GMP did it that way?
I guess that's simply for historical reasons. (And MPIR wanted to stay
compatible with GMP.)
First, only bases up to 36 were supported, and using lower case letters
was considered more convenient.
Later, bases up to 62 were added, and the developers didn't want to
break backwards compatibility.
One could have used 0..9a..zA..Z for these, but then
ord(d1)<ord(d2) <=> val(d1)<val(d2)
would no longer hold (complicating the implementation), since for
example ord('A')=65 < 97=ord('a'), but val('A')=36 > val('a')=10 in that
case.
But that's just my guess...
-leif
--
() The ASCII Ribbon Campaign
/\ Help Cure HTML Email
--
You received this message because you are subscribed to the Google Groups
"mpir-devel" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/mpir-devel?hl=en.