Skip to main content

A (possible) issue spotted in java.math.BigDecimal

2 replies [Last post]
alexlamsl
Offline
Joined: 2004-09-02

Notice the last line noted with "//13"

[pre]
private static long thresholds[][] = {
{Long.MAX_VALUE, 1L}, // 0
{Long.MAX_VALUE/10L, 10L}, // 1
{Long.MAX_VALUE/100L, 100L}, // 2
{Long.MAX_VALUE/1000L, 1000L}, // 3
{Long.MAX_VALUE/10000L, 10000L}, // 4
{Long.MAX_VALUE/100000L, 100000L}, // 5
{Long.MAX_VALUE/1000000L, 1000000L}, // 6
{Long.MAX_VALUE/10000000L, 10000000L}, // 7
{Long.MAX_VALUE/100000000L, 100000000L}, // 8
{Long.MAX_VALUE/1000000000L, 1000000000L}, // 9
{Long.MAX_VALUE/10000000000L, 10000000000L}, // 10
{Long.MAX_VALUE/100000000000L, 100000000000L}, // 11
{Long.MAX_VALUE/1000000000000L, 1000000000000L},// 12
{Long.MAX_VALUE/100000000000000L, 10000000000000L},// 13
};
[/pre]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sjasja
Offline
Joined: 2004-08-15

On each line you multiply the previous divisor by 10, except on the last one you multiply it by 100. Is that what you mean?

alexlamsl
Offline
Joined: 2004-09-02

Indeed - and I can't see from the concept of a threshold why the last line shouldn't just have 13 instead of 14 zeroes ;)