From: "Juanma Barranquero" <lekktu@gmail.com>
To: "Vinicius Jose Latorre" <viniciusjl@ig.com.br>
Cc: emacs-devel@gnu.org
Subject: Re: Floating-point formatting string
Date: Wed, 14 Feb 2007 02:28:46 +0100 [thread overview]
Message-ID: <f7ccd24b0702131728s5b941951vc09957e4fc4bf22f@mail.gmail.com> (raw)
In-Reply-To: <45D2630F.70105@ig.com.br>
On 2/14/07, Vinicius Jose Latorre <viniciusjl@ig.com.br> 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"
Juanma
next prev parent reply other threads:[~2007-02-14 1:28 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 [this message]
2007-02-14 1:40 ` Vinicius Jose Latorre
2007-02-14 1:36 ` Chong Yidong
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=f7ccd24b0702131728s5b941951vc09957e4fc4bf22f@mail.gmail.com \
--to=lekktu@gmail.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).