How to write string (float) to file?
Grant Edwards
grante at visi.com
Wed Aug 29 13:58:49 EDT 2001
In article <MK9j7.54164$c8.24157345 at news1.denver1.co.home.com>, Rainer Deyke wrote:
>> result of that expression. The OP was told he could use "%.2f" to format
>> his results. That's the simplest way to do what he asked, and AFAICT it
>> produces correct results.
>>
>> You seem to be telling the OP that he's wrong, float(a)/b isn't
>> good enough, and he shouldn't be using floating point?
>
> That is essentially what I was saying. I read the OP's
> question as "How do I calculate a/b accurately to two decimal
> places?", and that's the question I answered.
I see -- I thought you were saying there was something
unreliable about the "%" operator. If it's an accounting
application, then he probably needs to be using either
fixed-point or BCD-floating-point math.
--
Grant Edwards grante Yow! I'm in direct contact
at with many advanced fun
visi.com CONCEPTS.
More information about the Python-list
mailing list