Hi,
I've been having problems with the NumberKey(long) constructor.
The following statement outputs "9900000000000000":
System.out.println((new NumberKey(9900000000000001L)).toString());
This is because NumberKey(long) uses the BigDecimal(double)
constructor and introduces floating point errors:
The constructor should use the valueOf(long) static factory method
to avoid the conversion errors.
public NumberKey(long key)
{
- this.key = new BigDecimal(key);
+ this.key = BigDecimal.valueOf(key);
}
Regards,
Matt
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]