Re: RFR: 8075806: divideExact is missing in java.lang.Math [v6]

2021-07-22 Thread Brian Burkhalter
> Please consider this proposal to add `divideExact()` methods for integral > data types to `java.lang.Math` thereby rounding out "exact" support to all > four basic arithmetic operations. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last

Re: RFR: 8075806: divideExact is missing in java.lang.Math [v5]

2021-07-22 Thread Joe Darcy
On Thu, 22 Jul 2021 19:40:46 GMT, Brian Burkhalter wrote: >> Please consider this proposal to add `divideExact()` methods for integral >> data types to `java.lang.Math` thereby rounding out "exact" support to all >> four basic arithmetic operations. > > Brian Burkhalter has updated the pull

Re: RFR: 8075806: divideExact is missing in java.lang.Math [v5]

2021-07-22 Thread Brian Burkhalter
> Please consider this proposal to add `divideExact()` methods for integral > data types to `java.lang.Math` thereby rounding out "exact" support to all > four basic arithmetic operations. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last

Re: RFR: 8075806: divideExact is missing in java.lang.Math [v4]

2021-07-15 Thread Brian Burkhalter
> Please consider this proposal to add `divideExact()` methods for integral > data types to `java.lang.Math` thereby rounding out "exact" support to all > four basic arithmetic operations. Brian Burkhalter has refreshed the contents of this pull request, and previous commits have been removed.

Re: RFR: 8075806: divideExact is missing in java.lang.Math [v3]

2021-07-15 Thread Brian Burkhalter
> Please consider this proposal to add `divideExact()` methods for integral > data types to `java.lang.Math` thereby rounding out "exact" support to all > four basic arithmetic operations. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last

Re: RFR: 8075806: divideExact is missing in java.lang.Math

2021-07-14 Thread Brian Burkhalter
On Wed, 14 Jul 2021 16:45:20 GMT, Joe Darcy wrote: > Are there examples in the JDK or its tests where a method with this > definition would be used? I have not identified any as yet. I did verify however that there are no uses in `open/src/**/*.java` of either `absExact()` or `negateExact()`,

Re: RFR: 8075806: divideExact is missing in java.lang.Math [v2]

2021-07-14 Thread Brian Burkhalter
On Wed, 14 Jul 2021 16:43:32 GMT, Joe Darcy wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8075806: Separate div-by-0 verbiage; change impl > > src/java.base/share/classes/java/lang/Math.java line 1008: > >>

Re: RFR: 8075806: divideExact is missing in java.lang.Math [v2]

2021-07-14 Thread Brian Burkhalter
> Please consider this proposal to add `divideExact()` methods for integral > data types to `java.lang.Math` thereby rounding out "exact" support to all > four basic arithmetic operations. Brian Burkhalter has updated the pull request incrementally with one additional commit since the last

Re: RFR: 8075806: divideExact is missing in java.lang.Math

2021-07-14 Thread Raffaello Giulietti
Mysteries of JIT compilation... On 2021-07-14 21:53, Brian Burkhalter wrote: On Tue, 13 Jul 2021 17:21:52 GMT, Brian Burkhalter wrote: Please consider this proposal to add `divideExact()` methods for integral data types to `java.lang.Math` thereby rounding out "exact" support to all four

Re: RFR: 8075806: divideExact is missing in java.lang.Math

2021-07-14 Thread Brian Burkhalter
On Tue, 13 Jul 2021 17:21:52 GMT, Brian Burkhalter wrote: > Please consider this proposal to add `divideExact()` methods for integral > data types to `java.lang.Math` thereby rounding out "exact" support to all > four basic arithmetic operations. @rgiulietti Actually your trick is the

Re: RFR: 8075806: divideExact is missing in java.lang.Math

2021-07-14 Thread Brian Burkhalter
On Tue, 13 Jul 2021 17:21:52 GMT, Brian Burkhalter wrote: > Please consider this proposal to add `divideExact()` methods for integral > data types to `java.lang.Math` thereby rounding out "exact" support to all > four basic arithmetic operations. Thanks. I was thinking of leveraging the

Re: RFR: 8075806: divideExact is missing in java.lang.Math

2021-07-14 Thread Raffaello Giulietti
Sorry, typo int q = x / y; if ((x & y & q) >= 0) { return q; // q, not r } throw new ArithmeticException("integer overflow"); On 2021-07-14 21:26, Raffaello Giulietti wrote: One could also divide first and then check the result: int q = x / y; if ((x & y & q) >= 0) {     return r; }

Re: RFR: 8075806: divideExact is missing in java.lang.Math

2021-07-14 Thread Raffaello Giulietti
One could also divide first and then check the result: int q = x / y; if ((x & y & q) >= 0) { return r; } throw new ArithmeticException("integer overflow"); No idea about relative perf. On 2021-07-13 19:32, Brian Burkhalter wrote: Please consider this proposal to add `divideExact()`

Re: RFR: 8075806: divideExact is missing in java.lang.Math

2021-07-14 Thread Joe Darcy
On Tue, 13 Jul 2021 17:21:52 GMT, Brian Burkhalter wrote: > Please consider this proposal to add `divideExact()` methods for integral > data types to `java.lang.Math` thereby rounding out "exact" support to all > four basic arithmetic operations. Are there examples in the JDK or its tests

Re: RFR: 8075806: divideExact is missing in java.lang.Math

2021-07-13 Thread Brian Burkhalter
On Tue, 13 Jul 2021 17:21:52 GMT, Brian Burkhalter wrote: > Please consider this proposal to add `divideExact()` methods for integral > data types to `java.lang.Math` thereby rounding out "exact" support to all > four basic arithmetic operations. Note: The `StrictMath` equivalents were

RFR: 8075806: divideExact is missing in java.lang.Math

2021-07-13 Thread Brian Burkhalter
Please consider this proposal to add `divideExact()` methods for integral data types to `java.lang.Math` thereby rounding out "exact" support to all four basic arithmetic operations. - Commit messages: - 8075806: divideExact is missing in java.lang.Math Changes: