[Top][All Lists]

[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:42:03 -0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070111 SeaMonkey/1.1

Chong Yidong wrote:
Vinicius Jose Latorre <address@hidden> writes:


It seems that there is a problem with floating-point formatting string
in Emacs 22.

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

Shouldn't it be "001.200"?

The Elisp manual says, of the width specification:

  If the printed representation of the object contains fewer
  characters than this width, then it is padded.

In this case, the 03 refers to the width of the entire string "1.200",
which is 5 > 3.

For example,

  M-: (format "%08.3f" 1.2)
  ==> 0001.200

Ok, thanks

reply via email to

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