[Python-Dev] 2.2.1c1 platform reports.

Martin v. Loewis martin@v.loewis.de
23 Mar 2002 00:25:55 +0100


Tim Peters <tim.one@comcast.net> writes:

> It's cute:  even in C99, an implementation must treat sqrt(negative_number)
> as a domain error.  However, under C99 rules:
> 
>     On a domain error, the function returns an implementation-defined
>     value; whether the integer expression errno acquires the value
>     EDOM is implementation-defined.

Is that the final text? My copy says

       On a domain error, the function returns an
       implementation-defined value; if the integer expression
       math_errhandling & MATH_ERRNO is nonzero, the integer
       expression errno acquires the value EDOM; if the integer
       expression math_errhandling & MATH_ERREXCEPT is nonzero, the
       ``invalid'' floating-point exception is raised.

but it comes from a draft only (99-04). If this is what C99 says, you
actually can tell, in C, whether checking errno will help indicating
the error.

> Do that, and in the end you get a library that still honks off
> IEEE-754 fans anyway (which has its own elaborate and precise rules
> for dealing with fp exceptions).

If the C implementation also implements Annex F, IEEE-754 fans should
be satisfied, no?

Regards,
Martin