lua-users home
lua-l archive

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

On Wed, Jun 15, 2005 at 02:54:23PM -0400, Aaron Brown wrote:
> Glenn Maynard wrote:
> > However, all of this goes away if you avoid floating-point
> > entirely.
> And use 64-bit ints instead?  (Or bignums?)

Yep.  Integers are much more easily predictable than floating-point: no
control word to enable unexpected exceptions, change the rounding
order or precision, no loss of precision due to unexpectedly large
values, results are predictable to the bit--they're much better suited
to measuring fine timings than floating point.

(Of course, not all systems have 64-bit ints, but not all systems
have doubles, either.  Since this is inherently x86-specific, nonportable
code, that's not much of an issue.  For portable code, I usually use
one 32-bit int for seconds, and one for micro- or nanoseconds.)

Glenn Maynard