troubleshooting Question

Rounding problem

Avatar of shaji_am
shaji_am asked on
Visual Basic Classic
7 Comments1 Solution267 ViewsLast Modified:

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
PatrickFransson

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros