samedi 1 août 2015

Rounding issue in python [duplicate]

This question already has an answer here:

Here is my input

import numpy as np

array = [0.29, 0.59, 0.12]
na_array = np.array(array)
a = np.sum([0.29, 0.59, 0.12])
print a
if (a == 1.0):
    print "success"

the output is:

1.0

Why isn't "success" printed?

Aucun commentaire:

Enregistrer un commentaire