• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

I need to always round up one sig digit

I need 2.32 to always round to 2.4.

Wil this work?
decimal minAllowedAmount = decimal.Round(minAmount+0.05M, 1);


Thanks.
0
newbieweb
Asked:
newbieweb
  • 2
  • 2
2 Solutions
 
Todd GerbertIT ConsultantCommented:
Yes, that will work.
0
 
newbiewebSr. Software EngineerAuthor Commented:
Are there any uninteded consequences? Like making a number round too much?

Is this consider best practice? Any other ways?
0
 
Todd GerbertIT ConsultantCommented:
>> Are there any uninteded consequences? Like making a number round too much?
Nope.


>> Is this consider best practice? Any other ways?
I can't be absolutely, positively, 100% certain - but I'm pretty sure (99.99%) - that's the only way to do it.
0
 
newbiewebSr. Software EngineerAuthor Commented:
Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now