On 2020-11-12 10:05:16 +0000, Geoff Clare via austin-group-l at The Open Group 
wrote:
> The problem is that the phrase "negative zero" is commonly used to
> mean -0.0, so some people naturally assume that "negative" on its
> own includes "negative zero".

In the IEEE 754-2019 standard, "negative number" means "< 0".
When the intent is to include the negative zero, it is said
"negative sign" (or "negative sign bit"). According to past
discussions in the stds-754 list, "negative sign" is to be
used for all numbers (i.e. not NaN), and "negative sign bit"
for all data (numbers or NaN).

For instance:

* Concerning nextUp:

  If x is the negative number of least magnitude in x's format,
  nextUp(x) is −0. nextUp(±0) is the positive number of least
  magnitude in x's format.

(but note that among all numbers with a negative sign, −0 is the
one that has the least magnitude).

* Concerning isSignMinus:

  isSignMinus(x) is true if and only if x has negative sign.
  isSignMinus applies to zeros and NaNs as well.

but I think that it should have said "has a negative sign bit"
to take NaNs into account.

* Concerning totalOrder:

  c) If x = y:
  [...]
    3) If x and y represent the same floating-point datum:
      i) If x and y have negative sign,
  [...]
  d) If x and y are unordered numerically because x or y is a NaN:
    1) [...] where −NaN represents a NaN with negative sign bit [...]

Here, "negative sign" and "negative sign bit" are used in the
expected way.

* Concerning powd:

  powd(x, y) is powd (−1, y) × powd (abs(x), y) for finite non-integer y
  and negative x (including −0, finite negative x, and −∞).

Well, though the exact meaning is given by the parenthesized phrase,
it should have said "x of negative sign".

* In the note about the various power functions:

  powr(x, y) is defined by considering exp(y × log(x)), and thus its
  domain excludes negative x.

Here, "negative x" means "x < 0" as expected (the domain is a part of
the extended real numbers, thus takes infinities into account).

--------

In ISO C99:

  The signbit macro determines whether the sign of its argument value
  is negative.207)

  207) The signbit macro reports the sign of all values, including
       infinities, zeros, and NaNs. [...]

but

  The log functions compute the base-e (natural) logarithm of x.
  A domain error occurs if the argument is negative. A range error
  may occur if the argument is zero.

(ditto for log10), but for log2, it says "less than zero" instead of
"negative".

and for pow:

  [...] A domain error occurs if x is finite and negative and y
                                                 ^^^^^^^^
  is finite and not an integer value. A range error may occur.
  A domain error may occur if x is zero and y is zero. A domain
  error or range error may occur if x is zero and y is less than
  zero.

Like for log and log10, the meaning of "negative" is here "< 0".

Note that for sqrt, it is said "The sqrt functions compute the
nonnegative square root of x. A domain error occurs if the argument
is less than zero." Here "less than zero" is used instead of
"negative" (like for log2). But note the "nonnegative", which
includes −0, as sqrt(−0) gives −0 with Annex F (IEEE 754).

This is similar in the C17 draft I have.

> If, as you say, there are several uses of "negative" in the standard
> that are not intended to include -0.0 then perhaps we should add a
> definition along the lines of:
> 
> Negative
> 
>     When describing a value (not a sign), less than zero.
>     Note that in the phrase "negative zero" it describes a sign, and
>     therefore negative zero is not a negative value.
> 
> (and likewise for "positive").

Yes, and if you fear that "negative" may be incorrectly interpreted
in the text, you may want to replace it by "less than zero" (but the
definition above would still be useful).

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

  • [1003.1(2016... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
      • Use... Geoff Clare via austin-group-l at The Open Group
        • ... Vincent Lefevre via austin-group-l at The Open Group
          • ... Geoff Clare via austin-group-l at The Open Group
            • ... Vincent Lefevre via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group
    • [1003.1... Austin Group Bug Tracker via austin-group-l at The Open Group

Reply via email to