unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: Vinicius Jose Latorre <viniciusjl@ig.com.br>
Cc: emacs-devel@gnu.org
Subject: Re: Floating-point formatting string
Date: Tue, 13 Feb 2007 20:36:05 -0500	[thread overview]
Message-ID: <87mz3hy0ze.fsf@stupidchicken.com> (raw)
In-Reply-To: <45D2630F.70105@ig.com.br> (Vinicius Jose Latorre's message of "Tue\, 13 Feb 2007 23\:17\:03 -0200")

Vinicius Jose Latorre <viniciusjl@ig.com.br> 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

  parent reply	other threads:[~2007-02-14  1:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-14  1:17 Floating-point formatting string Vinicius Jose Latorre
2007-02-14  1:28 ` Juanma Barranquero
2007-02-14  1:40   ` Vinicius Jose Latorre
2007-02-14  1:36 ` Chong Yidong [this message]
2007-02-14  1:42   ` Vinicius Jose Latorre
2007-02-14 16:26   ` Stuart D. Herring
2007-02-14 16:32     ` Andreas Schwab
2007-02-14 16:35     ` Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mz3hy0ze.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=viniciusjl@ig.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).