[erlang-questions] surprising integer (external) encoding

Daniel Luna <>
Thu Jul 5 16:14:07 CEST 2007


On Wed, 4 Jul 2007, Valentin Micic wrote:
> Q1: Why 2^27 values only? It is more intuitive to expect 2^31, and leave
> only one bit (as opposed to 5) for sign (second complement) encoding.

4 bits for the type tag.
1 bit for sign.

That leaves 27 bits (on a 32 bit machine) for the number. (On a 64 bit 
machine, you can have 59 bits in a fixnum.)

It's the cost of having a dynamically typed language.

/Luna
-- 
Daniel Luna                           | Top reasons that I have a beard:
                     |  a) Laziness.
http://www.update.uu.se/~luna/        |  b) I can.
Don't look at my homepage (it stinks).|  c) I can get away with it.



More information about the erlang-questions mailing list