Anonymous user
Getting the number of decimal places: Difference between revisions
Getting the number of decimal places (view source)
Revision as of 17:36, 21 October 2020
, 3 years ago→{{header|Java}}: added implementation for java
Alpha bravo (talk | contribs) (Added AutoHotkey) |
(→{{header|Java}}: added implementation for java) |
||
Line 97:
1.2345e+54 has 0 decimals
</pre>
=={{header|Java}}==
<lang java>public static int findNumOfDec(double x){
String str = String.valueOf(x);
if(str.endsWith(".0")) return 0;
else return (str.substring(str.indexOf('.')).length() - 1);
}
=={{header|Julia}}==
|