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.
sorry i a bit ignorant when it comes to number representation
many thanks
George
In article
<····································@i7g2000prf.googlegroups.com>,
·······@gmail.com wrote:
> 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.
>
> sorry i a bit ignorant when it comes to number representation
>
> many thanks
>
> George
(format nil "~,2F" 7.220782e+8)
--
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
·······@gmail.com 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
On Jan 31, 5:27 pm, Kent M Pitman <······@nhplace.com> wrote:
> ·······@gmail.com 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
thanks