C# Check if a decimal has more than 3 decimal places?

后端 未结 13 1830
一生所求
一生所求 2020-12-03 14:04

I have a situation that I cannot change: one database table (table A) accepts 6 decimal places, while a related column in a different table (table B) only has 3 decimal plac

13条回答
  •  伪装坚强ぢ
    2020-12-03 14:35

    There is probably a more elegant way to do this, but off the top of my head I would try

    1. a = multiply by 1000
    2. b = truncate a
    3. if (b != a) then there is additional precision that has been lost

提交回复
热议问题