(j3.2006) (SC22WG5.5781) [ukfortran] edits to clarify SQRT treatment ofnegative zero, for comments

Cohen Malcolm malcolm
Wed Aug 24 03:37:59 EDT 2016


I would prefer to leave the "principal value" wording alone.

I also prefer to leave the "When the real part of the result is zero" 
wording alone.  Unless you enjoy posing maths questions of people reading 
the standard to work out whether anything changed.

I also don't think this is necessary - the likely reason vendors did not 
spot the change in semantics from previous Fortran standards (77 and 90 both 
forbid negative real zero being treated differently from positive real zero) 
is just that the change in semantics occurs without any wording change in 
SQRT itself.  That is, the word "sign" in the description does not refer to 
the SIGN intrinsic directly, however since the SIGN intrinsic returns the 
"Magnitude of A with the sign of B", it is clear that "the same sign as" a 
distinguished negative real zero means a negative value.  It could well be 
more effective to point out to the offending vendor(s) that they overlooked 
this Fortran 95 change in semantics than to edit SQRT like this.  (I don't 
actively object to editing SQRT to make it more obvious though, if that's 
what people want; just that it's not necessary.)

The paper needs to add text to the Fortran 90 compatibility and Fortran 77 
compatibility subclauses to mention the change in semantics (close to where 
we talk about SIGN).

Finally, with luck and a fair breeze 16-007r2 should be available early 
September so I recommend waiting until then so that you can produce edits 
against what will be the actual live draft.

Cheers,

-----Original Message----- 
From: Anton Shterenlikht
Sent: Wednesday, August 24, 2016 1:00 AM
To: sc22wg5 at open-std.org
Subject: [ukfortran] (SC22WG5.5780) edits to clarify SQRT treatment 
ofnegative zero, for comments

Dear WG5/J3

Below is a draft of my paper to J3.
I wanted to post it here for comments first.

This has been discussed in COMP-FORTRAN-90,
the thread starts at:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind1608&L=comp-fortran-90&F=&S=&P=1866

Anton

****************************


To: J3                                                     J3/16-xxx
From: Anton Shterenlikht
Subject: clarification of SQRT text regarding minus zero
Date: 23-JUL-2016
Reference: J3/16-007r1

Discussion:
-----------

Description of SQRT, [424:6-8], does not "explicitly"
mention that negative zero is distinguished, on processors
which distinguish positive and negative zero.
According to [56:21-25] this means that positive
and negative zero actual arguments are treated
as mathematically equivalent by SQRT.
This is wrong because LOG does distinguish positive
and negative zero [394:31-395:3], and SQRT(X)
is mathematically equivalent to EXP( 0.5 * LOG(X) ).

Also [424:6-7], the word "principal" in the sentence
"A result of type complex is the principal value with
the real part greater or equal to zero." seems redundant,
as "principal" in this context means precisely "with
the real part greater or equal to zero".

I suggest to replace some text under SQRT Result Value,
and make it very similar to that of LOG with regards to
minus zero.

Edits to J3/16-007r1:
---------------------

Replace the last 2 sentences of
[424:5-8 13.9.182p5] with

"A result of type complex
is the value with the real part
greater than or equal to zero.
If the real part of X is less
than zero and the imaginary
part of X is zero, then the
imaginary part of the result is
positive if the imaginary part of X
is positive real zero or the
processor does not distinguish
between positive and negative zero,
and negative if the imaginary
part of X is negative real zero."

_______________________________________________
ukfortran mailing list
https://lists.accu.org/mailman/listinfo/ukfortran

-- 
........................Malcolm Cohen, Nihon NAG, Tokyo. 




More information about the J3 mailing list