The description of the SQRT function gives the following for
the result value:
Result Value. The result has a value equal to a processor-
dependent approximation to the square root of X. A result
of type complex is the principal value with the real part
greater than or equal to zero. When the real part of the
result is zero, the imaginary part is greater than or equal
to zero.
The second sentence ot this of this seems in contradiction to the
third. Every definition of the phrase "principal value" that I've
heard for SQRT is equivalent to the requirement that the sign
of the imaginary part of the result be the same as the sign of the
imaginary part of the argument. Deleting the last sentence in
this may provide a proper description that allows both existing
behavior, but does not prohibit numerically preferable behavior
when the imaginary part of the argument is a signed zero. So,
rather than starting the discussion with a more complicated
rewrite, I will initially propose that the paragraph above be
replaced with:
Result Value. The result has a value equal to a processor-
dependent approximation to the square root of X. A result
of type complex is the principal value with the real part
greater than or equal to zero.
This permits a backward compatible implementation and the
numerically preferred one.
--
J. Giles
|