Fred J. Tydeman <tydeman@xxxxxx> wrote, on 27 Aug 2008:
>
> On Wed, 27 Aug 2008 12:23:22 +0100, Geoff Clare wrote:
>
> >Since C99 does not specify underflow for tgamma(), all of this new
> >text should be CX shaded.
>
> I disagree. C99 does not specify underflow for any function.
> C99 does specify range error (which includes both overflow
> and underflow) for many math functions (including tgamma and exp).
Okay, the general rule about underflow in C99 (7.12.1 para 5) means
we don't need to CX shade the addition to the ERRORS section.
However, at least part of the addition to the RETURN VALUE section
includes requirements beyond C99 and should therefore be CX shaded.
Quoting from the minutes:
| If the correct value would cause underflow, and is not representable,
| a range error may occur, [MX] and either 0.0 (if supported), or [/MX]
| an implementation-defined value shall be returned.
|
| [MX] If the correct value would cause underflow, and is representable,
| a range error may occur and the correct value shall be returned. [/MX]
I think it should be:
If the correct value would cause underflow, [CX]and is not
representable[/CX], a range error may occur, and [CX MX] either 0.0
(if supported), or [/CX MX] an implementation-defined value shall be
returned.
[MX] If the correct value would cause underflow, and is
representable, a range error may occur[/MX] [CX MX]and the
correct value shall be returned.[/CX MX]
I see that the minutes say the new text was copied from exp(). I think
the CX shading is needed there too, as I can't see anything in C99
7.12.1, 7.12.6.1, F.9 or F.9.3.1 that requires exp() to return the
correct value if it would cause underflow and is representable (and
IEC 60559 is supported).
I have also come across a side issue to do with MX shading, having
used "CX MX" in the above and then wondered whether that was a valid
code combination. The description of the MX code says:
"IEC 60559 Floating-Point
The functionality described is optional. The functionality
described is also an extension to the ISO C standard."
For most (if not all) of the MX shading we have in descriptions of
functions from C99 I believe it is incorrect to say that the
functionality is "an extension to the ISO C standard." It is
functionality that C99 mandates for implementations that define
the __STDC_IEC_559__ macro. (F.1 says "An implementation that
defines __STDC_IEC_559__ shall conform to the specifications in this
annex.")
I think we should change the description of the MX code to something
like:
"IEC 60559 Floating-Point
The functionality described is optional. Also, where the
functionality relates to functions specified by the ISO
C standard, it is mandated by the ISO C standard only for
implementations that define __STDC_IEC_559__."
And anywhere that we make additional requirements on MX implementations
beyond what's in C99 Annex F we should use CX MX shading.
--
Geoff Clare <g.clare@xxxxxx>
The Open Group, Thames Tower, Station Road, Reading, RG1 1LX, England
|