Re: double/float precision question

2009-04-01 Thread Steven D'Aprano
On Wed, 01 Apr 2009 19:13:33 +0200, TP wrote: > Hi everybody, > > Try the following python statements: > "%.40f" % 0.222 > '0.098864108374982606619596' float( 0.222) > 0.1 Remove the leading quote

Re: double/float precision question

2009-04-01 Thread Nick Craig-Wood
TP wrote: > Hi everybody, > > Try the following python statements: > > >>> "%.40f" % 0.222 > '0.098864108374982606619596' > >>> float( 0.222) > 0.1 > > It seems the first result is the same than the fol

Re: double/float precision question

2009-04-01 Thread Dave Angel
It's not at all clear what you really want. You say you want to "use" the %e format, but then imply you're then going to turn it back into a float. Since I don't know what the end goal is, I'll just comment generally. All Python floating point is equivalent to the 'double' type of the C imp

Re: double/float precision question

2009-04-01 Thread Mensanator
On Apr 1, 12:13 pm, TP wrote: > Hi everybody, > > Try the following python statements: > > >>> "%.40f" % 0.222 > > '0.098864108374982606619596'>>> float( > 0.222) > > 0.1 > > It seems the first result is the s

double/float precision question

2009-04-01 Thread TP
Hi everybody, Try the following python statements: >>> "%.40f" % 0.222 '0.098864108374982606619596' >>> float( 0.222) 0.1 It seems the first result is the same than the following C program: #