Remove decimals without rounding

Viewed 979

I have some variable length decimal numbers for ex: 1.123, 1.1234, 12.12345,

I need only the first 4 decimals. I can't use Math.Round() because I do not want rounded numbers, I just want to trim it and keep only first 4, like 1.1234, or 22.1234. Is there a way to accomplish this? Thank you.

2 Answers

Multiply by 10000, store as integer to get rid off any remaining decimals. Divide by 10000.

Related