Mail Archives: djgpp-workers/2003/11/04/11:26:15
--part1_178.21df22b4.2cd92cee_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit
Greetings:
I have reached the point where I need to implement the requirements stated in
paragraph 7.12 Mathematics <math.h>, subparagraph 9, of ISO/IEC 9899:1999
(E). The standard calls for establishment of three macros:
MATH_ERRNO
MATH_ERREXCEPT
which "shall expand to the integer constants 1 and 2, respectively," and
math_errhandling
which "shall expand to an expression that has type int and the value
MATH_ERRNO, MATH_ERREXCEPT, or the bitwise-inclusive OR of both."
The Standard goes on to say,
"The value of math_errhandling is constant for the duration of the program.
It is unspecified whether math_errhandling is a macro or an identifier with
external linkage."
So, which is the better way to proceed? Should math_errhandling be a macro
or an identifier with external linkage? If it is an identifier with external
linkage, how can that be implemented?
Appended to this email as a postscript in my most-recent communication on
this thread.
KB Williams
=====================================================
PS
In a message dated 10/28/2003 9:53:59 AM Eastern Standard Time, Kbwms writes:
> Subj: Re: C99 Functions Under Development and Checkout
> Date: 10/28/2003 9:53:59 AM Eastern Standard Time
> From: <A HREF="mailto:Kbwms">Kbwms</A>
> To: <A HREF="mailto:djgpp-workers AT delorie DOT com">djgpp-workers AT delorie DOT com</A>
>
>
>
> A continuing problem that should be solved soon is not knowing what to do in
> the math functions when an error occurs. All function specifications at
>
> <A HREF="http://www.opengroup.org/onlinepubs/007904975/toc.htm">http://www.opengroup.org/onlinepubs/007904975/toc.htm</A>
>
> contain the following text:
>
> On error, the expressions (math_errhandling &MATH_ERRNO) and
> (math_errhandling &MATH_ERREXCEPT) are independent of each
> other, but at least one of them must be non-zero.
>
> At the moment, every function assumes that both expressions are non-zero
> because neither 'math_errhandling' nor 'MATH_ERREXCEPT' is defined.
>
> My intention is to implement the aforementioned variables and modify all
> existing code to check those expressions. At the beginning, both expressions
> will be non-zero.
>
> Appended to this email as a postscript are specifications taken from math.h
> at the linkage given above.
>
>
> Is this the desired behavior?
>
>
> KB Williams
>
>
> PS
>
>
>
> >> The following macros shall expand to the integer constants 1 and 2,
>> respectively;
>>
>>
>> >>> MATH_ERRNO
>>> MATH_ERREXCEPT
>>>
>>
>> The following macro shall expand to an expression that has type int and the
>> value MATH_ERRNO, MATH_ERREXCEPT, or the bitwise-inclusive OR of both:
>> >>> math_errhandling
>>>
>>
>> The value of math_errhandling is constant for the duration of the program.
>> It is unspecified whether math_errhandling is a macro or an identifier with
>> external linkage. If a macro definition is suppressed or a program defines
>> an identifier with the name math_errhandling, the behavior is undefined. If
>> the expression (math_errhandling &MATH_ERREXCEPT) can be non-zero, the
>> implementation shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW
>> in <fenv.h><A HREF="http://www.opengroup.org/onlinepubs/007904975/basedefs/fenv.h.html">. </A>
>>
>>
>
--part1_178.21df22b4.2cd92cee_boundary
Content-Type: text/html; charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable
<HTML><FONT FACE=3Darial,helvetica><FONT SIZE=3D3 FAMILY=3D"SERIF" FACE=3D"=
Georgia" LANG=3D"0">Greetings:<BR>
<BR>
I have reached the point where I need to implement the requirements stated i=
n paragraph 7.12 Mathematics <math.h>, subparagraph 9, of ISO/IEC 9899=
:1999 (E). The standard calls for establishment of three macros:<BR>
<BR>
</FONT><FONT COLOR=3D"#000000" style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D2=
FAMILY=3D"SANSSERIF" FACE=3D"Arial" LANG=3D"0">MATH_ERRNO</FONT><FONT COLO=
R=3D"#000000" style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D3 FAMILY=3D"SERIF"=20=
FACE=3D"Georgia" LANG=3D"0"><BR>
</FONT><FONT COLOR=3D"#000000" style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D2=
FAMILY=3D"SANSSERIF" FACE=3D"Arial" LANG=3D"0">MATH_ERREXCEPT<BR>
<BR>
</FONT><FONT COLOR=3D"#000000" style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D3=
FAMILY=3D"SERIF" FACE=3D"Georgia" LANG=3D"0">which "shall expand to the int=
eger constants 1 and 2, respectively," and<BR>
<BR>
math_errhandling<BR>
<BR>
which "shall expand to an expression that has type <B>int</B> and the value=20=
MATH_ERRNO, MATH_ERREXCEPT, or the bitwise-inclusive OR of both."<BR>
<BR>
<BR>
The Standard goes on to say,<BR>
<BR>
"The value of math_errhandling is constant for the duration of the program.&=
nbsp; It is unspecified whether math_errhandling is a macro or an identifier=
with external linkage."<BR>
<BR>
So, which is the better way to proceed? Should math_errhandling be a m=
acro or an identifier with external linkage? If it is an identifier wi=
th external linkage, how can that be implemented?<BR>
<BR>
<BR>
Appended to this email as a postscript in my most-recent communication on th=
is thread.<BR>
<BR>
<BR>
KB Williams<BR>
<BR>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D<BR>
PS<BR>
<BR>
In a message dated 10/28/2003 9:53:59 AM Eastern Standard Time, Kbwms writes=
:<BR>
<BR>
<BLOCKQUOTE TYPE=3DCITE style=3D"BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT=
: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px"></FONT><FONT COLOR=3D"#000000"=
style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D2 FAMILY=3D"SANSSERIF" FACE=3D"A=
rial" LANG=3D"0">Subj: <B>Re: C99 Functions Under Development and Checkout <=
/B><BR>
Date: 10/28/2003 9:53:59 AM Eastern Standard Time<BR>
From: <A HREF=3D"mailto:Kbwms">Kbwms</A><BR>
To: <A HREF=3D"mailto:djgpp-workers AT delorie DOT com">djgpp-workers AT delorie DOT com<=
/A><BR>
<BR>
<BR>
<BR>
</FONT><FONT COLOR=3D"#000000" style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D3=
FAMILY=3D"SERIF" FACE=3D"Georgia" LANG=3D"0">A continuing problem that shou=
ld be solved soon is not knowing what to do in the math functions when an er=
ror occurs. All function specifications at<BR>
<BR>
<A HREF=3D"http://www.opengroup.org/onlinepubs/007904975/toc.htm">http://www=
.opengroup.org/onlinepubs/007904975/toc.htm</A><BR>
<BR>
contain the following text:<BR>
<BR>
On error, the expressions (math_errhandling &MATH_ERR=
NO) and <BR>
(math_errhandling &MATH_ERREXCEPT) are independent of=
each <BR>
other, but at least one of them must be non-zero.<BR>
<BR>
At the moment, every function assumes that both expressions are non-zero bec=
ause neither 'math_errhandling' nor 'MATH_ERREXCEPT' is defined.<BR>
<BR>
My intention is to implement the aforementioned variables and modify all exi=
sting code to check those expressions. At the beginning, both expressi=
ons will be non-zero.<BR>
<BR>
Appended to this email as a postscript are specifications taken from math.h=20=
at the linkage given above.<BR>
<BR>
<BR>
Is this the desired behavior?<BR>
<BR>
<BR>
KB Williams<BR>
<BR>
<BR>
PS<BR>
<BR>
<BR>
</FONT><FONT COLOR=3D"#000000" style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D2=
FAMILY=3D"SANSSERIF" FACE=3D"Arial" LANG=3D"0"><BR>
<BLOCKQUOTE TYPE=3DCITE style=3D"BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT=
: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px">The following macros shall expa=
nd to the integer constants 1 and 2, respectively;<BR>
<BR>
<BR>
<BLOCKQUOTE TYPE=3DCITE style=3D"BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT=
: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px">MATH_ERRNO<BR>
MATH_ERREXCEPT<BR>
</BLOCKQUOTE><BR>
</FONT><FONT COLOR=3D"#000000" style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D3=
FAMILY=3D"SERIF" FACE=3D"Georgia" LANG=3D"0"><BR>
The following macro shall expand to an expression that has type <B>int</B> a=
nd the value MATH_ERRNO, MATH_ERREXCEPT, or the bitwise-inclusive OR of both=
:<BR>
<BLOCKQUOTE TYPE=3DCITE style=3D"BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT=
: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px"></FONT><FONT COLOR=3D"#000000"=
style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D2 FAMILY=3D"SANSSERIF" FACE=3D"A=
rial" LANG=3D"0">math_errhandling<BR>
</BLOCKQUOTE><BR>
</FONT><FONT COLOR=3D"#000000" style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D3=
FAMILY=3D"SERIF" FACE=3D"Georgia" LANG=3D"0"><BR>
The value of math_errhandling is constant for the duration of the program. I=
t is unspecified whether math_errhandling is a macro or an identifier with e=
xternal linkage. If a macro definition is suppressed or a program defines an=
identifier with the name math_errhandling, the behavior is undefined. If th=
e expression (math_errhandling &MATH_ERREXCEPT) can be non-zero, the imp=
lementation shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLO=
W in <fenv.h><A HREF=3D"http://www.opengroup.org/onlinepubs/007904975/=
basedefs/fenv.h.html">. </A></FONT><FONT COLOR=3D"#000000" style=3D"BACKGRO=
UND-COLOR: #ffffff" SIZE=3D2 FAMILY=3D"SANSSERIF" FACE=3D"Arial" LANG=3D"0">=
<BR>
<BR>
</BLOCKQUOTE></FONT><FONT COLOR=3D"#000000" style=3D"BACKGROUND-COLOR: #fff=
fff" SIZE=3D3 FAMILY=3D"SERIF" FACE=3D"Georgia" LANG=3D"0"><BR>
</BLOCKQUOTE></FONT><FONT COLOR=3D"#000000" style=3D"BACKGROUND-COLOR: #fff=
fff" SIZE=3D2 FAMILY=3D"SANSSERIF" FACE=3D"Arial" LANG=3D"0"><BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
</FONT></HTML>
--part1_178.21df22b4.2cd92cee_boundary--
- Raw text -