Re: w,dF under Guile and Gauche
Ken Dickey 27 Jun 2005 03:06 UTC
Stephen,
Thanks much for the feedback. I did post a new web page for SRFI-48 with the
attached code which should work as expected. [Sorry for the delay. I have
been hiking in the wilds and away from computers].
The srfi editors are a bit slow to post things. I'll ping 'em again.
Sorry for the delay.
Cheers,
-KenD
===================================================
On Wednesday 22 June 2005 12:32, Stephen Lewis wrote:
> Hi,
> I am trying to use SRFI-48 under Guile and Gauche for formatting fixed
> point output. Thanks for creating the SRFI - here is some feedback,
> I have tested SRFI-48 using the code posted here on Jun 5th (there is no
> version in source code) using both Guile and Gauche Scheme interpreters
> and I find the following apparent formatting errors:
> =======================================================================
>
> **FAIL: expected: " 1.026"
> got: " 1.260"
> from: (format "~10,3F" 1.0256)
>
> **FAIL: expected: " 1.002"
> got: " 1.200"
> from: (format "~10,3F" 1.0025)
>
> **FAIL: expected: " 1.003"
> got: " 1.300"
> from: (format "~10,3F" 1.00256)
>
> **FAIL: expected: "1.000012"
> got: "1.120000"
> from: (format "~8,6F" 1.00001234)
> =======================================================================
> Here are the tests that were run:
> =======================================================================
> ;;;
> ;;; test cases for srfi-48a.scm
> ;;; 22-Jun-2005 Stephen Lewis <xxxxxx@napanet.net>
> ;;;
> ;;; run under Guile version 1.6.4 'guile -s test2-48.scm'
> ;;; and under Gauche version 0.8.4 'gosh test2-48.scm'
> ;;;
> (load "./srfi-48a.scm")
> ;;;
> ;;; Guile and Gauche 'eval' takes 2 args
> ;;;
> (define-macro (expect expected form . compare)
> (let* ( (same? (if (null? compare) equal? (eval (car `,compare)
> (current-module) ))) (wanted (eval `,expected (current-module) ))
> (actual (eval `,form (current-module) ))
> )
> (if (same? wanted actual)
> (format #t "PASSED: ~s~%" form)
> (format #t
> "~%**FAIL: expected: ~s~% got: ~s~% from: ~s~%"
> wanted
> actual
> form))
> ) )
> ;;;===================================================
>
> (expect " 1.026" (format "~10,3F" 1.0256))
>
> (expect " 1.002" (format "~10,3F" 1.0025))
>
> (expect " 1.003" (format "~10,3F" 1.00256))
>
> (expect "1.000012" (format "~8,6F" 1.00001234))
> =======================================================================
>
> Stephen Lewis