munkres icon indicating copy to clipboard operation
munkres copied to clipboard

test_profit_float fails on 32bit systems

Open stefanor opened this issue 5 years ago • 3 comments

d9fefe31cee6271ee5cf75c1a2ead0b352e081dd introduced test_profit_float, which passes on 64bit platforms, but not 32bit. At least in my testing on i386 and Debian armhf:

======================================================================
FAIL: test.test_munkres.test_profit_float
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/stefanor/git/munkres/test/test_munkres.py", line 171, in test_profit_float
    assert_almost_equal(profit, 362.65)
AssertionError: 392.65000000000003 != 362.65 within 7 places (30.000000000000057 difference)

stefanor avatar Oct 17 '20 17:10 stefanor

Presumably this is due to using sys.maxize in the calculation, a carry-over from the integer test_profit.

float is the same size on 32 & 64 bit platforms, but sys.maxsize will differ by many orders of magnitude, causing a loss of precision of the result on 64bit.

stefanor avatar Oct 17 '20 18:10 stefanor

I also have the same problem when compiling on EeePC 1001HA (32bit)

IMG_0034

takedawilliam avatar Dec 05 '20 10:12 takedawilliam

Same error for armv7l

tgunnoe avatar Dec 17 '20 14:12 tgunnoe