[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Float numbers equality.
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 9 Aug 2013 10:47:01 -0300
> What is the best way, for test float equality?
> I consider to use tostring function:
> print (300 * 0.07, 21, tostring (300 * 0.07) == tostring (21)),
For this kind of numbers I think this is the best option, especially
since it's in a unit test. But you make sure you know why tests like
300 * 0.07 == 21 give false. Otherwise, tell us more about the problem
you're trying to solve.