English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

hi. I'm using VB .NET and i'm having dificulties with the math.round function, I have a number, say 103.125 it should round to 103.13, but instead it rounds to 103.12...
This is not good, please let me know how to fix this problem...
Also a sample code would be great... Thanx a lot, in advance!

2007-05-29 14:53:05 · 1 answers · asked by Irus 2 in Computers & Internet Programming & Design

1 answers

dbl = 103.125
dbl = Math.Round(dbl, 2, MidpointRounding.AwayFromZero)

Round AwayFromZero bumps a midpoint value away from zero

You can also select RoundtoEven which will round a midpoint number toward the nearest even number.

2007-05-29 15:09:15 · answer #1 · answered by MarkG 7 · 0 0

fedest.com, questions and answers