(j3.2006) the IEEE modules and distinguishing zero values

John Reid John.Reid
Mon Nov 14 04:07:48 EST 2011



Malcolm Cohen wrote:
> Robert Corbett wrote:
>> Is a processor that returns .TRUE. for IEEE_SUPPORT_STANDARD() required
>> to distinguish between the zero values +0 and -0 (see Clause 4.4.2.3,
>> paragraph 3, page 54)?
>
> John Reid replied:
>> Yes.
>>
>> 14.9p7 says
>> "The inquiry function IEEE_SUPPORT_STANDARD is provided to inquire
>> whether the processor supports all the IEC 60559:1989 facilities
>> defined in this part of ISO/IEC 1539 for a particular kind of real."
>
> That seems rather unclear to me; the text in 4.4.2.3 makes no reference
> to IEC 60559;

I think "this part of ISO/IEC 1539" means 1539-1 as opposed to 1539-2 
and 1539-3. I don't see how it can mean 4.4.2.3.

> it is not entirely clear what "distinguish between" means
> - especially seeing as how we have for years accepted that a processor
> which does not "distinguish between" +0 and -O may nonetheless produce
> different answers for TRANSFER of these values (alternatively, one might
> hold that there never were any conforming F90 compilers, but I don't
> think that is a reasonable position to take).
>
> Thus one might conjecture that it would be permissible for a processor
> not to "distinguish" between +0 and -0 in everything other than
> IEEE_CLASS, IEEE_COPY_SIGN (and division by zero?), and that in this
> situation it would appear that all the features we explicitly link to
> IEC 60559 are in fact supported.
>
> Furthermore, the actual description of IEEE_SUPPORT_STANDARD in
> 14.11.34, which one might consider to "trump" the introductory waffle in
> 14.9, makes no mention of distinguishing zero and indeed appears on the
> face of it to contradict the introductory waffle on this issue, as it
> simply makes IEEE_SUPPORT_STANDARD the .AND. of IEEE_SUPPORT_DATATYPE
> ... IEEE_SUPPORT_SQRT. I have not gone through all the functions it
> lists carefully, but I see nothing there that obviously requires
> distinguishing zero. (If someone else has spotted something that does,
> please say which one!)

For IEEE_SUPPORT_DATATYPE, support is "as defined in the 
first 
paragraph of 14.9". This says

"Complete conformance with IEC 60559:1989 is not required, but the 
normal numbers shall be exactly those of an IEC 60559:1989 
floating-point format, ..." Here "normal" is used to distinguish from 
denormal numbers (numbers that are near zero and do not have full 
precision).
>
> So my response would be that I think the standard is unclear. Given the
> lack of rigor in the "supports the facilities" statement, I would have
> to conclude that according to its precise definition, it would appear to
> be permissible not to distinguish zero.
>
> As to what our intent might have been, I believe the existence of
> IEEE_COPY_SIGN is evidence that the authors of c14 specifically intended
> to allow processors to continue not to distinguish zero in the SIGN
> intrinsic and I/O, while conforming with IEC 60559 through the use of
> this new function.

This function was included originally to provide the IEEE copysign 
function.

> Indeed, I recall being told precisely that when I
> complained about us having IEEE_COPY_SIGN as well as changing SIGN to
> "distinguish zero". Whether that intent was shared by the rest of the
> subgroup that worked on c14 is another matter...

Cheers,

John.




More information about the J3 mailing list