Re: [AD] use double for al_current_time and al_rest? |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: Coordination of admins/developers of the game programming library Allegro <alleg-developers@xxxxxxxxxx>
- Subject: Re: [AD] use double for al_current_time and al_rest?
- From: Chris Robinson <chris.kcat@xxxxxxxxxx>
- Date: Thu, 27 Dec 2007 14:06:45 -0800
On Thursday 27 December 2007 09:49:15 am Elias Pschernig wrote:
> Yes, but as I said, this is very unlikely to be an isse - for a timespan
> of 90 days double would stay at nanosecond precision (whereas the
> current version already would wrap around the milliseconds at 50 days).
Except it's easier to handle integer overflow (use unsigned values and just
subtract differences), whereas floats/doubles would just continue to count
upward, losing more and more decimal precision and eventually losing
whole-number precision, until hitting Inf or NaN or something and grinding to
a halt.
Plus, with doubles being 64-bit, on 32-bit compilers (GCC at least), they'll
be passed through memory by a hidden reference (unlike 32-bit floats that can
be passed on the stack/in registers).
IMO, al_rest() might work well with a float taken in seconds (rest time isn't
gauranteed to be accurate anyway), but al_current_time() would be best as an
integer value of some sort.