Commit cfe83a54 by Andreas Jaeger Committed by Andreas Jaeger

g77.texi (Floating-point Exception Handling): Use feenableexcept in example.

	* g77.texi (Floating-point Exception Handling): Use feenableexcept
	in example.
	(Floating-point precision): Change to match above change.

From-SVN: r37613
parent cf183ac2
2000-11-21 Andreas Jaeger <aj@suse.de>
* g77.texi (Floating-point Exception Handling): Use feenableexcept
in example.
(Floating-point precision): Change to match above change.
Sun Nov 19 17:29:22 2000 Matthias Klose <doko@marvin.itso-berlin.de> Sun Nov 19 17:29:22 2000 Matthias Klose <doko@marvin.itso-berlin.de>
* g77.texi (Floating-point precision): Adjust example * g77.texi (Floating-point precision): Adjust example
......
...@@ -10475,9 +10475,10 @@ mode and not take the performance hit of @samp{-ffloat-store}. On x86 ...@@ -10475,9 +10475,10 @@ mode and not take the performance hit of @samp{-ffloat-store}. On x86
and m68k GNU systems you can do this with a technique similar to that and m68k GNU systems you can do this with a technique similar to that
for turning on floating-point exceptions for turning on floating-point exceptions
(@pxref{Floating-point Exception Handling}). (@pxref{Floating-point Exception Handling}).
The control word could be set to double precision by The control word could be set to double precision by some code like this
replacing the @code{__setfpucw} call or the @code{_FPU_SETCW} macro with one like this: one:
@smallexample @smallexample
#include <fpu_control.h>
@{ @{
fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) | _FPU_DOUBLE; fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) | _FPU_DOUBLE;
_FPU_SETCW(cw); _FPU_SETCW(cw);
...@@ -12150,17 +12151,17 @@ Most systems provide some C-callable mechanism to change this; this can ...@@ -12150,17 +12151,17 @@ Most systems provide some C-callable mechanism to change this; this can
be invoked at startup using @code{gcc}'s @code{constructor} attribute. be invoked at startup using @code{gcc}'s @code{constructor} attribute.
For example, just compiling and linking the following C code with your For example, just compiling and linking the following C code with your
program will turn on exception trapping for the ``common'' exceptions program will turn on exception trapping for the ``common'' exceptions
on an x86-based GNU system: on a GNU system using glibc 2.2 or newer:
@smallexample @smallexample
#include <fpu_control.h> #define _GNU_SOURCE 1
#include <fenv.h>
static void __attribute__ ((constructor)) static void __attribute__ ((constructor))
trapfpe () trapfpe ()
@{ @{
fpu_control_t cw = /* Enable some exceptions. At startup all exceptions are masked. */
_FPU_DEFAULT &
~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM); feenableexcept (FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW);
_FPU_SETCW(cw);
@} @}
@end smallexample @end smallexample
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment