I currently have a
long timestamp measured in units of 100ns elapsed since January 1st, 1900. I need to convert it to milliseconds.
I have the choice of either multiplying by
0.0001 or dividing by
10_000. Although at first glance they sound the same, the former would actually cause an implicit cast to a
double - the latter would of course result in another
long with the remainder truncated.
Which would yield a better result? Obviously
double is an imprecise type that introduces errors due to the use of a mantissa, floating radix, and exponent, but would that error be less or more than the error from performing the simple integer division? Or would the error be demonstrably negligible?
To give an example of one of my values, here is one of the timestamps:
I'm specifically referring to C#, but this question should be general to computer science.