Skip to content

Commit

Permalink
Fix self test on arm (github bug #58)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremysanders committed Feb 14, 2014
1 parent dc27413 commit 96b1818
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 1 addition & 6 deletions tests/runselftest.py
Expand Up @@ -233,12 +233,7 @@ def runTests():

oldflt = svg_export.fltStr
def fltStr(v, prec=1):
# this is to get consistent rounding to get the self test correct... yuck
# decimal would work, but that drags in loads of code
# convert float to string with prec decimal places

v = round(v, prec+2)

"""Only output floats to 1 dp."""
return oldflt(v, prec=prec)

if __name__ == '__main__':
Expand Down
3 changes: 3 additions & 0 deletions veusz/document/svg_export.py
Expand Up @@ -44,6 +44,9 @@ def fltStr(v, prec=2):
"""Change a float to a string, using a maximum number of decimal places
but removing trailing zeros."""

# ensures consistent rounding behaviour on different platforms
v = round(v, prec+2)

val = ('% 20.10f' % v)[:10+prec]

# drop any trailing zeros
Expand Down

0 comments on commit 96b1818

Please sign in to comment.