xxxxxxxxxx
// You can use any of the following
double d = 20.5;
int i = d.truncate(); // i = 20; discards any fractional digits
int i = d.toInt(); // i = 20; truncates to an integer, same as truncate()
int i = d.round(); // i = 21; closest integer to d
int i = d.ceil(); // i = 21; least integer no smaller than d
int i = d.floor(); // i = 20; greatest integer no greater than d
xxxxxxxxxx
int calc_ranks(ranks) {
double multiplier = .5;
return (multiplier * ranks).round();
}
xxxxxxxxxx
int calc_ranks(ranks) {
double multiplier = .5;
return (multiplier * ranks).round();
}