On Sat, Feb 18, 2012 at 9:18 PM, Robby Findler wrote:
> I'm not sure of the precise answer, but I don't think that all floats
> (even the integers) have a corresponding fixnum.

My C brain wonders why I can't just cast it to get the lower bits, I
don't care about overflow.

Using fixnum? does indeed work, just far too slowly. Still, good to
know. I didn't think of using Typed Racket like that.

I should mention that this is the best method I've found so far:

(: float->int (Float -> Integer))
(define (float->int x)
 (floor (inexact->exact (floor x))))   ; both floors are necessary

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to