Thomas said:
How to get fractional digits from decimal value without first converting
to string and searching for decimal character?
Example: 123.456 -> 456
This is actually not a bad approach. Numerically, your question doesn't make
a lot of sense. To simply get the fractional part of a number (0.456) you
can use Math.Abs(x - Math.Truncate(x)), but in order to know that you need
to multiply that number by 1000, you have to know its (rounded) base 10
representation. What should the "fractional digits" be for the result of 1.0
/ 3.0? An infinite string of 3s? How about the result of 1.0 / 16.0? Is that
625 or "0625"?
The best approach depends on what you intend to use the result for. For
display, a string approach is fine. For calculation, it's dubious whether
you need this at all.