unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* ice-9 format doesn't typecheck
@ 2006-03-08  9:08 Han-Wen Nienhuys
  2006-03-10 23:26 ` Kevin Ryde
  0 siblings, 1 reply; 3+ messages in thread
From: Han-Wen Nienhuys @ 2006-03-08  9:08 UTC (permalink / raw)



Hello,

ice-9 format is broken:


muurbloem:/tmp$ guile --version
Guile 1.7.2
..

guile> (use-modules (ice-9 format))
guile> (format #f "~$" "02.4738")
"24.74"


Can we have typechecking for the various ~ flags in format strings?

Thanks!



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


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

* Re: ice-9 format doesn't typecheck
  2006-03-08  9:08 ice-9 format doesn't typecheck Han-Wen Nienhuys
@ 2006-03-10 23:26 ` Kevin Ryde
  2006-09-07 21:13   ` Kevin Ryde
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Ryde @ 2006-03-10 23:26 UTC (permalink / raw)
  Cc: guile-devel

hanwen@byrd.xs4all.nl (Han-Wen Nienhuys) writes:
>
> guile> (format #f "~$" "02.4738")
> "24.74"

I think it's supposed to be a feature that strings work for the
floating point output.  I put "number or number string" in the manual
to show that.

Though in this case it seems the output is wrong. :-(


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


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

* Re: ice-9 format doesn't typecheck
  2006-03-10 23:26 ` Kevin Ryde
@ 2006-09-07 21:13   ` Kevin Ryde
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Ryde @ 2006-09-07 21:13 UTC (permalink / raw)
  Cc: hanwen

[-- Attachment #1: Type: text/plain, Size: 191 bytes --]

hanwen@byrd.xs4all.nl (Han-Wen Nienhuys) writes:
>
> guile> (format #f "~$" "02.4738")
> "24.74"

I found the bug, a one line fix in the stripping of leading zeros.  It
now gives "2.4738".



[-- Attachment #2: format.scm.leading-zeros.diff --]
[-- Type: text/plain, Size: 599 bytes --]

--- format.scm.~1.25.4.1.~	2006-02-21 09:15:27.000000000 +1100
+++ format.scm	2006-09-07 17:58:49.000000000 +1000
@@ -1461,8 +1461,8 @@
 				(if (> format:fn-dot left-zeros) 
 				    (begin		; norm 0{0}nn.mm to nn.mm
 				      (format:fn-shiftleft left-zeros)
-				      (set! left-zeros 0)
-				      (set! format:fn-dot (- format:fn-dot left-zeros)))
+				      (set! format:fn-dot (- format:fn-dot left-zeros))
+				      (set! left-zeros 0))
 				    (begin		; normalize 0{0}.nnn to .nnn
 				      (format:fn-shiftleft format:fn-dot)
 				      (set! left-zeros (- left-zeros format:fn-dot))

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

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

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

end of thread, other threads:[~2006-09-07 21:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-08  9:08 ice-9 format doesn't typecheck Han-Wen Nienhuys
2006-03-10 23:26 ` Kevin Ryde
2006-09-07 21:13   ` Kevin Ryde

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