From 4e7427769e4dee40808fd4db58bc877833f2c2c2 Mon Sep 17 00:00:00 2001 From: Matvey Adzhigirey Date: Tue, 4 Dec 2012 16:16:49 -0800 Subject: [PATCH] Added a comment for int-casting of math.ceil(). --- Source/bonds.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/bonds.py b/Source/bonds.py index 882713c..d9da657 100644 --- a/Source/bonds.py +++ b/Source/bonds.py @@ -351,6 +351,8 @@ class bondmaker: #print('z range: [%6.2f;%6.2f] %6.2f'%(zmin,zmax,zlen)) # how many boxes do we need in each dimension? + # NOTE: math.ceil() returns an int in python3 and a float in python2, + # so we need to cast it to int for range() to work. self.no_box_x = max(1, int(math.ceil(xlen/box_size))) self.no_box_y = max(1, int(math.ceil(ylen/box_size))) self.no_box_z = max(1, int(math.ceil(zlen/box_size)))