Daniel Hartwig <mand...@gmail.com> writes: > On 12 December 2012 13:55, Nala Ginrut <nalagin...@gmail.com> wrote: >> Are you suggesting I use (is-a? obj <fraction>) for 'fraction?' ? > > Absolutely not. Use inexact? if you wish to determine that the > *storage* of a value is using floating point format.
Apologies in advance for being pedantic, but there is no guarantee that inexact numbers are represented in floating point format. Having said that, I'm not aware of any current Scheme implementation that uses a different representation for inexacts. Nala Ginrut <nalagin...@gmail.com> writes: > (define (fraction? obj) > (and (number? obj) (inexact? obj))) This definition implies that 3.1415927 is a fraction, and 1/2 is not. I suspect you want something closer to this: (define (fraction? obj) (and (rational? obj) (exact? obj) (not (integer? obj)))) Regards, Mark