This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: numerical instability and estimate-probability



On Thursday, November 15, 2001, at 02:31 , mike stump wrote:

> One can `fix' this by doing the arithmetic in double, doing it safely,
> and then chopping the number down to say, 5 or 10 digits at the end.
> This way increase the odds that the numbers will be the same of all
> platforms, and that the same code will be generated.  [ crossed
> fingers we can do without a portible math library ]

In practice you will not achieve this. With probabilities, one
might often end up in exact inbetween cases, where double rounding
as is done on x86 when using double can wreak havoc. Even apart
from the x86, it is hard to guarantee bit-identical results on
different systems.

I think GCC should just not use floating-point arithmetic at all
for making code generation decisions. It might be best to define
a probability type using integers and have some functions for adding
and multiplying them.

   -Geert


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]