* r5rs section 6.2.3 inexactness and rational sqrt
@ 2004-04-16 22:38 Ray Lehtiniemi
2004-04-16 23:23 ` Kevin Ryde
0 siblings, 1 reply; 3+ messages in thread
From: Ray Lehtiniemi @ 2004-04-16 22:38 UTC (permalink / raw)
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 <rayl@mail.com>
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: r5rs section 6.2.3 inexactness and rational sqrt
2004-04-16 22:38 r5rs section 6.2.3 inexactness and rational sqrt Ray Lehtiniemi
@ 2004-04-16 23:23 ` Kevin Ryde
2004-04-16 23:49 ` Ray Lehtiniemi
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Ryde @ 2004-04-16 23:23 UTC (permalink / raw)
Cc: guile-user
Ray Lehtiniemi <rayl@mail.com> writes:
>
> 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:
Yep, that looks wrong. Marius applied a fix not so long ago in the
head, lobby him for the same in 1.6.
> guile> (rational? (sqrt 6))
> #t
>
> should be #f, i think....
Alas, sqrt 6 comes out as a flonum, which is rational.
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: r5rs section 6.2.3 inexactness and rational sqrt
2004-04-16 23:23 ` Kevin Ryde
@ 2004-04-16 23:49 ` Ray Lehtiniemi
0 siblings, 0 replies; 3+ messages in thread
From: Ray Lehtiniemi @ 2004-04-16 23:49 UTC (permalink / raw)
Cc: guile-user
On Sat, Apr 17, 2004 at 09:23:40AM +1000, Kevin Ryde wrote:
> Ray Lehtiniemi <rayl@mail.com> writes:
> >
> > 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:
>
> Yep, that looks wrong. Marius applied a fix not so long ago in the
> head, lobby him for the same in 1.6.
well, it's not super critical (for me anyway) since i have the workaround.
any idea when the next stable series is due?
> Alas, sqrt 6 comes out as a flonum, which is rational.
bummer. seems that MIT/GNU scheme 7.7.1 does the same thing too, though....
--
----------------------------------------------------------------------
Ray L <rayl@mail.com>
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-04-16 23:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-16 22:38 r5rs section 6.2.3 inexactness and rational sqrt Ray Lehtiniemi
2004-04-16 23:23 ` Kevin Ryde
2004-04-16 23:49 ` Ray Lehtiniemi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).