D
DavidW
Hello,
What is the most reliable way, or the standard way, of determining whether an
integer division operation produces an integer result? I'm using this at
present:
long n1;
long n2;
// stuff
....
// n1, n2 != 0
if(n1/n2 == (double)n1/n2)
{
....
}
I can't see how that can fail, excluding cases of overflow or underflow, but I
thought I'd better ask. I'm using VC++ 6.0.
What is the most reliable way, or the standard way, of determining whether an
integer division operation produces an integer result? I'm using this at
present:
long n1;
long n2;
// stuff
....
// n1, n2 != 0
if(n1/n2 == (double)n1/n2)
{
....
}
I can't see how that can fail, excluding cases of overflow or underflow, but I
thought I'd better ask. I'm using VC++ 6.0.