Which is faster? ulong or double

Janice Caron caron800 at googlemail.com
Thu Sep 27 12:14:04 PDT 2007


I have this app I've written, and it needs to keep track of an integer
quantity (time in microseconds, as it happens, but that's an
unimportant detail). The point is, there are circumstances where the
numbers involved get bigger than uint.max.

So the question is, given that I'm using a 32-bit platform, should I
switch to ulong, or to double?

ulong sounds the most logical, since the quantity will always be an
integer, but (correct me if I'm wrong) ulongs are emulated in
software, which is fine for add and subtract, but not so fine for
divide; whereas doubles have direct hardware support, and so might
actually end up being faster if there are lots of divides.

Am I talking nonsense? Is there a recommendation?



More information about the Digitalmars-d mailing list