我有以下问题:
我有三个清单:
radius=3.0
fcr_size=2.0
x1 = np.arange(0,5.0+0.3,0.3)
y1 = np.arange(0,5.0+0.3,0.3)
z1 = np.arange(0,5.0+2.0,2.0)
for coords in itertools.product(x1,y1,z1):
if radius < distance.euclidean([0,0,0],coords) <= (radius+fcr_size):
xyz_pattern.append(coords)
为什么float的输出产生这样的东西?:
(3.2999999999999998, 2.6999999999999997, 2.0)
(3.2999999999999998, 2.6999999999999997, 4.0)
(3.2999999999999998, 2.6999999999999997, 6.0)
(3.2999999999999998, 3.0, 0.0)
(3.2999999999999998, 3.0, 2.0)
(3.2999999999999998, 3.0, 4.0)
(3.2999999999999998, 3.0, 6.0)
(3.2999999999999998, 3.2999999999999998, 0.0)
(3.2999999999999998, 3.2999999999999998, 2.0)
(3.2999999999999998, 3.2999999999999998, 4.0)
(3.2999999999999998, 3.2999999999999998, 6.0)
为什么不这样:
(3.3, 2.7, 2.0), (3.3, 2.7, 4.0), (3.3, 2.7, 6.0) .....