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

Re: floating point and other comments

This page is part of the web mail archives of SRFI 48 from before July 7th, 2015. The new archives for SRFI 48 contain all messages, not just those from before July 7th, 2015.

On Monday 22 December 2003 04:48 am, Alex Shinn wrote:
> At Sun, 21 Dec 2003 16:45:37 +0100, Ken Dickey wrote:
> > I have not done the work, but it I would guess that supporting ~w,dF
> > would at least double the size of the reference implementation.
> Attached is a modification to the reference implementation that adds
> support for ~w,dF (and thus also lays the groundwork for other format
> chars to take parameters) and incurs less than 50% increase in size

A good start.  Unfortunately,  the code did not do the whole job.


 (format #f "~4,2F" 23.45678)
-> "23.4"  ;; expected "23.46"

 (format #f "~6,3F" 3/17)
-> " 22/12"   ;; expected " 0.176"

 (format #f "~6,3F" (sqrt -3.9))
-> " 0.000"  ;; expected something more like "0.0+1.975i" ?

 (format #f "~4,2F" 32) 
-> "3200"  ;; expected "32.00"

Note tha CL defines ~F for non-numeric arguments:

[CL] (format nil "~6,2F" "foo")
-> "   foo"

I am willing to do the work, but I suspect that handling such cases would make 
the code larger--and cons more.

It _is_ a slippery slope.  Perhaps a snoboard?  8^)