Which is faster? ulong or double

BCS ao at pathlink.com
Thu Sep 27 12:35:00 PDT 2007


Reply to Janice,

> 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?
> 

unless you are crunched for space, you might as well use real rather than 
double. As to real vs ulong, I don't know.





More information about the Digitalmars-d mailing list