[Top][All Lists]

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

r5rs section 6.2.3 inexactness and rational sqrt

From: Ray Lehtiniemi
Subject: r5rs section 6.2.3 inexactness and rational sqrt
Date: Fri, 16 Apr 2004 16:38:36 -0600
User-agent: Mutt/1.4i

hi folks

it's been a while since i looked at scheme, and i decided to build
a copy of guile-1.6.4 and try writing some simple apps with it. i've
got a few issues to report with numeric handling:

first, i have an issue with (ice-9 format):

  guile> (format #f "~4,48x" (floor 1234))

not exactly what i had in mind. maybe it doesn't like the output
of (floor n)?

  guile> (floor 1234)

i'd expect that to be an exact integer, and indeed r5rs section 6.2.3
says that (floor n) should return an exact integer as long as the input
is exact:

  guile> (exact? 1234)

  guile> (exact? (floor 1234))

  guile> (exact? (floor (inexact->exact 1234)))


maybe the inexactness from floor is causing the problem in
(ice-9 format)?

  guile> (format #f "~4,48x" (inexact->exact (floor 1234)))

now that's more like it, but the forced exactness shouldn't be neccessary
according to the standard.

finally, on an unrelated note:

  guile> (rational? (sqrt 6))

should be #f, i think....

     Ray L   <address@hidden>

reply via email to

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