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 def safestr(floatstr): """Return a locale-safe version of C-locale-generated floatstr""" try: decpos = floatstr.index('.') except ValueError: return floatstr try: exppos = floatstr.lower().index('e') except ValueError: ebias = 0 exppos = len(sv) else: ebias = int(floatstr[exppos+1:]) return '%s%se%s' % (floatstr[:decpos], floatstr[decpos+1:exppos], ebias + 1 - exppos + decpos) floating-point-need-not-use-fractional-mantissas-ly yours, -Scott David Daniels
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4