[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: Wed, 30 Jul 2003 16:05:42 +0200
User-agent: Mutt/1.2.5i

As Theodore A. Roth wrote:

> It's usually a bad idea to test for equality with a float since the
> equality may never be true due to the nature of floats (does 0 ==
> 10^-400?).

Comparision against constant 0.0 is guaranteed to work though.  0.0 is
one of the FP numbers that has a fixed bit pattern, like +Inf, +NaN,
-Inf, -NaN.  Note that there's a +0.0 as well as a -0.0, but they are
supposed to compare identical (which they don't do on the AVR, btw. --
there are more lurking compatibility bugs in that respect, but that's
merely off-topic here ;-).

Other powers of two can also be compared exactly (1.0 for example),
but that's already an implementation detail, while the mentioned
absolute constants are IMHO guaranteed to exist and to be comparable
by the IEEE standard.

> Been too long since I had to deal with gettimeofday(), so I can't
> pass judgement on that.

IMHO, Posix (SUSPv<something> now) doesn't standardize it but
standardizes getnanotime() instead.  No idea whether the Cygwin
etc. environments do already all emulate this.
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]