Document: WG14 N1465


negate


Submitter: Fred J. Tydeman (USA)
Submission Date: 2010-05-10
Related documents: N1430
Subject: negate

Background: IEC 60559-1989 [IEEE-754-1985] has the following:

Some functions, such as the copy operation y := x without change of format, may at the implementor's option be treated as nonarithmetic operations which do not signal the invalid operation exception for signaling NaNs; the functions in question are (1), (2), (6), and (7).

2. -x is x copied with its sign reversed, not 0 - x; the distinction is germane when x is +/-0 or NaN. Consequently, it is a mistake to use the sign bit to distinguish signaling NaNs from quiet NaNs.

Since Annex F of C99 is a binding between C language and IEC 60559, the requirements of IEC 60559 apply. But, C99 did not do a good job of specifying some of those requirements.

To make matters clearer:

Change existing F.3

-- The unary minus (-) operator provides the minus (-) operation recommended in the Appendix to IEC 60559.

to

-- The unary minus (-) operator provides the negate (-) operation recommended in the Appendix to IEC 60559. It only affects the sign bit. It reverses the sign bit, including for zeros and NaNs.

Add to Raionale:

In IEC 60559, negate is considered a bit operation that affects only the sign bit.