This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


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

Re: IS_INF bug?


On Wed, May 10, 2000 at 11:15:17AM +0200, Dirk Herrmann wrote:
> On 9 May 2000, Kalle Olavi Niemitalo wrote:
> 
> > Dirk Herrmann <dirk@ida.ing.tu-bs.de> writes:
> > 
> > > I just changed the test to 
> > >   IS_INF(x) ((x) == (x) + 1)
> > 
> > This may misdetect large finite numbers as infinite due to
> > roundoff error.  The x/2 version has no such problem.
> 
> True, I didn't think of that :-(  I will undo that change.  For now it is
> safe anyway, since IS_INF is only used in places where x is known not to
> be zero.

why not
#define IS_INF(x) ((!(x) && (x)=(x)/2))
This ofcourse means that any side effect will be tripled (rather than
 doubled) but depending on such side effects is very errorprone.

> 
> However, the handling of special values could need some
> improvement.  Unfortunately, the systems seem to differ quite a lot with
> regard to this.
> 
> Ciao,
> Dirk

-- 
Ivan Toshkov

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