Date: Thu, 30 Oct 2008 08:37:32 +1000 From: Darren Baker darren@wildfire.com.au
This is no doubt Very Bad Practice but it's useful :)
(define flonum->fixnum (c-lambda (double) int "___result = (int)___arg1;"))
That's absurd! Aside from the obvious absurdity of calling out to C for this, it leads to nasal demons if the range of the argument's integral part exceeds the range of C ints or Gambit fixnums. There is a perfectly good standard procedure to obtain the nearest exact number to an inexact one, which one may have obtained by rounding another inexact number. This procedure is called INEXACT->EXACT.