Wilhelm Korrengk <[EMAIL PROTECTED]> writes: > even if I`m not THE Pro coding c++ > I thought I`m already better not to ask the following:
... code expecting double equality ... > It does not matter whether i is positive or negative while will > stop when i is 0. > > But is doesn`t. You need to read up on float/double representation in the computer: http://docs.sun.com/source/806-3568/ncg_goldberg.html You should note that 0.1 is *not* representable exactly when using IEEE-standard representation. You should *never* compare two floats/doubles for equality. Instead, always to this: if (abs(x - y) < epsilon) ... Or, in the case of your program: while (1.e-10 < i) { ... } Also note that 'i' is ideomatically used as an *integer* index. Use 'd' or some descriptive name instead. Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus