On Tue, 7 Feb 2023 13:30:24 GMT, Tagir F. Valeev wrote:
>> A pure `int`‑only overload doesn’t have to go through the `int` → `long` →
>> `int` conversion.
>
> Is this a real problem?
This should not be a problem with C2, and with the lower compilation levels
this insignificant impact seems to
On Tue, 7 Feb 2023 13:09:39 GMT, ExE Boss wrote:
>> @ExE-Boss which problem such an overload would solve? It looks like, `int
>> clamp(long, int, int)` can be used everywhere where proposed `int clamp(int,
>> int, int)` could be useful.
>
> A pure `int`‑only overload doesn’t have to go through
On Mon, 6 Feb 2023 08:44:22 GMT, Tagir F. Valeev wrote:
>> src/java.base/share/classes/java/lang/Math.java line 2213:
>>
>>> 2211: * @since 21
>>> 2212: */
>>> 2213: public static int clamp(long value, int min, int max) {
>>
>> There should probably also be a pure `int` overload:
On Mon, 6 Feb 2023 09:03:48 GMT, Quan Anh Mai wrote:
>> @ExE-Boss I think that immediately following `isNaN` checks give enough hint
>> that we want NaN to be here.
>
> Ah I see, a comment explaining the intention would be helpful here, then
Ok, added some explanatory comments. Hopefully they c
On Sun, 5 Feb 2023 18:14:28 GMT, ExE Boss wrote:
>> Tagir F. Valeev has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Typo in doc fixed
>
> src/java.base/share/classes/java/lang/Math.java line 2215:
>
>> 2213: public static int clamp(
On Mon, 6 Feb 2023 08:46:54 GMT, Tagir F. Valeev wrote:
>> That should probably include a comment then.
>
> @ExE-Boss I think that immediately following `isNaN` checks give enough hint
> that we want NaN to be here.
Ah I see, a comment explaining the intention would be helpful here, then
-
On Sun, 5 Feb 2023 18:08:47 GMT, ExE Boss wrote:
>> No. I want NaNs to go into this branch
>
> That should probably include a comment then.
@ExE-Boss I think that immediately following `isNaN` checks give enough hint
that we want NaN to be here.
-
PR: https://git.openjdk.org/jdk/p
On Mon, 6 Feb 2023 03:25:50 GMT, Quan Anh Mai wrote:
>> No. I want NaNs to go into this branch
>
> @amaembo Should that be `if (!(min <= max))` instead?
@merykitty no. I want `min = +0.0` and `max = -0.0` to go into this branch, so
we can report it. A marginal case when `min` and `max` are exac
On Sun, 5 Feb 2023 18:13:35 GMT, ExE Boss wrote:
>> Tagir F. Valeev has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Typo in doc fixed
>
> src/java.base/share/classes/java/lang/Math.java line 2213:
>
>> 2211: * @since 21
>> 2212:
On Sun, 5 Feb 2023 13:52:23 GMT, Tagir F. Valeev wrote:
>> src/java.base/share/classes/java/lang/Math.java line 2297:
>>
>>> 2295: */
>>> 2296: public static float clamp(float value, float min, float max) {
>>> 2297: if (!(min < max)) {
>>
>> Wouldn't it be more simple to repla
On Sat, 4 Feb 2023 21:34:50 GMT, Tagir F. Valeev wrote:
>> clamp() methods added to Math and StrictMath
>>
>> `int clamp(long, int, int)` is somewhat different, as it accepts a `long`
>> value and safely clamps it to an `int` range. Other overloads work with a
>> particular type (long, float a
On Sun, 5 Feb 2023 13:52:23 GMT, Tagir F. Valeev wrote:
>> src/java.base/share/classes/java/lang/Math.java line 2297:
>>
>>> 2295: */
>>> 2296: public static float clamp(float value, float min, float max) {
>>> 2297: if (!(min < max)) {
>>
>> Wouldn't it be more simple to repla
On Sun, 5 Feb 2023 13:45:15 GMT, Sergey Tsypanov wrote:
>> Tagir F. Valeev has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Typo in doc fixed
>
> src/java.base/share/classes/java/lang/Math.java line 2297:
>
>> 2295: */
>> 2296:
On Sat, 4 Feb 2023 21:34:50 GMT, Tagir F. Valeev wrote:
>> clamp() methods added to Math and StrictMath
>>
>> `int clamp(long, int, int)` is somewhat different, as it accepts a `long`
>> value and safely clamps it to an `int` range. Other overloads work with a
>> particular type (long, float a
On Sat, 4 Feb 2023 15:09:04 GMT, Emily wrote:
>> Tagir F. Valeev has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Typo in doc fixed
>
> src/java.base/share/classes/java/lang/Math.java line 2209:
>
>> 2207: * @param max maximal allow
> clamp() methods added to Math and StrictMath
>
> `int clamp(long, int, int)` is somewhat different, as it accepts a `long`
> value and safely clamps it to an `int` range. Other overloads work with a
> particular type (long, float and double). Using similar approach in other
> cases (e.g. `flo
16 matches
Mail list logo