This Can't Be....How is this round function working?
Code:
float round(float n){
if ((n / 10)>=0){
n--;}
return n;
}
It works...but that can't be!
I swear, it's working perfectly for me... 14.5 evaluates to 15, and 14.45 evaluates to 14.
Say we passed in 14.5, though. 14.5/10 = 1.45, which IS greater than 0. In fact, it's ALWAYS going to be > 0 unless you pass in a negative number. So 14.5 should return 13.5...not 15...what the hell?
And I assure you that there's no other function or anything getting in the way.