Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Exception handling
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== IEEE 754 floating-point exceptions == {{main|IEEE 754#Exception handling}} Exception handling in the [[IEEE 754]] [[floating-point arithmetic#Dealing with exceptional cases|floating-point]] standard refers in general to exceptional conditions and defines an exception as "an event that occurs when an operation on some particular operands has no outcome suitable for every reasonable application. That operation might signal one or more exceptions by invoking the default or, if explicitly requested, a language-defined alternate handling." By default, an IEEE 754 exception is resumable and is handled by substituting a predefined value for different exceptions, e.g. infinity for a divide by zero exception, and providing [[floating-point arithmetict#Dealing with exceptional cases|status flags]] for later checking of whether the exception occurred (see [[C99#IEEEΒ 754 floating-point support|C99 programming language]] for a typical example of handling of IEEE 754 exceptions). An exception-handling style enabled by the use of status flags involves: first computing an expression using a fast, direct implementation; checking whether it failed by testing status flags; and then, if necessary, calling a slower, more numerically robust, implementation.<ref name="Xiaoye Li and James Demmel 1994 983β992">{{cite journal |author1=Xiaoye Li|author1-link=Sherry Li |author2=James Demmel | title=Faster Numerical Algorithms via Exception Handling, IEEE Transactions on Computers, 43(8) | year= 1994 | pages=983β992}}</ref> The IEEE 754 standard uses the term "trapping" to refer to the calling of a user-supplied exception-handling routine on exceptional conditions, and is an optional feature of the standard. The standard recommends several usage scenarios for this, including the implementation of non-default pre-substitution of a value followed by resumption, to concisely handle [[Removable singularity|removable singularities]].<ref name="Xiaoye Li and James Demmel 1994 983β992"/><ref name=grail>{{cite web|url=http://www.cs.berkeley.edu/~wkahan/Grail.pdf|title=A Demonstration of Presubstitution for β/β|author=W.Kahan|date=July 5, 2005|url-status=live|archive-url=https://web.archive.org/web/20120310130507/http://www.cs.berkeley.edu/~wkahan/Grail.pdf|archive-date=March 10, 2012}}</ref><ref>{{cite journal |last1=Hauser |first1=John R. |title=Handling floating-point exceptions in numeric programs |journal=ACM Transactions on Programming Languages and Systems |date=March 1996 |volume=18 |issue=2 |pages=139β174 |doi=10.1145/227699.227701|s2cid=9820157 |doi-access=free }}</ref> The default IEEE 754 exception handling behaviour of resumption following pre-substitution of a default value avoids the risks inherent in changing flow of program control on numerical exceptions. For example, the 1996 [[Cluster (spacecraft)|Cluster spacecraft]] launch ended in a catastrophic explosion due in part to the [[Ada (programming language)|Ada]] exception handling policy of aborting computation on arithmetic error. [[William Kahan]] claims the default IEEE 754 exception handling behavior would have prevented this.<ref name=grail />
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)