groovy - Is there a way to get the number of places after the decimal point in a java double? -
I am working on a Java / Groovic program. I have a double variable that keeps the number typed by a user. I really want to know how many users were typed on the right side of the decimal place is something like this: double digits = 3.14 num.get plus () == 2 Of course, you can not do this because using these double IEEE floating points and all this is an approximation. Considering that I can not go to the typed string user, but only that double entry can be used, in which the value is kept, there is a way i a bi-squabble or Can somesuch clear that double to get the "real" number of decimal places? (When the screen is double-edged, it gets cured, so I think it can be at least guessed?) No, you can not ... because there are several different strings that the user could type in which all would be parsed in the same value. To type approximately "real" the number is sure to be more decimal place than the user. For example, 3.14 is properly stored as 3....