This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: (floor 1.0) -> 1.0, integer or not?
- From: Per Bothner <per at bothner dot com>
- To: "Hoehle, Joerg-Cyril" <Joerg-Cyril dot Hoehle at t-systems dot com>
- Cc: kawa at sources dot redhat dot com
- Date: Tue, 25 Nov 2003 12:21:03 -0800
- Subject: Re: (floor 1.0) -> 1.0, integer or not?
- References: <9F8582E37B2EE5498E76392AEDDCD3FE08327478@G8PQD.blf01.telekom.de>
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/