unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Project: a good floating point printer/reader.
@ 2002-05-09 20:17 Marius Vollmer
  2002-05-13 21:01 ` Rob Browning
  0 siblings, 1 reply; 24+ messages in thread
From: Marius Vollmer @ 2002-05-09 20:17 UTC (permalink / raw)


Hi,

I think we need a better floating point printer and or reader.  The
current ones can not print denormal numbers, and the string printed
will not always read back as the exact same number (as required by
R5RS).


guile> (define (t x) (= x (string->number (number->string x))))
guile> (t 0.1432987654987436)
#f
guile> (t 0.1432987654987430)
#t

(That is no special number.  I just tried a couple until t returned #f.)

guile> (/ 1e-308 2)
#.#

Also, Guile should be able to read denormal number:

guile> 1e-309
ERROR: In procedure string->number:
ERROR: Argument out of range: -309
ABORT: (out-of-range)


Good algorithms might be the ones describes in these two papers:

  Printing Floating Point Numbers Quickly and Accurately. Robert
  G. Burger and R. Kent Dybvig. ACM SIGPLAN 1996 Conference on
  Programming Language Design and Implementation, June
  1996.

  http://www.cs.indiana.edu/~dyb/FP-Printing-PLDI96.ps.gz


  William D Clinger. How to Read Floating Point Numbers Accurately. In
  Proceedings of the 1990 ACM Conference on Programming Language
  Design and Implementation, pages 92-101.

  ftp://ftp.ccs.neu.edu/pub/people/will/howtoread.ps

If anyone wants to work on this, that would be great.

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


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

end of thread, other threads:[~2002-06-01 16:01 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-09 20:17 Project: a good floating point printer/reader Marius Vollmer
2002-05-13 21:01 ` Rob Browning
2002-05-15 18:30   ` Marius Vollmer
2002-05-16 15:35     ` The Guile license and the use of LGPL libs (like GMP) Rob Browning
2002-05-16 16:44       ` Greg Troxel
2002-05-16 17:01       ` Bruce Korb
2002-05-16 17:12         ` Rob Browning
2002-05-21 19:55           ` Carl R. Witty
2002-05-21 23:44             ` Rob Browning
2002-05-16 17:21       ` Jeff Read
2002-05-16 17:22         ` Rob Browning
2002-05-16 20:40           ` Jeff Read
2002-05-16 23:17             ` Rob Browning
2002-05-16 23:35               ` Jeff Read
2002-05-17  0:02                 ` Rob Browning
2002-05-28 18:56               ` Marius Vollmer
2002-05-28 18:28       ` Marius Vollmer
2002-05-28 18:54         ` Bruce Korb
2002-05-28 19:23           ` Marius Vollmer
2002-05-28 19:39             ` Bruce Korb
2002-05-28 19:54               ` Marius Vollmer
2002-05-28 20:16                 ` Bruce Korb
2002-06-01 16:01                   ` Marius Vollmer
2002-05-28 19:02         ` Rob Browning

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