Reviewer needed: 6282196 There should be Math.mod(number, modulo) methods

Roger Riggs Roger.Riggs at
Thu Oct 11 14:10:52 UTC 2012

The floorDiv/floorMod functions do not throw exceptions for out of range 
to be consistent with the builtin language math operations.
The |toIntExact |method is used by developers because it does the
range check and throws an exception.
It is cleaner not to mix the semantics of the two operations.


On 10/10/2012 10:30 AM, Stephen Colebourne wrote:
> On 10 October 2012 15:22, Roger Riggs<Roger.Riggs at>  wrote:
>> A reviewer is needed for:
>> 6282196 There should be Math.mod(number, modulo) methods
>> The webrev is:
> Just to note that floorMod(long, int) is not present. This is often
> useful as the mod side generally fits in 32 bits, which means the
> result can fit in 32 bits. This often saves the need to call
> toIntExact() on the result.
> Stephen

Thanks, Roger

Oracle Java Platform Group

Green Oracle <> Oracle is committed to 
developing practices and products that help protect the environment

More information about the core-libs-dev mailing list