chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] newbie question about numbers


From: Peter Bex
Subject: Re: [Chicken-users] newbie question about numbers
Date: Sun, 7 Feb 2010 23:30:03 +0100
User-agent: Mutt/1.4.2.3i

On Sun, Feb 07, 2010 at 11:24:30PM +0100, Peter Bex wrote:
> Chicken distinguishes between fixnums and flonums.  fixnums are numbers
> representable by your computer's architecture, with one bit taken off
> for tagging.  So on 32 bit that would be -2^31 through +(2^32 - 1).

Argh, that should be "a number between -2^30 and (2^30 - 1)"

One bit is used for tagging, and the other for distinguishing between
signed and unsigned numbers.  In twos complement representation, that
gives you one extra bit for use in the case of negative values, hence
negative values have a range that is one more than positive ones.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth




reply via email to

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