[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Floating-point formatting string
From: |
Juanma Barranquero |
Subject: |
Re: Floating-point formatting string |
Date: |
Wed, 14 Feb 2007 02:28:46 +0100 |
On 2/14/07, Vinicius Jose Latorre <address@hidden> 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