Mail Archives: djgpp-workers/2003/09/02/14:24:41
Eli Zaretskii wrote:
>We could implement the exceptions bitmap as a special word that is
>physically different from the x87 status register. The functions that
>return the exceptions info could then look at that word and also at
>the x87 status word.
>
>Would that be okay?
>
>
I don't think that the C standard cares whether we implement the
exceptions as a separate word, or as part of the x87 status register, as
long as the external behavior is consistent with the standard. I can
think of several criteria to evaluate such a technique: conformance with
the C99 standard, compability with existing code, amount of work
required to implement the technique, and general usefulness of the
technique.
Your proposed technique would indeed achieve compatibility with existing
code, but let's hear from KB Williams on how difficult it would be to
implement. It may be easy, since it appears that the change would be
confined to the fraiseexcept() routine. If it is indeed the case that
the DJGPP startup code masks all the FP exceptions, perhaps it would be
easier to use the x87 status word for these functions. My worry about
that was that (if I recall correctly) older startup code didn't mask all
the exceptions.
In some ways, Annex F makes it easy for the library programmer, since
one can often dispense with the argument tests and simply depend on the
processor to issue the appropriate exceptions. For instance, if the
routine is attempting to compute asin(2.0), somewhere one probably
computes sqrt(1. - x*x) = sqrt(-3.), which sets a floating-point
exception. Unfortunately, reliance on the built-in hardware mechanisms
does not set errno properly. C99 makes setting errno optional.
Whether Annex F make good mathematical sense is another story.
-Eric Rudd
rudd AT cyberoptics DOT com
- Raw text -