shaji_am
asked on
Rounding problem
Hi,
I am using the round() function in my program.
when I used round(0.535,2) , I got answer 0.54
when I used round(0.536,2), I got 0.54
when I used round(0.525,2) , I got 0.52 (wrong)
when I used round(0.526,2) , I got 0.53
when I used round(0.515,2) , I got 0.52
when I used round(0.516,2), i got .52
when I used round(0.367,2) , I got 0.37
when I used round(0.357,2) , I got 0.36
when I used round(0.365,2) , I got 0.36(wrong)
when I used round(0.3656,2) , I got 0.37
etc. with different combinations and some are, most often with ending 5 and the penultimate number even gives me a wrong answer.
Do I need to set any thing through program, or any other effective function that can round values with data type double.
If not any SQL Server function for rounding.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
PatrickFransson,
Please don't lock questions with answers.
Thanks.
shaji_am,
>> If not any SQL Server function for rounding.<<
Yes, you can use the SQL Server Round function.
Anthony
Please don't lock questions with answers.
Thanks.
shaji_am,
>> If not any SQL Server function for rounding.<<
Yes, you can use the SQL Server Round function.
Anthony
Why should I not lock question, when my answer gives the solution. The question was if it can't be solved in VB, then is there a sql way, well my function works in VB so you don't need the sql way.
Because your comments is as valid as mine could be. It is simply the etiquette.
PatrickFransson,
You have been here long enough to know how it works here. If you have any further questions take the time to re-read the EE Guidelines at https://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/cmtyQuestAnswer.jsp and in particular the section under: "Advice for Experts on Providing Solutions Through Comments or Answers" and/or post a message in Community Support at https://www.experts-exchange.com/Community_Support/
Thanks,
Anthony
You have been here long enough to know how it works here. If you have any further questions take the time to re-read the EE Guidelines at https://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/cmtyQuestAnswer.jsp and in particular the section under: "Advice for Experts on Providing Solutions Through Comments or Answers" and/or post a message in Community Support at https://www.experts-exchange.com/Community_Support/
Thanks,
Anthony
ASKER
Thanks
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q196652&SD=MSKB&