Oh and in the <limits> header, you can use numeric_limits<double>::epsilon(), as it's the C++ way. Macros are C. |
BTW: even the epsilon isn't really the smalles reprezentable number. |
numeric_limits<double>::min()
is 2.22507e-308
numeric_limits<double>::epsilon()
to help you do your comparison with zero. I would put the result of it into your own variable so you don't have to write all that every time you want to use it.