Re: is there an ieee handler in Linux?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/24/2010 10:30 AM, Andrew Haley wrote:
> On 04/23/2010 08:49 PM, reg@xxxxxxx wrote:
>> There must be a handler for ieee arithmetic errors under Linux for C and for 
>> Fortran,
>> but my search with man and google don't turn up anything.
>> Can someone point me at the correct subroutine names.
> 
> See fgetenv(3).
> 
> Here's an example for C.
> 
> Andrew.
> 
> 
> #define _GNU_SOURCE
> 
> #include <signal.h>
> #include <stdio.h>
> #include <math.h>
> #include <fenv.h>
> #include <stdlib.h>
> 
> static void
> sigfpe_handler(int signo)
> {
>   fprintf (stderr, "%s\n", __FUNCTION__);
>   exit (1);
> }
> 
> 
> void
> main()
> {
>   signal (SIGFPE, sigfpe_handler);
> 
>   feenableexcept (FE_NOMASK_ENV);

Sorry,

  feenableexcept (FE_ALL_EXCEPT);


> 
>   fprintf (stderr, "%g\n", 0.0e0/0.0e0);
> 
> }

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux