Wednesday, 14 August 2013

C# Calculations With Decimal Places

C# Calculations With Decimal Places

I am having trouble with basic multiplication and division in C#.
It returns 0 for ((150 / 336) * 460) but the answer should be 205.357142857.
I presume this is because (150/336) is a negative number, and C# rounds
this up to 0.
How do I correctly calculate this taking into consideration all decimal
places?

No comments:

Post a Comment