I can use Math for evil ... But in a number written as 0.7000123 I need to get "123". That is, I need to extract the last 3 digits in the decimal part of the number. The least significant numbers when the first few are what most people need.
Examples:
0.7500123 -> 123
0.5150111 -> 111
It always starts with the number 5. And yes, I keep secret information inside this number, in part of the decimal, which will not affect how the number is used - this is a potentially evil part. But this is still the best way to solve a specific problem.
I am wondering if mathematical or string manipulation is the least dodgy way to do this.
Performance is not a problem because I call it once.
Can anyone see a simple math way to do this? For example, a combination of mathematical functions (I missed) in .NET?
source
share