>  >
>  > > The idea seems to be that someone was worried about
>  > > numeric overflow. If that is the case I do not think I like
>  > > the approach that was taken. #defining
>  > > MILLISECONDS_PER_SECOND as a long will cause all calculations
>  > > that use it to do 32 bit math which is substantially slower
>  > > on our system than 16 bit math.
> 
> Which do you want, slow accurate values or fast inaccurate ones?
> How often do you actually do this calculation?

My choice was not slow and accurate as opposed to fast and inaccurate. 
The nature of the numbers used in this calculation are such that 16 bit 
math is sufficient to avoid overflow, so my choices were slower accurate 
32 bit math or faster accurate 16 bit math.  I write embedded real time 
machine control code and there are instances where these calculations 
are done by an interrupt handler and they must get in and get out as 
fast as possible.  A conscious choice needs to be made by the programmer 
choosing data size in these cases.




Reply via email to