Re: Hexadecimal numbers in Axiom?

"Bill Page" <[email protected]>
Newsgroups gmane.comp.mathematics.axiom.user
Message-ID <[email protected]>
On 10/13/07, Alasdair McAndrew wrote:
> I can obtain a hexadecimal number, for example 1000::RadixExpansion(16)
> which produces "3E8"..  But how do I enter a hexadecimal number in Axiom?
> How do I enter DB6A, for example, and have Axiom recognize it as a
> hexadecimal number?
>

I am not entirely sure what you mean by "hexadecimal number". If you
mean the domain RadixExpansion(16) then perhaps this is not what you
want. But here is one way of converting a string of hexdecimal digits
representing a number to an integer that takes advantage of the Lisp
functionality that underlies Axiom:

(1) -> hex(x:String):Integer == integer(READ_-FROM_-STRING("#16r".x)$Lisp)
   Function declaration hex : String -> Integer has been added to
      workspace.
                                                                   Type: Void
(2) -> hex("DB6A")
   Compiling function hex with type String -> Integer

   (2)  56170
                                                        Type: PositiveInteger

--------

Maybe that could be of some help.

Regards,
Bill Page.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.