(j3.2006) (SC22WG5.5780) edits to clarify SQRT treatment of negative zero, for comments
Robert Corbett
robert.corbett
Wed Aug 24 07:18:01 EDT 2016
On 8/23/2016 9:00 AM, Anton Shterenlikht wrote:
> 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) ).
They are not mathematically equivalent when X is zero.
In that case, SQRT(X) is well-defined, but the expression
EXP( 0.5 * LOG(X) ) is mathematical nonsense, because the
log of zero is undefined.
> 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".
They are not "precisely" the same. The usual mathematical
definition of the principal value of the square root is that
the argument phi of the principal value of the square root
lies in the range -pi < phi <= pi. This condition implies
that the real part of the principal value of the square root
is greater than or equal to zero. However, it also implies
that the imaginary part of the principal value of the square
root of a complex number z = u + 0i, where u is a negative
real number, is greater than or equal to zero. Clearly,
the meaning of the term "principal value" in the Fortran
standard's definition of SQRT is not the usual mathematical
meaning of the term for such values.
> 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."
>
More information about the J3
mailing list