Parent Directory | Revision Log | Patch
revision 1.15 by styxman, Tue Dec 3 18:02:56 2002 UTC | revision 1.16 by jlenton, Fri Dec 6 12:06:36 2002 UTC | |
---|---|---|
# | Line 7 | Line 7 |
7 | # a tener un hermoso 0.0, en vez de un Exception) | # a tener un hermoso 0.0, en vez de un Exception) |
8 | ||
9 | def a2f(a, p=2): | def a2f(a, p=2): |
10 | f=0.0; | s=str(a) |
11 | if (a) and len(str(a)) > 0: | f=0.0 |
12 | s=str(a); | while ((not f) and len(s)): |
13 | f=round(float(s), p); | try: |
14 | return(f); | f=float(s) |
15 | except ValueError: | |
16 | pass | |
17 | s=s[0:-1] | |
18 | return(round(f, p)) | |
19 | ||
20 | ||
21 | # hace que rollback funcione como uno en general quiere (por | # hace que rollback funcione como uno en general quiere (por |
|
savannah-hackers-public@gnu.org | ViewVC Help |
Powered by ViewVC 1.1.26 |