View Single Post
  #5   Spotlight this post!  
Unread 01-02-2013, 15:12
Racer26 Racer26 is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Apr 2003
Rookie Year: 2003
Location: Beaverton, ON
Posts: 2,229
Racer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond reputeRacer26 has a reputation beyond repute
Re: remainder function

What about:

Code:
double EthersRemainder( double x, double y ){

int wholenumber;

wholenumber = (int)(x/y);

double result;

result = (x - (wholenumber * y));
if(result > 0.5*y) {
result -= y;
}

return result;

}
Reply With Quote