RFR: 8301226: Add clamp() methods to java.lang.Math and to StrictMath [v2]

Tagir F. Valeev tvaleev at openjdk.org
Sun Feb 5 13:54:51 UTC 2023


On Sun, 5 Feb 2023 13:45:15 GMT, Sergey Tsypanov <stsypanov at openjdk.org> 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:     public static float clamp(float value, float min, float max) {
>> 2297:         if (!(min < max)) {
> 
> Wouldn't it be more simple to replace `!(min < max)` with `min >= max`?

No. I want NaNs to go into this branch

-------------

PR: https://git.openjdk.org/jdk/pull/12428


More information about the core-libs-dev mailing list