As mentioned above. I will give one example: let all test values ββbe less than 1, but greater than 0.
- 0.12 (accuracy: 3, scale: 2)
- 0.345 (accuracy: 4, scale: 3)
- 0.6789 (accuracy: 5, scale: 4)
how to convert these values ββwithout hard coding of scale and precision value.
- 0.12 β 12
- 0.345 β 345
- 0.6789 β 6789
for 0.1 and 0.01 and 0.001 should get 1 (I know this bad idea, but I was given sets of business software rules )
I prefer the solution in java, but if there is a mathematical algorithm, it is better. thanks.
java math
ommar
source share