robinbloke: (Default)
[personal profile] robinbloke
Spot 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);
}

Re: While I'm not a programmer...

Date: 2003-03-12 06:55 am (UTC)
From: [identity profile] robinbloke.livejournal.com
Nope it's a macro C style if...then...else statement, which I hate.
RBS got the correct answer :)

Profile

robinbloke: (Default)
robinbloke

January 2016

S M T W T F S
     12
3456789
10111213141516
17181920212223
24 252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 20th, 2026 04:07 pm
Powered by Dreamwidth Studios