From kde-devel Sun Aug 08 15:17:25 1999 From: "Dirk A. Mueller" Date: Sun, 08 Aug 1999 15:17:25 +0000 To: kde-devel Subject: Re: dump question X-MARC-Message: https://marc.info/?l=kde-devel&m=93412534820775 Uwe Thiem wrote: > Sure, if the small numbers get much smaller this problem will occur > eventually. But why so early? At this stage the sums should > differ but don't. #-( Only the first 12 decimal digits are significant when you use double's under bad conditions, 14 under good conditions. Some platforms might map double to float, which only has 5-7 significant decimal digits, therefore it might be even worse. You have to change your algorithm so that there are at most 5-6 significant digits guaranteed. remember: not the absolute value count, but the relative significance, i.e. 1000000000000000000000000.0 + 0.1 won't work, but 1.0 + 0.1 will do. Under most cases the solution is a fixed point integer, which is accurate enough for almost everything. -- Dirk A. Mueller