Re: summing float



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
.



Relevant Pages

  • Re: summing float
    ... Tilde F: Fixed-Format Floating-Point ... the width of the field to be printed; d is the number of digits to ... leading pad characters need to be printed and exactly d characters ... (format t "~,2F" 7.220782e+8) ...
    (comp.lang.lisp)
  • Re: Custom date format not working in ACC2003
    ... It forces the year to display as 4 digits in dates, ... setting the Format of the control won't rescue it. ... the date fields in reports always format ...
    (microsoft.public.access.reports)
  • Re: Price Data Formatting
    ... I'm loading into the application price data that has a format I do not know ... Since price data format is all dependent on the market selected (say IBM ... rounded/truncated to 2 digits following the decimal as well. ... Dim sStr As String ...
    (microsoft.public.vb.general.discussion)
  • Re: Format Problem
    ... I set the numberformat property to General and it still does ... for the long date format. ... for the month and date separator, and displays two digits for the year. ... Currency Displays a number according to the Windows regional ...
    (microsoft.public.excel.programming)
  • Re: Text formatted cells displaying numbers in scientific format
    ... It is just Excel trying to be helpful. ... When it 'sees' a large number it uses scientific format since ... I accept that Excel can't handle numbers greater than 15 digits and your ... string was 16 digits or more to be converted to a scientific value. ...
    (microsoft.public.excel)