annoying quirk with numerical types

From: Andrew Dorrell <andrewd_at_ee.uts.edu.au>
Date: Sat, 22 Jul 95 15:46:56 EST

My question... How dificult would it be to implement the <exact> and <inexact>
types in STklos :-

scheme distinguishes only two numerical types - exact and inexact.
STklos however distinguishes integers and reals, apparently as whether they
are stored as integers or floating point which creates some awkward
contradictions:

(define-method test ((self <integer>)) 'integer)
(define-method test ((self <real>)) 'real)

;; NB <exact> and <inexact> are not defined in STklos
;; Then:
(test 1) => integer
(real? 1) => #t
(test 1.0) => real
(integer? 1.0) => #t

NB. The behaviour of the real? and integer? tests is in line with R4RS and out
of line with the STk reference manual.

(inexact->exact z) seems to perform (inexact->exact (ceiling z)) - which
is inconsistent with R4RS but in line with the STk reference manual.

All of this amounts to behaviour which is sometimes "quirky".

-- 
------------------------------------------------------------------------------
Mr Andrew Dorrell
School of Electrical Engineering                 *
University of Technology, Sydney                     *
PO Box 123                                     *
Broadway NSW 2007                                   .  
AUSTRALIA
                                                    *       /---\  Whoo?
Phone:   61 2 330 2395                                      (o o) /
Fax:     61 2 330 2435                                      ( : )  
email:   andrewd_at_ee.uts.edu.au                               ^ ^     
    OR   dorrell_at_ihf.uts.edu.au
------------------------------------------------------------------------------
Received on Sat Jul 22 1995 - 07:48:41 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST