Re: [AD] use double for al_current_time and al_rest?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


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.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/