This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: (floor 1.0) -> 1.0, integer or not?


Hoehle, Joerg-Cyril wrote:

#|kawa:349|# (integer? 1.0)
#t -- so at least, it's compliant by the letter of R5RS

#|kawa:350|# (invoke 1.0 'get-class)
class gnu.math.DFloNum
Not the class that I'd expect from an integer!?!

It's an inexact integer. Exact integers are represented using gnu.math.IntNum, while inexact integers (and other inexact reals) are represented using gnu.math.DFloNum.

I believe using the same class for inexact integers as other
inexact reals follows both the letter and sprit of R5RS,
and is in fact fairly common in Scheme implementations.

What you might criticise is that the type specifier
<integer> is equivalent to <gnu.math.IntNum> and so
should technically be called <exact-integer> instead.
However, such a change might break a fair bit of code.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]