Round function?

  • Thread starter Thread starter ORC
  • Start date Start date
O

ORC

Is there a round function that do a "Normal" rounding and not the round to
nearest as the Math.Rounds is?

Math.Round(3.44, 1); //Returns 3.4.
Math.Round(3.45, 1); //Returns 3.4.
Math.Round(3.46, 1); //Returns 3.5.

but what I am looking for is a round function that returns 3.5 when rounding
the value 3.45 in the above. By the way The ToString does a normal
rounding - thank you Microsoft!

Thanks
Ole
 
use
var a = Float.round(3.5);gives 4.0
var b = Float.round(3.4); gives 3.0
 
Rajagopal Pasupuleti said:
use
var a = Float.round(3.5);gives 4.0
var b = Float.round(3.4); gives 3.0

Not sure which language you're using there, but if you mean Math.Round,
Math.Round (4.5) returns 4, so it's still using Banker's Rounding,
rather than the "normal" rounding the OP wants.
 
Back
Top