IEEE754 floating point traps - SUN
This is a discussion on IEEE754 floating point traps - SUN ; How can I turn on the IEEE754 floating point traps from a C program?
The man page for sigfpe is not very helpful-- it says that in in order
to intercept a SIGFPE code, one must first "Enable the relevant
...
-
IEEE754 floating point traps
How can I turn on the IEEE754 floating point traps from a C program?
The man page for sigfpe is not very helpful-- it says that in in order
to intercept a SIGFPE code, one must first "Enable the relevant
IEEE754 trapping capability in the hardware, perhaps by using
assembly-language instructions. ... No IEE754-related SIGFPE signals
will be generated unless those hardware mode bits are enabled." I
don't particularly want to write assembly language.
I *think* (my memory may be faulty) that in the past I called
ieee_handler for this purpose, but with our latest release of Solaris
I get an undefined reference when I try this.
My environment: Sun sparc ultra-2, Solaris 9, Sun Workshop 7.0.
Thanks in advance.
-
Re: IEEE754 floating point traps
On 26 Jun 2003, John Warren wrote:
> How can I turn on the IEEE754 floating point traps from a C program?
The short answer is "buy a copy of my book when it comes out". :-)
> The man page for sigfpe is not very helpful-- it says that in in order
> to intercept a SIGFPE code, one must first "Enable the relevant
> IEEE754 trapping capability in the hardware, perhaps by using
> assembly-language instructions. ... No IEE754-related SIGFPE signals
> will be generated unless those hardware mode bits are enabled." I
> don't particularly want to write assembly language.
Yeah - it's kinda black magic.
The incantations you're looking for are fpgetmask() and
fpsetmask().
HTH,
--
Rich Teer, SCNA, SCSA
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-online.net
-
Re: IEEE754 floating point traps
Thanks, that works exactly as I wanted.
-John Warren
Rich Teer wrote in message news:...
> On 26 Jun 2003, John Warren wrote:
>
> > How can I turn on the IEEE754 floating point traps from a C program?
>
> The short answer is "buy a copy of my book when it comes out". :-)
>
> > The man page for sigfpe is not very helpful-- it says that in in order
> > to intercept a SIGFPE code, one must first "Enable the relevant
> > IEEE754 trapping capability in the hardware, perhaps by using
> > assembly-language instructions. ... No IEE754-related SIGFPE signals
> > will be generated unless those hardware mode bits are enabled." I
> > don't particularly want to write assembly language.
>
> Yeah - it's kinda black magic.
>
> The incantations you're looking for are fpgetmask() and
> fpsetmask().
>
> HTH,