3ds.com> writes:
> When formatting a float using the exponential format, the rounding is
> different in Python-2.6 and Python-2.7. See example below. Is this
> intentional?
Yes, in a sense. Python <= 2.6 uses the OS-provided functionality (e.g., the C
library's strtod, dtoa and sprintf functi
On 10/30/2012 10:47 AM, andrew.macke...@3ds.com wrote:
> When formatting a float using the exponential format, the rounding is
> different in Python-2.6 and Python-2.7. See example below.
> Is this intentional?
>
> Is there any way of forcing the Python-2.6 behavior (for compatibility
> reasons w
andrew.macke...@3ds.com wrote:
> When formatting a float using the exponential format, the rounding is
> different in Python-2.6 and Python-2.7. See example below. Is this
> intentional?
>
> Is there any way of forcing the Python-2.6 behavior (for compatibility
> reasons when testing)?
>
It is
On Aug 10, 8:37 am, Zentrader <[EMAIL PROTECTED]> wrote:
>
> If the above does not work
> [/code]test_list = [ 5.32, 10.35634, 289.234 ]
> for num in test_list :
>str_num = "%11.5f" % (num) ## expand to at least 5
>print str_num, "-->", str_num.strip()[:5][/code]
This has the disadva
On Aug 10, 1:12 am, Peter Otten <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > I have to print float numbers to a file. Each float should be 5
> > characters in width (4 numbers and the decimal point).
> > My problem is that I do not now how to specify float to have different
> > number
[EMAIL PROTECTED] wrote:
> I have to print float numbers to a file. Each float should be 5
> characters in width (4 numbers and the decimal point).
> My problem is that I do not now how to specify float to have different
> numbers of decimals. For example
>
> 5.32 -> 5.320
> 10.356634 -> 10.357