BigDecimal..?.. Urgent help required...

What is BigDecimal.. ? Its API says... "A BigDecimal consists of an arbitrary precision integer unscaled value and a 32-bit integer scale."What does this "unscaled value" and "32-bit integer scale". means ?
[220 byte] By [Shebua] at [2007-11-27 10:00:56]
# 1
I don't answer "Urgent help required" posts.
petes1234a at 2007-7-13 0:32:30 > top of Java-index,Java Essentials,Java Programming...
# 2
Oh if it is URGENT then I will most certainly drop everything I am doing just to answer you because nobody is as important as you, are they/
floundera at 2007-7-13 0:32:30 > top of Java-index,Java Essentials,Java Programming...
# 3

Light travels at 299,792,458 metres per second which is 186,282.4 miles per second. So in one (Julian) year it travels 9,460,730,472,580,800 metres.

The commas in those numbers are purely for convenience, dividing the number into easily read groups of three. But the dot has a different significance. It says how big the number is - anything to the right of the dot is a fraction of a unit.

BigDecimal uses a similar scheme: the numbers are represented in terms of their digits from the leftmost non zero digit to the rightmost digit of interest, together with another number saying how many of the digits are to the right of the dot.Integer valuescale (put the dot this many places left of the end)

299792458 0

299792458002

18628241

186282397 3

94607304725808-2The number saying where the dot is is referred to as the "scale". Where, as in the last case, the scale is negative that means that the dot is actually to the right of the last digit and zeros (in this case two of them) must be inserted to reconstruct the number.

The bigger the "value" part is (the more digits it contains), the more precisely the value is specified. For instance the third and fourth examples are more or less the same number but the fourth has more precision. This value part is an integer and is unscaled (=="makes no attempt to say where the dot is") and is also arbitrary precision. That last part just means that the value can have as many digits as you want.

For representing the "scale" BigDecimal uses a 32 bit integer. That means that - unlike the value - the scale can only be an integer within the range that can be expressed using 32 bits. Although limited this is still a huge range.

Huge but not infinite: there is no way of expressing the fact that the first number is exact ie it has zeros "all the way down". The last example is also exact, but there's no way of telling this from the way it is represented.

[Edit] I agree, however, with everything that's been said about the urgency of this question.

pbrockway2a at 2007-7-13 0:32:30 > top of Java-index,Java Essentials,Java Programming...
# 4
> I don't answer "Urgent help required" posts.I sometimes do, but I make it a point to wait at least several hours.
jverda at 2007-7-13 0:32:30 > top of Java-index,Java Essentials,Java Programming...
# 5
the funny thing is, if he took the time to read further into the java api description of BigDecimal, he'd see all he needed to know about scale, et al. but I guess that it wasn't that urgent.
petes1234a at 2007-7-13 0:32:30 > top of Java-index,Java Essentials,Java Programming...
# 6
WOAH!Last time I read this thread, jverd's reply was after mine. Where the heck did pbrockway's reply come from?
floundera at 2007-7-13 0:32:30 > top of Java-index,Java Essentials,Java Programming...
# 7
> WOAH!> > Last time I read this thread, jverd's reply was after> mine. Where the heck did pbrockway's reply come from?Okay, so I'm not losing my mind!! I was wondering the exact same thing. Kinda bizarre.
Navy_Codera at 2007-7-13 0:32:30 > top of Java-index,Java Essentials,Java Programming...