Values with 3 decimal places entering erroneously

Asked

Viewed 255 times

0

I have a textbox in which I inform a value of an item that must be divided to 10 people registered in the system, but that are divided by proportion, who has more item receives more of the new value informed, who has less will receive less.

The system is dividing correctly, but always with 0,001 cents more or less, not hitting the account, for example if I informed 100 in value and entered in the bank when making the sum is always 99,999 or 100,001 not closing the account, I am using

Math.Round((decimal)valor, 3) 

to take only 3 houses after the comma, but always gives this difference in the end, can anyone help me? I thank you already.

  • I respect the honourable Member’s decision to believe that this question is duplicated, but I disagree. The topics mentioned by the same says "How to represent the real type" is not what I want. The other says how to convert string to double, but that’s not what I want. My variable is not string and decimal not hitting value of 3 decimal place when adding up. The first one says what types of data to use, but that’s not what I want since I know what kind of data to use: "decimal". The question is only why the 3rd house is not respecting the correct value in question...

  • Stand if you can put the account as a minimum example? since it is using a decimal type, maybe in the division has something we can point out.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.