guile-devel
[Top][All Lists]
Advanced

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

Bug with large fractions


From: Ludovic Courtès
Subject: Bug with large fractions
Date: Sat, 06 Jan 2007 13:05:16 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

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.





reply via email to

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