[Python-Dev] Re: [spambayes-dev] RE: RE: [Spambayes] Question (orpossibly a bug
Scott David Daniels
Fri, 25 Jul 2003 06:17:50 -0700
I've been seeing a lot of "we'll have to use float(123)/100"
messages floating around, and I'd like to point out there is an
atof-able form for floating point numbers:
256.7654e-7 = 2567654e-11
"""Return a locale-safe version of C-locale-generated floatstr"""
decpos = floatstr.index('.')
exppos = floatstr.lower().index('e')
ebias = 0
exppos = len(sv)
ebias = int(floatstr[exppos+1:])
return '%s%se%s' % (floatstr[:decpos], floatstr[decpos+1:exppos],
ebias + 1 - exppos + decpos)
-Scott David Daniels