axiom-mail
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-mail] Hexadecimal numbers in Axiom?


From: Bill Page
Subject: Re: [Axiom-mail] Hexadecimal numbers in Axiom?
Date: Sun, 14 Oct 2007 00:51:26 -0400

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]