X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
From: Kbwms AT aol DOT com
Message-ID: <27.4950dd26.2cbd8b44@aol.com>
Date: Tue, 14 Oct 2003 13:24:20 EDT
Subject: Re: Work on C99 Math Functions
To: djgpp-workers AT delorie DOT com
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="part1_27.4950dd26.2cbd8b44_boundary"
X-Mailer: 8.0 for Windows sub 6015
Reply-To: djgpp-workers AT delorie DOT com
--part1_27.4950dd26.2cbd8b44_boundary
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
My work on the C99 math library continues. =A0 One of the problems that aris=
es=20
is what to do in when an error is detected in a math function. =A0 For examp=
le,=20
the following is quoted from the specs for remainder functions:
RETURN VALUE
> These functions shall return x REM y.
Optionally:
>=20
> If x or y is NaN, a NaN shall be returned.
>=20
> If x is =B1Inf or y is zero and the other argument is non-NaN, a domain er=
ror=20
> shall occur, and either a NaN (if supported), or an implementation-defined=
=20
> value shall be returned.=20
>=20
ERRORS (optional)
> These functions shall fail if:
>=20
> Domain=A0Error:
> The x argument is =B1Inf, or the y argument is =B10 and the other argument=
is=20
> non-NaN. If the integer expression (math_errhandling & MATH_ERRNO) is=20
> non-zero, then errno shall be set to [EDOM]. If the integer expression=20
> (math_errhandling & MATH_ERREXCEPT) is non-zero, then the invalid floating=
-point exception=20
> shall be raised.
MATH_ERRNO, MATH_ERREXCEPT & math_errhandling are described in=20
http://www.opengroup.org/onlinepubs/007904975/basedefs/math.h.html
No official decision has been made on how errors are to be handled, to the=20
best of my knowledge.
My approach is, "more is better."=A0 So, all of the above went into the new=20
remainder functions except for testing (math_errhandling & MATH_ERRNO) or=20
(math_errhandling & MATH_ERREXCEPT).=A0 That is, when a domain error occurs,=
errno is=20
always set to EDOM and the invalid floating-point exception is always raised=
. =20
Requirements for other functions vary.
Is this the preferred approach? =A0 If it isn't, what is?
KB Williams
--part1_27.4950dd26.2cbd8b44_boundary
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
My work on the C99 math library continues. =A0 One of the problems that aris=
es is what to do in when an error is detected in a math function. =A0 For ex=
ample, the following is quoted from the specs for remainder functions:
RETURN VALUE
These functions shall return x REM y.
Optionally:
If x or y is NaN, a NaN shall be returned.
If x is =B1Inf or y is zero and the other argument is non-NaN,=
a domain error shall occur, and either a NaN (if supported), or an implemen=
tation-defined value shall be returned. ![](3D"http://www.opengroup.or=)
ERRORS (optional)
These functions shall fail if:<=
BR>
Domain=A0Error:
The x argument is =B1Inf=
, or the y argument is =B10 and the other argument is non-NaN. If the=
integer expression (math_errhandling & MATH_ERRNO) is non-zero, then errno shall be set to [EDOM]. If the integer expression (math_errhandli=
ng & MATH_ERREXCEPT) is non-zero, then the invalid floating-point except=
ion shall be raised.
MATH_ERRNO, MATH_ERREXCEPT & math_errhandling are described in
http://www.opengroup.org/on=
linepubs/007904975/basedefs/math.h.html
No official decision has been made on how errors are to be handled, to the b=
est of my knowledge.
My approach is, "more is better."=A0 So, all of the above went into the new=20=
remainder functions except for testing (math_errhandling & MATH_ERRNO) or (math_er=
rhandling & MATH_ERREXCEPT).=A0 That is, when a domain error occurs, errno is always set to EDOM and t=
he invalid floating-point exception is always raised. Requirements for=
other functions vary.
Is this the preferred approach? =A0 If it isn't, what is?
KB Williams
--part1_27.4950dd26.2cbd8b44_boundary--