[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avrdude-dev] Adding elapsed time

From: Joerg Wunsch
Subject: Re: [avrdude-dev] Adding elapsed time
Date: Thu, 31 Jul 2003 17:57:02 +0200
User-agent: Mutt/1.2.5i

As Theodore A. Roth wrote:

> I don't think that that invalidates my statement. As a casual user
> of floating point math, I would rather stick to a general rule that
> works in all cases than remember all the gory details that are only
> true is certain circumstances.

That's why i mentioned the specific nature of 0.0.  It /is/ safe to
compare this value for equality (unlike most other FP values).  The
NaN and Inf cases are certainly less frequently needed.

> I can see one use of an equality check though, to check for div by
> zero (kinda puedo-code, so don't consider it anything but a hack
> example):
> float reciprocal (float foo)
> {
>   if (0.0 == foo)
>      return NaN;
>   else
>      return 1.0/foo;

Without the check, on an IEEE-compliant implementation, the function
is supposed to return +Inf (or -Inf).  The days where this caused a
SIGFPE should be past now.
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]