* ANNOUNCE: g77_i386_fpe_demo (Demonstrates trapping floating-point exceptions under g77/i386/Linux) - resend
@ 2003-05-21 23:00 Tom Crane
0 siblings, 0 replies; only message in thread
From: Tom Crane @ 2003-05-21 23:00 UTC (permalink / raw)
g77_i386_fpe_demo is a very simple demonstration of trapping and handling
floating-point exceptions under g77/i386/Linux.
>From the README.TXT...
This small S/W package demonstrates handling of floating point exceptions
(FPEs) under g77/i386/Linux. By default exceptions are not generated and
serious errors such has sqrt(-ve number) and x/0.0 result in IEEE NaN and
(+/-) INF propagating through the program.
Having learnt FORTRAN programming under another platform (DEC VMS) where
serious floating point errors always generate exceptions and the program
terminates, I found the default behaviour under g77/i386/Linux quite
disconcerting.
There are several tips to be found on Usenet and on the gcc website, eg.
http://gcc.gnu.org/onlinedocs/gcc-3.0.3/g77_20.html#SEC643 for dealing
with this situation but no complete worked examples showing the creation
and usage of FPE handlers under g77/i386/Linux.
This package comprises two simple FORTRAN calling programs which
demonstrate handling and trapping the six types of FPEs generated by the
i387 FPU in accordance with the IEEE standard, IEEE-754, namely,
(1) Invalid operation
(2) Denormalised result
(3) Division by zero
(4) Overflow
(5) Underflow
(6) Precision loss (inexact result)
Probably, the most useful default settings are to trap exceptions; 1, 3 &
4 above.
Alternatively, when running the programs under the GNU debugger gdb,
gdb's own exception handlers trap the FPEs. Debugger commands such as
'list' and 'bt' can be used to locate the line/calling sequence which
generated the exception. The 'info float' command can then be used to
examine the status of the FPU.
This software is released under the GNU GPL.
See http://www.mklab.rhul.ac.uk/~tom/g77_i386_fpe_demo/index.html
Tom Crane.
--
Tom Crane, Dept. Physics, Royal Holloway, University of London, Egham Hill,
Egham, Surrey, TW20 0EX, England.
Email: T.Crane@rhul.ac.uk
SPAN: 19.875
Fax: +44 (0) 1784 472794
##########################################################################
# Send submissions for comp.os.linux.announce to: cola@stump.algebra.com #
# PLEASE remember a short description of the software and the LOCATION. #
# This group is archived at http://stump.algebra.com/~cola/ #
##########################################################################
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-05-21 23:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-21 23:00 ANNOUNCE: g77_i386_fpe_demo (Demonstrates trapping floating-point exceptions under g77/i386/Linux) - resend Tom Crane
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox