[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))
"1234.0"
not exactly what i had in mind. maybe it doesn't like the output
of (floor n)?
guile> (floor 1234)
1234.0
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)
#t
guile> (exact? (floor 1234))
#f
guile> (exact? (floor (inexact->exact 1234)))
#f
hmm....
maybe the inexactness from floor is causing the problem in
(ice-9 format)?
guile> (format #f "~4,48x" (inexact->exact (floor 1234)))
"04d2"
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))
#t
should be #f, i think....
--
----------------------------------------------------------------------
Ray L <address@hidden>

**r5rs section 6.2.3 inexactness and rational sqrt**,
*Ray Lehtiniemi* **<=**