[Prev][Next][Index][Thread]
Re: set precision for a floating number
"Joe Chiao" <ikjoe@ihug.co.nz> writes:
> How can I set up the precision for a floating number with the
> format-out? I want to print out a floating number with one fixed
> decimal number.
Functional Developer and Gwydion Dylan both do not support setting
precision of floating point numbers with format-out as far as I
know. I don't think it is included in the DRM either.
David Lichteblau's xformat library[1] (a Dylan implementation of the
Common Lisp FORMAT) does allow formatting of floats. You might like to
take a look at that. However, in the notes for that library it
contains the following caveat:
"CMU CL's floating-point directives are based on FLONUM-TO-STRING
and SCALE-EXPONENT. Both are missing in gd currently. A set of
workarounds can be found in `flonum-fakes.dylan', but the functions
there are based on a broken algorithm. Let me repeat that: FLONUM
PRINTING IS BROKEN!
The directives as such are implemented fully, though. If you want
to play around with them, keep in mind that you can't expect
accuracy, but that all basic functionality should be there."
[1] ftp://berlin.ccc.de/pub/gd/contributions/xformat-0.3.tar.gz
Chris.
--
http://www.double.co.nz/dylan
References: