I'm trying to compare 2 couple who came in [0.0, 1.0] Are there. My task (taken from) - Usage - Output is - I hope the first You can use a slightly larger comparison value to catch it: It is not possible to completely eliminate problems of any time with floating point numbers.
Inline bool is equal (double x, double y) {const double ipsilon = 0.000001; Return fibers (X - Y) & lt; Epsilon; }
cerr & lt; & Lt; Acquel (1.000001, 1.000002) & lt; & Lt; Endl; Serie Lieutenant; & Lt; Acquel (1.000010, 1.000020) & lt; & Lt; Endl;
0
true , Second to be
false please tell me where I am going wrong and how to fix it?
1.000001 being restricted to normal 64-bit IEEE floating point presentation In
1.0000009999999999177333620536956004798412 . Similarly
1.000002 is actually
1.0000020000000000575113290324225090444087 . Apart from
0.000001 , both are slightly more slightly different.
const double eppsilon = 0.0000011;
No comments:
Post a Comment