On Tue, 16 Sep 2025 23:14:13 GMT, Joe Darcy <[email protected]> wrote:

> Okay -- while some of the changes here are clearly bugs, that doesn't obviate 
> the need for a quick CSR review.

I see.

> Regarding _integer_ values, 0 is conventionally neither positive nor 
> negative; it stands alone, hence Math.signum(int):
> 
> "Returns the signum function of the specified int value. (The return value is 
> -1 if the specified value is negative; 0 if the specified value is zero; and 
> 1 if the specified value is positive.)"
> 

While JLS as well as `Long` and `Integer` primitive wrapper classes do not seem 
to define what positive and negative integers are, other core classes hint on 
these terms strongly. One example is `Math.signum`, which you provided.

Another example is `Comparator.compare(T, T)`:

> Compares its two arguments for order. Returns a negative integer, zero, or a 
> positive integer as the first argument is less than, equal to, or greater 
> than the second.

So yes, in Java, an integer i is called:

  * positive, if i > 0
  * negative, if i < 0
  * zero, if i = 0

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

PR Comment: https://git.openjdk.org/jdk/pull/27296#issuecomment-3302355429

Reply via email to