integer division with float result
Jason House
jason.james.house at gmail.com
Sun Nov 18 13:24:21 PST 2007
Stas Sergeev wrote:
> Hi.
>
> This is basically an out of curiosity.
> I wonder how does D handle the integer division.
> In C, as we all know, the following:
> int a = 3;
> int b = 5;
> float c = a / b;
> will give the result that will beat the ghost
> out of any mathematician (unless you cast
> one of the operands to float, of course).
Curiously enough, I hit this very bug rather
recently with D 1.x code. I'm ashamed to say
that I hit it twice.
> So the question is: how does D handle that?
It silent does what I suspect you fear it would do.
More information about the Digitalmars-d
mailing list