8000 Fixed check for floating point inaccuracy in Base.gt, added a check in · matplotlib/matplotlib@1d45853 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1d45853

Browse files
committed
Fixed check for floating point inaccuracy in Base.gt, added a check in
Base.lt. svn path=/trunk/matplotlib/; revision=1120
1 parent d21204b commit 1d45853

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/ticker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def __init__(self, base):
495495
def lt(self, x):
496496
'return the largest multiple of base < x'
497497
d,m = divmod(x, self._base)
498-
if m==0: return (d-1)*self._base
498+
if closeto(m,0) and not closeto(m/self._base,1): return (d-1)*self._base
499499
else: return d*self._base
500500

501501
def le(self, x):
@@ -510,7 +510,7 @@ def le(self, x):
510510
def gt(self, x):
511511
'return the largest multiple of base > x'
512512
d,m = divmod(x, self._base)
513-
if closeto(m, self._base):
513+
if closeto(m/self._base,1):
514514
#looks like floating point error
515515
return (d+2)*self._base
516516
else:

0 commit comments

Comments
 (0)
0