Possible bug when formatting a currency amount

Trying to develop my own function I have realized that when having a currency amount the analytics website shows it with no decimal positions, even for small amounts.

Checking the code I have found that the DoubleValueSizeBasedDecimalPlaceFormatter, which seems to be the responsible of formatting, computes a bad scale (line 33 in the class):

int scale = Math.abs(value.longValue()) > _threshold ? _largeNumberDecimalPlaces : _smallNumberDecimalPlaces;

For this code and considering the default initialization CCY_DEFAULT (line 17 in the class), if value is 100.1234 the scale variable is _largeNumberDecimalPlaces (that is 0), since a long value is being compared numerically with the threshold (10 for this case). Maybe it should compared String.valueOf(value.longValue()).size() > _threshold.

Is this a bug or I’m missing anything? Thanks for your help.

See the test case. Basically, it is correct for 100.1234 to return “100”, as the value 100 is greater than 10. You would see decimal places for values like 5.1234.

Thanks Stephen for the clarification, I’m afraid I didn’t understand correctly the format. I thought the scale was related to the number of digits, rather than how big the value is.