emacs-devel
[Top][All Lists]
Advanced

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

Re: Floating-point formatting string


From: Chong Yidong
Subject: Re: Floating-point formatting string
Date: Tue, 13 Feb 2007 20:36:05 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (gnu/linux)

Vinicius Jose Latorre <address@hidden> writes:

> Hi,
>
>
> It seems that there is a problem with floating-point formatting string
> in Emacs 22.
>
> Type
>   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




reply via email to

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