Bug in Long.parseUnsignedLong
Brian Burkhalter
brian.burkhalter at oracle.com
Thu Dec 19 20:21:27 UTC 2013
Here's a formalization of the suggested fix:
http://cr.openjdk.java.net/~bpb/8030814/webrev/
It works against the test case.
Brian
On Dec 19, 2013, at 11:26 AM, Brian Burkhalter wrote:
> Upon inspection only that indeed looks correct.
>
> Thanks …
>
> On Dec 19, 2013, at 10:28 AM, Louis Wasserman wrote:
>
>> Here's one approach that works: there is overflow iff
>>
>> compareUnsigned(first, divideUnsigned(MAX_UNSIGNED, radix)) > 0 || (first == divideUnsigned(MAX_UNSIGNED, radix) && second > remainderUnsigned(MAX_UNSIGNED, radix));
>>
>> Since radix <= Character.MAX_RADIX, you can precompute the divides and remainders in a small table.
>
More information about the core-libs-dev
mailing list