Which is faster? ulong or double

Chris Miller chris at dprogramming.com
Wed Oct 3 03:39:42 PDT 2007


On Thu, 27 Sep 2007 15:14:04 -0400, Janice Caron <caron800 at googlemail.com>  
wrote:

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

I just came across this:
    http://lua-users.org/wiki/FloatingPoint



More information about the Digitalmars-d mailing list