Documentation of methods in java.lang.Number
Seán Coffey
sean.coffey at oracle.com
Tue Dec 16 14:26:59 UTC 2014
Andreas,
this didn't get attention in the past. You can now find your report at
https://bugs.openjdk.java.net/browse/JDK-8067669
I'll leave it up to maths engineers to determine if the Number API needs
improving.
regards,
Sean.
On 16/12/2014 12:55, Andreas Lundblad wrote:
> I've noticed that the documentation of Number.longValue says:
>
>> Returns the value of the specified number as a long, which may involve rounding or truncation.
> BigInteger and BigDecimal does not seem to honor this contract since they implement this method by masking out the lower bits of the number (and I've found no definition of "rounding" or "truncation" that encompass this behavuor). The documentation of these classes even state that "[...] this conversion can lose information about the overall magnitude of the BigInteger value as well as return a result with the opposite sign."
>
> I suggest the documentation of Number.byteValue/shortValue/intValue/longValue should be updated to give room for this type of implementation.
>
> (I filed an issue on this and got a confirmation email with the following link: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7000825 Since then this page has gone missing. Where did the bug report go, and why didn't I get any notification about the removal?)
>
> -- Andreas Lundblad
More information about the core-libs-dev
mailing list