IEEE Standards Interpretations for IEEE Std 1003.1™-2001 IEEE Standard for Information Technology - Portable Operating System Interface (POSIX®)
Copyright © 2006 by the Institute of Electrical and Electronics Engineers, Inc. 3 Park Avenue New York, New York 10016-5997 USA All Rights Reserved.
Interpretations are issued to explain and clarify the intent of a standard and do not constitute an alteration to the original standard. In addition, interpretations are not intended to supply consulting information. Permission is hereby granted to download and print one copy of this document. Individuals seeking permission to reproduce and/or distribute this document in its entirety or portions of this document must contact the IEEE Standards Department for the appropriate license. Use of the information contained in this document is at your own risk.
IEEE Standards Department Copyrights and Permissions 445 Hoes Lane, Piscataway, New Jersey 08855-1331, USA
Interpretation Request #23
Topic:feupdate raising saved exceptions Relevant Sections: feupdateenv()
We are requesting clarification on the following: The description of feupdateenv() states "The feupdateenv() function shall attempt to save the currently raised floating-point exceptions in its automatic storage, attempt to install the floating-point environment represented by the object pointed to by envp, and then attempt to raise the saved floating-point exceptions. The argument envp shall point to an object set by a call to feholdexcept() or fegetenv(), or equal a floating-point environment macro." Regarding the statement "and then attempt to raise the saved loating-point exceptions." what floating-point exceptions get raised? (1) Those that were originally saved away in the automatic storage or (2) those that are indicated by envp? Please clarify which floating point exceptions get raise.
The standard clearly states the requirements for feupdateenv() that the floating-point exceptions that should be raised are those that are saved, and conforming implementations must conform to this.
Rationale for Interpretation
In effect, feupdateenv is like (ignoring unsuccessful calls): int now; now = fetestexcept(FE_ALL_EXCEPT); /* save current exceptions */ fesetenv(envp); /* restore environment */ feraiseexcept(now); /* re-raise current exceptions */