{Geek} Spot the error
Mar. 12th, 2003 02:28 pmSpot the error, win a pint/drink thereof... and no, I didn't write this
int SimpleRound ( double high )
{
int low = (int) high;
double diff;
int result;
diff = high - low;
if (diff>=0)
result = ( diff >= (double)0.5000000 ) ? (low + 1) : low;
else
result = ( diff >= (double)-0.5000000 ) ? (low - 1) : low;
return (result);
}
int SimpleRound ( double high )
{
int low = (int) high;
double diff;
int result;
diff = high - low;
if (diff>=0)
result = ( diff >= (double)0.5000000 ) ? (low + 1) : low;
else
result = ( diff >= (double)-0.5000000 ) ? (low - 1) : low;
return (result);
}
Re: While I'm not a programmer...
Date: 2003-03-12 06:55 am (UTC)RBS got the correct answer :)