chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] most-{positive,negative}-fixnum


From: Matthew Might
Subject: Re: [Chicken-users] most-{positive,negative}-fixnum
Date: Mon, 22 May 2006 13:21:35 -0400
User-agent: Mutt/1.4.2.1i

On May 22 10:14, John Cowan wrote:
> I need to determine the most positive and most negative fixnums,
> given that Chicken has both 32-bit and 64-bit builds.  Can these
> be added as constants, or is there some easy way to compute them?

The easiest approach I could think of was to use:

 ; maxmin.scm
 (define (until-overflow curr last) 
   (if (< curr last) 
       (cons curr last) 
       (until-overflow (+ curr 1) curr)))
 (display (until-overflow 1 0))
 (newline)
 ; EOF


And to compile it with:

 % csc -O3 -f -o maxmin maxmin.scm


To get:

 (-1073741824 . 1073741823)

On my PowerBook G4.

It took a while, so you might want to precompute these.

--
Matthew Might
Ph.D. Candidate
College of Computing
Georgia Institute of Technology





reply via email to

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