J3/05-158 Date: 7 February 2005 To: J3 From: Van Snyder Subject: Negative zero Date: 2004-01-07 at 17:17:03 Request number: Pub-109 Name: James Giles E_mail: jamesgiles@att.net ======================================================= Number: Title: Negative zero Submitted by: J3 Status: For Consideration References: FCD §4.4.2, 04-216 Basic Functionality: §4.4.2 of the standard requires behavior concerning signed real zeroes that is inconsistent with common expectations. If all intrinsic functions are prohibited from recognizing the difference between positive and negative zero, then the following results are required (all of which, to meet common expectations should be different): AIMAG((0.0, -0.0)) -> 0.0 CMPLX(-0.0, -0.0) -> (0.0, 0.0) CONJG((0.0, -0.0)) -> (0.0, -0.0) ! DBLE(-0.0) -> 0.0d0 DPROD(0.0, -0.0) -> 0.0d0 MAX(-1.0, -0.0) -> 0.0 MIN(1.0, -0.0) -> 0.0 REAL(-0.0d0) -> 0.0 ASIN(-0.0) -> 0.0 ATAN(-0.0) -> 0.0 SIN(-0.0) -> 0.0 SINH(-0.0) -> 0.0 TAN(-0.0) -> 0.0 TANH(-0.0) -> 0.0 TRANSFER(-0.0, 0.0) -> 0.0 MERGE(-0.0, 1.0, .true.) -> 0.0 There are other cases that are also arguably controlled by the existing constraint (in which -0.0 appears as a value inside an array argument, for example). None of the above results meet common expectations. Rationale: Many existing implementations already ignore this constraint. To force them to conform would decrease their quality of implementation. Of those intrinsic functions relevant to this constraint, all should distinguish positive from negative zero, rather than being prohibited from doing so. Estimated Impact: Little. Simply eliminating the constraint will require no changes to existing implementations. Existing Fortran programs already have to accomodate negative zeros as results from implementations that violate the constraint. In future, people will more often want behavior consistent with usual practice among the rest of the numerical software community. Eliminating the constraint will permit implementations to accomodate this trend. Detailed Specification: Do not require the sign of real zero to be ignored in actual arguments to intrinsic functions. Referring to the FCD: Delete item (2) from the numbered list in §4.4.2. History: Submitted as Pub-109 Subsumed by interpretation 03/0029 J3/05-158 at J3 meeting 171