Re: summing float
- From: Kent M Pitman <pitman@xxxxxxxxxxx>
- Date: 31 Jan 2008 01:27:36 -0500
getasso@xxxxxxxxx writes:
I am summing up a bunch of decimal number and i get a the answer
7.220782e+8
how to i covert the above to 722078200.00 normal decimal number
format.
If you look at:
22.3.3.1 Tilde F: Fixed-Format Floating-Point
C:\Program Files\LispWorks\LispWorks 4.4.5 Professional\lib\4-4-0-0\manual\online\web\CLHS\Body\22_cca.htm
You'll see this text (among other discussion):
The full form is ~w,d,k,overflowchar,padcharF. The parameter w is
the width of the field to be printed; d is the number of digits to
print after the decimal point; k is a scale factor that defaults to
zero.
...
If the w parameter is omitted, then the field is of variable
width. In effect, a value is chosen for w in such a way that no
leading pad characters need to be printed and exactly d characters
will follow the decimal point. For example, the directive ~,2F will
print exactly two digits after the decimal point and as many as
necessary before the decimal point.
So that means:
(format t "~,2F" 7.220782e+8)
722078200.00
=> NIL
.
- References:
- summing float
- From: getasso
- summing float
- Prev by Date: Re: summing float
- Next by Date: Security
- Previous by thread: Re: summing float
- Next by thread: Security
- Index(es):
Relevant Pages
|