emacs-devel
[Top][All Lists]
Advanced

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

Re: Floating-point formatting string


From: Vinicius Jose Latorre
Subject: Re: Floating-point formatting string
Date: Tue, 13 Feb 2007 23:40:13 -0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2pre) Gecko/20070111 SeaMonkey/1.1

Juanma Barranquero wrote:
On 2/14/07, Vinicius Jose Latorre <address@hidden> wrote:

Type
   M-: (format "%03.3f" 1.2) RET
   ==> "1.200"

Shouldn't it be "001.200"?

From format's docstring:

 The basic structure of a %-sequence is
   % <flags> <width> <precision> character
 where flags is [- #0]+, width is [0-9]+, and precision is .[0-9]+

You're saying "flag = 0, width = 3, precision = 3". That overflows the
width = 3.

Try

 (format "%07.3f" 1.2) => "001.200"

Ok, width of ALL string representation.

I thought it was the integer part width only.


Thanks,


Vinicius





reply via email to

[Prev in Thread] Current Thread [Next in Thread]