Guy's this is very neat and it also brings back some memories.
Some years ago I did quite a lot of programming on CDC 6600 & 7600 at the
ULCC. These machines use exactly the same notation. I remember revelling in
having two zeros because I used to use one to mean null (1) and the other
zero. Yes programming in FORTRAN and writing COMPASS assembler subroutines
when FORTRAN was stumped. Mmm about 19741976 I think.
Kind regards,
Andrew Ballantine
 Original Message 
From: "Robert Klemme" <(EMail Removed)>
Newsgroups: comp.lang.ruby
To: "rubytalk ML" <(EMail Removed)>
Sent: Wednesday, May 04, 2005 6:09 PM
Subject: Re: Fixnum's binary representation
>
> <(EMail Removed)> schrieb im Newsbeitrag
> news:(EMail Removed) ups.com...
> > Thanks, Robert!
> >
> >> For which numbers do you have problems? I don't see any so far
> >
> > I mean...
> > If Bignum#[] is made to simulate 32bit signed integers, it can't show
> > numbers with more than 32bit representation.
> > Well, positive numbers will be okay.
> > But what about negative numbers?
> > When can I expect the sign bit?
>
> Well, since Bignums can be arbitrary size, you have to decide. The values
> returned by Fixnum#[] and Bignum#[] represent bits of a two complement's
> arbitrary size binary number. If you view it from this perspective,
you'll
> see that there is no single sign bit. Negative numbers have *all* the
> higher bits set to 1.
>
> > I assume that numbers beyond 32bit are not suitable for Bignum#[].
> > Do you agree?
>
> Not at all.
>
> >> n = (1<<100)
> => 1267650600228229401496703205376
> >> 200.times{i print i, " ", n[i], "\n"}
> 0 0
> 1 0
> 2 0
> 3 0
> 4 0
> 5 0
> 6 0
> 7 0
> 8 0
> 9 0
> 10 0
> 11 0
> ....
> 95 0
> 96 0
> 97 0
> 98 0
> 99 0
> 100 1
> 101 1
> 102 1
> 103 1
> 104 1
> ....
> 195 1
> 196 1
> 197 1
> 198 1
> 199 1
> => 200
>
> As you clearly see, the representation is ok.
>
> Btw, you'll notice the same effect with Fixnum#[]  because these methods
do
> not represent the actual binary representation in mem but try to represent
> the general concept of signed binary numbers:
>
> >> (1)[100]
> => 1
> >> (1)[1<<100]
> => 1
>
> Kind regards
>
> robert
>
>
>
>
> 
> No virus found in this incoming message.
> Checked by AVG AntiVirus.
> Version: 7.0.308 / Virus Database: 266.11.4  Release Date: 04/05/2005
>
>
