mit-scheme-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MIT-Scheme-devel] rationals and infinities


From: Taylor R Campbell
Subject: [MIT-Scheme-devel] rationals and infinities
Date: Mon, 24 Aug 2009 08:11:18 -0400
User-agent: IMAIL/1.21; Edwin/3.116; MIT-Scheme/7.7.90.+

Is this the right thing?  I observe similar weirdness with NaNs.

;; As expected:
(/ 1.0 0.0)
;Value: #[+inf]

;; Not every Scheme agrees with this assessment, but OK:
(rational? (/ 1.0 0.0))
;Value: #t

;; Now this is a little weird.
(numerator (/ 1.0 0.0))
;Value: 0.

(denominator (/ 1.0 0.0))
;Value: 1.

;; The culprit:
((access flo:->rational (->environment '(runtime number))) (/ 1.0 0.0))
;Value: 0

;; Why does that happen?  It passes FLO:->INTEGER (a.k.a.
;; FLO:TRUNCATE->EXACT) an infinity, and, yikes!
(flo:truncate->exact (/ 1.0 0.0))
;Value: 0000000




reply via email to

[Prev in Thread] Current Thread [Next in Thread]