• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • 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

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

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