Entering hexadecimal numbers?



What about using Lisp's number parsing facilities.  I'm not smart enough
with Maxima to see a pretty way of doing this, but certainly:

(%i45) :lisp #x1000
4096
(%i45) :lisp #xFF24
65316

It is easy to write Lisp function that takes a string of hex and converts it
to decimal:

:lisp (defun $hex_to_dec (hex-string) (read-from-string (concatenate 'string
"#x" hex-string)) )

(notice that this is all on one line)

hex_to_dec("FF24");
==> 65316

Sorry if this is redundant,
Zach


On Fri, Apr 25, 2008 at 6:01 PM, Robert Dodier <robert.dodier at gmail.com>
wrote:

> On Fri, Apr 25, 2008 at 4:08 PM, Alasdair McAndrew <amca01 at gmail.com>
> wrote:
>
> > I have some long hexadecimal numbers (48 hex digits) I want to use.  But
> > ibase:16 doesn't seem to accept non-numeric characters as input:
>
> Yes, there is no way to enter a, b, c, ... for digits when ibase > 10.
> This came up recently; see:
> http://article.gmane.org/gmane.comp.mathematics.maxima.general/20490
>
> The patch mentioned in that message yields
> stuff like 1b0 => ibase^2 + 11*ibase when it should be bfloat(1)
> (as it is when ibase=10). I've tinkered some more to try to prevent
> surprises like that but I haven't gotten it nailed down.
> If someone else wants to try it, that would be great.
>
> Hope this helps,
>
> Robert Dodier
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>