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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Discrepancy between Math.Round and ToString( "F" ) method 6
Math.Round problem 10
Round 3
Custom decimal round 14
Round to next value 4
understanding Math.Ceiling 7
Math.round 1
Problem With Round Function 9

Back
Top