[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MIT-Scheme-devel] rationals and infinities
From: |
Chris Hanson |
Subject: |
Re: [MIT-Scheme-devel] rationals and infinities |
Date: |
Mon, 24 Aug 2009 20:19:01 -0700 |
I just checked in a fix for this.
On Mon, Aug 24, 2009 at 5:11 AM, Taylor R Campbell<address@hidden> wrote:
> 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
>
>
> _______________________________________________
> MIT-Scheme-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/mit-scheme-devel
>