unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Bug with large fractions
@ 2007-01-06 12:05 Ludovic Courtès
  2007-01-07 21:43 ` Kevin Ryde
  2007-01-09 19:54 ` Ludovic Courtès
  0 siblings, 2 replies; 4+ messages in thread
From: Ludovic Courtès @ 2007-01-06 12:05 UTC (permalink / raw)


Hi,

Before I forget about it, I noticed a bug with large fractions.  It
shows up in the following example:

  guile> 123123123123123123.12
  123123123123123000.0

A quick look at numbers.c:mem2decimal_from_point, and then trying to
re-execute the algorithm in there by hand shows that this is not a
reader bug:

  guile> (define x (* 123123123123123123 100))
  guile> x
  12312312312312312300
  guile> (set! x (+ x 12))
  guile> x
  12312312312312312312
  guile> (set! x (/ x 100))
  guile> x
  3078078078078078078/25 ;; this is wrong!
  guile> (exact->inexact x)
  123123123123123000.0

This is executed on a Guile before Han-Wen's fix, FWIW.  Perhaps people
more knowledgeable about this will have an idea of what's going wrong.

Thanks,
Ludovic.



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-01-09 19:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-06 12:05 Bug with large fractions Ludovic Courtès
2007-01-07 21:43 ` Kevin Ryde
2007-01-09 19:52   ` Ludovic Courtès
2007-01-09 19:54 ` Ludovic Courtès

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).