[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: dump question
From:       "Dirk A. Mueller" <dmuell () gmx ! net>
Date:       1999-08-08 15:17:25
[Download RAW message or body]

Uwe Thiem <uwe@uwix.alt.na> 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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic