Updates:
Summary: `Should (Not) Be Equal As Numbers` and `Convert To Number` should take precision as an optional argument
        Status: Started
        Owner: pekka.klarck

Comment #6 on issue 109 by pekka.klarck: `Should (Not) Be Equal As Numbers` and `Convert To Number` should take precision as an optional argument
http://code.google.com/p/robotframework/issues/detail?id=109

I spent a little time studying what is the correct way to compare floating point numbers and found out that "it depends". Rounding numbers definitely isn't a good general solution, but simple solutions like `abs(a -b) < delta` doesn't work much better either. Limitations of various approaches are explained in this great article:
http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm

After thinking about this a little I decided that the simple rounding solution is adequate for a BuiltIn keyword. I will add a note to the keyword docs about the limitations and suggest that people who need better precision can implement their own context sensitive keywords.

I also decided to add same `precision` argument to `Convert To Number` keyword. This kind of rounding behavior can be useful there alone, and having rounding in one place eases implementing `Should (Not) Be Equal As Numbers`.

Reply via email to