all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vinicius Jose Latorre <viniciusjl@ig.com.br>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Floating-point formatting string
Date: Tue, 13 Feb 2007 23:40:13 -0200	[thread overview]
Message-ID: <45D2687D.90708@ig.com.br> (raw)
In-Reply-To: <f7ccd24b0702131728s5b941951vc09957e4fc4bf22f@mail.gmail.com>

Juanma Barranquero wrote:
> 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"

Ok, width of ALL string representation.

I thought it was the integer part width only.


Thanks,


Vinicius

  reply	other threads:[~2007-02-14  1:40 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 [this message]
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

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

  git send-email \
    --in-reply-to=45D2687D.90708@ig.com.br \
    --to=viniciusjl@ig.com.br \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.