SF Talk wrote:
>
> Date: Thu, 21 Oct 1999 13:29:38 -0700 (PDT)
> From: john wavrik <ir230_at_sdcc3.ucsd.edu>
> Subject: Re: Base never seems to change ???
>
> David Rossi asks:
>
> > Why when I execute a base changing word like HEX, or OCTAL, the number
> > stored at BASE never changes from 10?
>
> This is because 10 is always the representation of B in
> base B -- no matter what B is. 10 represents 2 in base 2,
> it represents 3 in base 3, etc.
>
> Once you change the base, all input and output numbers are
> represented in the new base. So BASE @ . will print the current
> base -- IN THE CURRENT BASE. You will always see 10.
I check the base with " BL . ". BL is the ASCII for <space>; 20 in
hex, 32 in decimal, and 100000 in binary. You could type 33 EMIT . You
would get a "!" in decimal, the numeral 3 in hex, and an error in
binary. If you like, define
: BASE? BASE @ H. ." in decimal " ;
.
Received on Fri Oct 22 1999 - 01:01:22 PDT
Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!
This archive was generated 08-Feb-2012. Archive updated nightly.