Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 167
  • Last Modified:

Performing calculations

Hello experts:

I'm creating an input form that performs some computations and displays the answer to the user.  What data type would you suggest I use to compute this calculations.  It is pretty much straight up addition with some multiplication and division and does need to be rounded to 2 decimal places.

Thanks
0
escheider
Asked:
escheider
2 Solutions
 
Ravi SinghSenior Software EngineerCommented:
You can use the Double data type, and use the Math.Round method for rounding to two decimal places
0
 
Jeff CertainCommented:
If you only need 2 decimal places, Single will give you a slight benefit in memory requirements -- assuming that your results won't be more than +/- 3.4x10^38.

However, the trade-off will be slower performance, since double is the processor-native floating point type.
0
 
escheiderAuthor Commented:
Thank you very much......
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

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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