posted 12 years ago
It really depends on what you're trying to achieve. For instance, if you still need 4.81 in various other calculations and with the same high precision, then I would store it in a BigDecimal.
Btw, the reason why you lose precision in number formats such as Double, is because there is only a limited amount of number combinations that can be stored within the 64 bit constraints of a Double. As you know, there is an unlimited amount of numbers in between each range of numbers, for instance between 1 and 2 you can have 1.1, 1.11, 1.111, 1.00000001, etc... But since 64 bits cannot hold each and every possible number, it gets "rounded" to the nearest possible value, thereby causing some loss in precision. This is a limit that originates from the size of CPU and/or FPU registers, so basically hardware limits.