2004-11-03 13:51:07 +00:00
|
|
|
.\" Copyright (c) 2000 Andries Brouwer (aeb@cwi.nl)
|
|
|
|
.\"
|
|
|
|
.\" This is free documentation; you can redistribute it and/or
|
|
|
|
.\" modify it under the terms of the GNU General Public License as
|
|
|
|
.\" published by the Free Software Foundation; either version 2 of
|
|
|
|
.\" the License, or (at your option) any later version.
|
|
|
|
.\"
|
|
|
|
.\" The GNU General Public License's references to "object code"
|
|
|
|
.\" and "executables" are to be interpreted as the output of any
|
|
|
|
.\" document formatting or typesetting system, including
|
|
|
|
.\" intermediate and printed output.
|
|
|
|
.\"
|
|
|
|
.\" This manual is distributed in the hope that it will be useful,
|
|
|
|
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
.\" GNU General Public License for more details.
|
|
|
|
.\"
|
|
|
|
.\" You should have received a copy of the GNU General Public
|
|
|
|
.\" License along with this manual; if not, write to the Free
|
|
|
|
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
|
|
|
|
.\" USA.
|
|
|
|
.\"
|
|
|
|
.\" 2000-08-14 added GNU additions from Andreas Jaeger
|
|
|
|
.\" 2000-12-05 some changes inspired by acahalan's remarks
|
|
|
|
.\"
|
2010-10-31 04:17:37 +00:00
|
|
|
.TH FENV 3 2010-10-31 "Linux" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
|
|
|
feclearexcept, fegetexceptflag, feraiseexcept, fesetexceptflag,
|
|
|
|
fetestexcept, fegetenv, fegetround, feholdexcept, fesetround,
|
2007-05-21 21:16:13 +00:00
|
|
|
fesetenv, feupdateenv, feenableexcept, fedisableexcept,
|
2008-07-23 02:57:20 +00:00
|
|
|
fegetexcept \- floating-point rounding and exception handling
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <fenv.h>
|
|
|
|
.sp
|
|
|
|
.BI "int feclearexcept(int " excepts );
|
|
|
|
.br
|
|
|
|
.BI "int fegetexceptflag(fexcept_t *" flagp ", int " excepts );
|
|
|
|
.br
|
|
|
|
.BI "int feraiseexcept(int " excepts );
|
|
|
|
.br
|
|
|
|
.BI "int fesetexceptflag(const fexcept_t *" flagp ", int " excepts );
|
|
|
|
.br
|
|
|
|
.BI "int fetestexcept(int " excepts );
|
|
|
|
.sp
|
|
|
|
.B "int fegetround(void);"
|
|
|
|
.br
|
|
|
|
.BI "int fesetround(int " rounding_mode );
|
|
|
|
.sp
|
|
|
|
.BI "int fegetenv(fenv_t *" envp );
|
|
|
|
.br
|
|
|
|
.BI "int feholdexcept(fenv_t *" envp );
|
|
|
|
.br
|
|
|
|
.BI "int fesetenv(const fenv_t *" envp );
|
|
|
|
.br
|
|
|
|
.BI "int feupdateenv(const fenv_t *" envp );
|
|
|
|
.fi
|
2007-05-21 09:58:23 +00:00
|
|
|
.sp
|
|
|
|
Link with \fI\-lm\fP.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
These eleven functions were defined in C99, and describe the handling
|
2008-07-23 02:57:20 +00:00
|
|
|
of floating-point rounding and exceptions (overflow, zero-divide etc.).
|
2004-11-03 13:51:07 +00:00
|
|
|
.SS Exceptions
|
2008-08-04 10:17:22 +00:00
|
|
|
The
|
|
|
|
.I divide-by-zero
|
|
|
|
exception occurs when an operation on finite numbers
|
2004-11-03 13:51:07 +00:00
|
|
|
produces infinity as exact answer.
|
|
|
|
.LP
|
2008-08-04 10:17:22 +00:00
|
|
|
The
|
|
|
|
.I overflow
|
|
|
|
exception occurs when a result has to be represented as a
|
2008-07-23 02:57:20 +00:00
|
|
|
floating-point number, but has (much) larger absolute value than the
|
|
|
|
largest (finite) floating-point number that is representable.
|
2004-11-03 13:51:07 +00:00
|
|
|
.LP
|
2008-08-04 10:17:22 +00:00
|
|
|
The
|
|
|
|
.I underflow
|
|
|
|
exception occurs when a result has to be represented as a
|
2008-07-23 02:57:20 +00:00
|
|
|
floating-point number, but has smaller absolute value than the smallest
|
|
|
|
positive normalized floating-point number (and would lose much accuracy
|
2004-11-03 13:51:07 +00:00
|
|
|
when represented as a denormalized number).
|
|
|
|
.LP
|
2008-08-04 10:17:22 +00:00
|
|
|
The
|
|
|
|
.I inexact
|
|
|
|
exception occurs when the rounded result of an operation
|
2004-11-03 13:51:07 +00:00
|
|
|
is not equal to the infinite precision result.
|
2008-09-29 11:05:56 +00:00
|
|
|
It may occur whenever
|
|
|
|
.I overflow
|
|
|
|
or
|
|
|
|
.I underflow
|
|
|
|
occurs.
|
2004-11-03 13:51:07 +00:00
|
|
|
.LP
|
2008-08-04 10:17:22 +00:00
|
|
|
The
|
|
|
|
.I invalid
|
|
|
|
exception occurs when there is no well-defined result
|
2005-07-06 12:57:38 +00:00
|
|
|
for an operation, as for 0/0 or infinity \- infinity or sqrt(\-1).
|
2004-11-03 13:51:07 +00:00
|
|
|
.SS "Exception handling"
|
|
|
|
Exceptions are represented in two ways: as a single bit
|
|
|
|
(exception present/absent), and these bits correspond in some
|
|
|
|
implementation-defined way with bit positions in an integer,
|
|
|
|
and also as an opaque structure that may contain more information
|
|
|
|
about the exception (perhaps the code address where it occurred).
|
|
|
|
.LP
|
|
|
|
Each of the macros
|
|
|
|
.BR FE_DIVBYZERO ,
|
|
|
|
.BR FE_INEXACT ,
|
|
|
|
.BR FE_INVALID ,
|
|
|
|
.BR FE_OVERFLOW ,
|
2007-09-20 16:26:31 +00:00
|
|
|
.B FE_UNDERFLOW
|
2004-11-03 13:51:07 +00:00
|
|
|
is defined when the implementation supports handling
|
|
|
|
of the corresponding exception, and if so then
|
|
|
|
defines the corresponding bit(s), so that one can call
|
2007-06-08 11:56:22 +00:00
|
|
|
exception handling functions, for example, using the integer argument
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR FE_OVERFLOW | FE_UNDERFLOW .
|
2007-04-12 22:42:49 +00:00
|
|
|
Other exceptions may be supported.
|
|
|
|
The macro
|
2004-11-03 13:51:07 +00:00
|
|
|
.B FE_ALL_EXCEPT
|
|
|
|
is the bitwise OR of all bits corresponding to supported exceptions.
|
|
|
|
.PP
|
|
|
|
The
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR feclearexcept ()
|
2004-11-03 13:51:07 +00:00
|
|
|
function clears the supported exceptions represented by the bits
|
|
|
|
in its argument.
|
|
|
|
.LP
|
|
|
|
The
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR fegetexceptflag ()
|
2004-11-03 13:51:07 +00:00
|
|
|
function stores a representation of the state of the exception flags
|
|
|
|
represented by the argument
|
|
|
|
.I excepts
|
|
|
|
in the opaque object
|
2007-12-22 22:10:40 +00:00
|
|
|
.IR *flagp .
|
2004-11-03 13:51:07 +00:00
|
|
|
.LP
|
|
|
|
The
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR feraiseexcept ()
|
2004-11-03 13:51:07 +00:00
|
|
|
function raises the supported exceptions represented by the bits in
|
|
|
|
.IR excepts .
|
|
|
|
.LP
|
|
|
|
The
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR fesetexceptflag ()
|
2004-11-03 13:51:07 +00:00
|
|
|
function sets the complete status for the exceptions represented by
|
|
|
|
.I excepts
|
|
|
|
to the value
|
2007-12-22 22:10:40 +00:00
|
|
|
.IR *flagp .
|
2004-11-03 13:51:07 +00:00
|
|
|
This value must have been obtained by an earlier call of
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR fegetexceptflag ()
|
2004-11-03 13:51:07 +00:00
|
|
|
with a last argument that contained all bits in
|
|
|
|
.IR excepts .
|
|
|
|
.LP
|
|
|
|
The
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR fetestexcept ()
|
2004-11-03 13:51:07 +00:00
|
|
|
function returns a word in which the bits are set that were
|
|
|
|
set in the argument
|
|
|
|
.I excepts
|
|
|
|
and for which the corresponding exception is currently set.
|
2008-08-07 11:37:14 +00:00
|
|
|
.SS Rounding mode
|
2008-09-29 09:00:36 +00:00
|
|
|
The rounding mode determines how the result of floating-point operations
|
2010-06-20 02:00:34 +00:00
|
|
|
is treated when the result cannot be exactly represented in the significand.
|
2008-08-07 11:37:14 +00:00
|
|
|
Various rounding modes may be provided:
|
|
|
|
round to nearest (the default),
|
Changes.old, clone.2, execve.2, fcntl.2, futex.2, getitimer.2, getpriority.2, mmap.2, mount.2, mprotect.2, sched_setscheduler.2, select_tut.2, setuid.2, sigaltstack.2, vfork.2, div.3, fenv.3, fmod.3, memchr.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_getattr_np.3, queue.3, scanf.3, trunc.3, st.4, proc.5, services.5, utmp.5, bootparam.7, capabilities.7, feature_test_macros.7, futex.7, glob.7, man.7, netlink.7, unicode.7: Switch to American usage: "-wards" ==> "-ward"
American English uses "afterward" in preference to "afterwards",
and so on
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-09-26 05:34:47 +00:00
|
|
|
round up (toward positive infinity),
|
|
|
|
round down (toward negative infinity), and
|
|
|
|
round toward zero.
|
2008-08-07 11:37:14 +00:00
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
Each of the macros
|
|
|
|
.BR FE_TONEAREST ,
|
2008-08-07 11:37:14 +00:00
|
|
|
.BR FE_UPWARD ,
|
|
|
|
.BR FE_DOWNWARD ,
|
|
|
|
and
|
|
|
|
.BR FE_TOWARDZERO
|
2004-11-03 13:51:07 +00:00
|
|
|
is defined when the implementation supports getting and setting
|
|
|
|
the corresponding rounding direction.
|
|
|
|
.LP
|
|
|
|
The
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR fegetround ()
|
2004-11-03 13:51:07 +00:00
|
|
|
function returns the macro corresponding to the current
|
|
|
|
rounding mode.
|
|
|
|
.LP
|
|
|
|
The
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR fesetround ()
|
2004-11-03 13:51:07 +00:00
|
|
|
function sets the rounding mode as specified by its argument
|
|
|
|
and returns zero when it was successful.
|
2008-08-07 11:37:14 +00:00
|
|
|
|
|
|
|
C99 and POSIX.1-2008 specify an identifier,
|
|
|
|
.BR FLT_ROUNDS ,
|
|
|
|
defined in
|
|
|
|
.IR <float.h> ,
|
|
|
|
which indicates the implementation-defined rounding
|
|
|
|
behavior for floating-point addition.
|
|
|
|
This identifier has one of the following values:
|
|
|
|
.IP \-1
|
|
|
|
The rounding mode is not determinable.
|
|
|
|
.IP 0
|
Changes.old, clone.2, execve.2, fcntl.2, futex.2, getitimer.2, getpriority.2, mmap.2, mount.2, mprotect.2, sched_setscheduler.2, select_tut.2, setuid.2, sigaltstack.2, vfork.2, div.3, fenv.3, fmod.3, memchr.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_getattr_np.3, queue.3, scanf.3, trunc.3, st.4, proc.5, services.5, utmp.5, bootparam.7, capabilities.7, feature_test_macros.7, futex.7, glob.7, man.7, netlink.7, unicode.7: Switch to American usage: "-wards" ==> "-ward"
American English uses "afterward" in preference to "afterwards",
and so on
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-09-26 05:34:47 +00:00
|
|
|
Rounding is toward 0.
|
2008-08-07 11:37:14 +00:00
|
|
|
.IP 1
|
Changes.old, clone.2, execve.2, fcntl.2, futex.2, getitimer.2, getpriority.2, mmap.2, mount.2, mprotect.2, sched_setscheduler.2, select_tut.2, setuid.2, sigaltstack.2, vfork.2, div.3, fenv.3, fmod.3, memchr.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_getattr_np.3, queue.3, scanf.3, trunc.3, st.4, proc.5, services.5, utmp.5, bootparam.7, capabilities.7, feature_test_macros.7, futex.7, glob.7, man.7, netlink.7, unicode.7: Switch to American usage: "-wards" ==> "-ward"
American English uses "afterward" in preference to "afterwards",
and so on
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-09-26 05:34:47 +00:00
|
|
|
Rounding is toward nearest number.
|
2008-08-07 11:37:14 +00:00
|
|
|
.IP 2
|
Changes.old, clone.2, execve.2, fcntl.2, futex.2, getitimer.2, getpriority.2, mmap.2, mount.2, mprotect.2, sched_setscheduler.2, select_tut.2, setuid.2, sigaltstack.2, vfork.2, div.3, fenv.3, fmod.3, memchr.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_getattr_np.3, queue.3, scanf.3, trunc.3, st.4, proc.5, services.5, utmp.5, bootparam.7, capabilities.7, feature_test_macros.7, futex.7, glob.7, man.7, netlink.7, unicode.7: Switch to American usage: "-wards" ==> "-ward"
American English uses "afterward" in preference to "afterwards",
and so on
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-09-26 05:34:47 +00:00
|
|
|
Rounding is toward positive infinity.
|
2008-08-07 11:37:14 +00:00
|
|
|
.IP 3
|
Changes.old, clone.2, execve.2, fcntl.2, futex.2, getitimer.2, getpriority.2, mmap.2, mount.2, mprotect.2, sched_setscheduler.2, select_tut.2, setuid.2, sigaltstack.2, vfork.2, div.3, fenv.3, fmod.3, memchr.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_getattr_np.3, queue.3, scanf.3, trunc.3, st.4, proc.5, services.5, utmp.5, bootparam.7, capabilities.7, feature_test_macros.7, futex.7, glob.7, man.7, netlink.7, unicode.7: Switch to American usage: "-wards" ==> "-ward"
American English uses "afterward" in preference to "afterwards",
and so on
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-09-26 05:34:47 +00:00
|
|
|
Rounding is toward negative infinity.
|
2008-08-07 11:37:14 +00:00
|
|
|
.PP
|
accept.2, execve.2, futimesat.2, getresuid.2, getrlimit.2, madvise.2, mq_getsetattr.2, msgctl.2, nice.2, open.2, poll.2, setresuid.2, shmctl.2, sigaction.2, times.2, utimensat.2, __setfpucw.3, atoi.3, endian.3, err.3, euidaccess.3, fenv.3, fopencookie.3, fpurge.3, getgrouplist.3, getutmp.3, j0.3, lgamma.3, netlink.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_cleanup_push_defer_np.3, pthread_getattr_np.3, pthread_kill_other_threads_np.3, pthread_setaffinity_np.3, pthread_tryjoin_np.3, pthread_yield.3, random_r.3, readdir.3, rtnetlink.3, scanf.3, setenv.3, significand.3, sigsetops.3, strerror.3, strstr.3, sysv_signal.3, termios.3, timegm.3, unlocked_stdio.3, y0.3, locale.5, bootparam.7, feature_test_macros.7, ip.7, locale.7, pthreads.7, rtld-audit.7, nscd.8: Global fix: s/non-standard/nonstandard/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:37:52 +00:00
|
|
|
Other values represent machine-dependent, nonstandard rounding modes.
|
2008-08-07 11:37:14 +00:00
|
|
|
.PP
|
|
|
|
The value of
|
|
|
|
.BR FLT_ROUNDS
|
|
|
|
should reflect the current rounding mode as set by
|
|
|
|
.BR fesetround ()
|
|
|
|
(but see BUGS).
|
2008-08-04 10:14:16 +00:00
|
|
|
.SS "Floating-point environment"
|
2008-07-23 02:57:20 +00:00
|
|
|
The entire floating-point environment, including
|
2004-11-03 13:51:07 +00:00
|
|
|
control modes and status flags, can be handled
|
|
|
|
as one opaque object, of type
|
|
|
|
.IR fenv_t .
|
|
|
|
The default environment is denoted by
|
|
|
|
.B FE_DFL_ENV
|
|
|
|
(of type
|
|
|
|
.IR "const fenv_t *" ).
|
|
|
|
This is the environment setup at program start and it is defined by
|
accept.2, access.2, acct.2, clock_nanosleep.2, mbind.2, mincore.2, remap_file_pages.2, sched_setscheduler.2, set_mempolicy.2, splice.2, stat.2, syslog.2, timer_create.2, timerfd_create.2, truncate.2, fenv.3, ferror.3, fflush.3, fgetwc.3, fgetws.3, flockfile.3, fputwc.3, fputws.3, fread.3, getopt.3, gets.3, getwchar.3, glob.3, iconv.3, longjmp.3, pow.3, printf.3, puts.3, putwchar.3, regex.3, rpc.3, scanf.3, setjmp.3, termios.3, unlocked_stdio.3, wcswidth.3, hd.4, rtc.4, st.4, core.5, dir_colors.5, elf.5, proc.5, arp.7, ascii.7, boot.7, bootparam.7, charsets.7, futex.7, ip.7, iso_8859-11.7, man-pages.7, man.7, mdoc.samples.7, path_resolution.7, pipe.7, posixoptions.7, unicode.7, unix.7, uri.7, utf-8.7, ld.so.8: s/non-/non/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 17:20:12 +00:00
|
|
|
ISO C to have round to nearest, all exceptions cleared and a nonstop
|
2004-11-03 13:51:07 +00:00
|
|
|
(continue on exceptions) mode.
|
|
|
|
.LP
|
|
|
|
The
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR fegetenv ()
|
2008-07-23 02:57:20 +00:00
|
|
|
function saves the current floating-point environment in the object
|
2007-12-22 22:10:40 +00:00
|
|
|
.IR *envp .
|
2004-11-03 13:51:07 +00:00
|
|
|
.LP
|
|
|
|
The
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR feholdexcept ()
|
2004-11-03 13:51:07 +00:00
|
|
|
function does the same, then clears all exception flags,
|
accept.2, access.2, acct.2, clock_nanosleep.2, mbind.2, mincore.2, remap_file_pages.2, sched_setscheduler.2, set_mempolicy.2, splice.2, stat.2, syslog.2, timer_create.2, timerfd_create.2, truncate.2, fenv.3, ferror.3, fflush.3, fgetwc.3, fgetws.3, flockfile.3, fputwc.3, fputws.3, fread.3, getopt.3, gets.3, getwchar.3, glob.3, iconv.3, longjmp.3, pow.3, printf.3, puts.3, putwchar.3, regex.3, rpc.3, scanf.3, setjmp.3, termios.3, unlocked_stdio.3, wcswidth.3, hd.4, rtc.4, st.4, core.5, dir_colors.5, elf.5, proc.5, arp.7, ascii.7, boot.7, bootparam.7, charsets.7, futex.7, ip.7, iso_8859-11.7, man-pages.7, man.7, mdoc.samples.7, path_resolution.7, pipe.7, posixoptions.7, unicode.7, unix.7, uri.7, utf-8.7, ld.so.8: s/non-/non/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 17:20:12 +00:00
|
|
|
and sets a nonstop (continue on exceptions) mode,
|
2007-04-12 22:42:49 +00:00
|
|
|
if available.
|
|
|
|
It returns zero when successful.
|
2004-11-03 13:51:07 +00:00
|
|
|
.LP
|
|
|
|
The
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR fesetenv ()
|
2008-07-23 02:57:20 +00:00
|
|
|
function restores the floating-point environment from
|
2004-11-03 13:51:07 +00:00
|
|
|
the object
|
2007-12-22 22:10:40 +00:00
|
|
|
.IR *envp .
|
2007-06-08 11:56:22 +00:00
|
|
|
This object must be known to be valid, for example, the result of a call to
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR fegetenv ()
|
2004-11-03 13:51:07 +00:00
|
|
|
or
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR feholdexcept ()
|
2004-11-03 13:51:07 +00:00
|
|
|
or equal to
|
|
|
|
.BR FE_DFL_ENV .
|
|
|
|
This call does not raise exceptions.
|
|
|
|
.LP
|
|
|
|
The
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR feupdateenv ()
|
2004-11-03 13:51:07 +00:00
|
|
|
function installs the floating-point environment represented by
|
|
|
|
the object
|
2007-12-22 22:10:40 +00:00
|
|
|
.IR *envp ,
|
2004-11-03 13:51:07 +00:00
|
|
|
except that currently raised exceptions are not cleared.
|
|
|
|
After calling this function, the raised exceptions will be a bitwise OR
|
|
|
|
of those previously set with those in
|
2007-12-22 22:10:40 +00:00
|
|
|
.IR *envp .
|
2004-11-03 13:51:07 +00:00
|
|
|
As before, the object
|
2007-12-22 22:10:40 +00:00
|
|
|
.I *envp
|
2004-11-03 13:51:07 +00:00
|
|
|
must be known to be valid.
|
|
|
|
.SH "RETURN VALUE"
|
intro.1, time.1, adjtimex.2, capget.2, eventfd.2, fcntl.2, getrlimit.2, getsockopt.2, gettimeofday.2, intro.2, ioctl_list.2, ioperm.2, mlock.2, pivot_root.2, poll.2, prctl.2, ptrace.2, sched_setscheduler.2, select_tut.2, semget.2, sigaltstack.2, signalfd.2, sysctl.2, timer_settime.2, timerfd_create.2, wait.2, CPU_SET.3, argz_add.3, assert_perror.3, atexit.3, backtrace.3, bcmp.3, clearenv.3, ctime.3, dl_iterate_phdr.3, dlopen.3, ecvt.3, errno.3, error.3, ether_aton.3, exit.3, fenv.3, ferror.3, finite.3, flockfile.3, fnmatch.3, fpathconf.3, fpclassify.3, ftime.3, ftok.3, ftw.3, fwide.3, getaddrinfo.3, gethostbyname.3, getlogin.3, getnameinfo.3, getnetent.3, getopt.3, getprotoent.3, getrpcent.3, getservent.3, glob.3, hsearch.3, inet.3, isalpha.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, longjmp.3, lsearch.3, malloc.3, matherr.3, mblen.3, mbsinit.3, mbtowc.3, on_exit.3, printf.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setstack.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_equal.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setconcurrency.3, pthread_setschedparam.3, pthread_setschedprio.3, ptsname.3, putenv.3, putgrent.3, raise.3, rcmd.3, regex.3, rexec.3, rpc.3, rpmatch.3, rtnetlink.3, scandir.3, sem_init.3, setaliasent.3, setbuf.3, setenv.3, setjmp.3, signbit.3, stdio_ext.3, strtod.3, strtol.3, strtoul.3, system.3, termios.3, timeradd.3, tzset.3, ualarm.3, wctomb.3, xdr.3, st.4, tty_ioctl.4, core.5, elf.5, proc.5, bootparam.7, capabilities.7, icmp.7, ip.7, ipv6.7, math_error.7, mdoc.samples.7, mq_overview.7, pthreads.7, raw.7, regex.7, socket.7, tcp.7, tzselect.8: Global fix: s/non-zero/nonzero/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:40:55 +00:00
|
|
|
These functions return zero on success and nonzero if an error occurred.
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Earlier seven of these functions were listed as returning void.
|
|
|
|
.\" This was corrected in Corrigendum 1 (ISO/IEC 9899:1999/Cor.1:2001(E))
|
|
|
|
.\" of the C99 Standard.
|
2008-08-11 17:05:02 +00:00
|
|
|
.SH VERSIONS
|
|
|
|
These functions first appeared in glibc in version 2.1.
|
2007-05-19 04:30:20 +00:00
|
|
|
.SH "CONFORMING TO"
|
2008-08-01 05:26:14 +00:00
|
|
|
IEC 60559 (IEC 559:1989), ANSI/IEEE 854, C99, POSIX.1-2001.
|
2007-05-18 10:30:02 +00:00
|
|
|
.SH NOTES
|
|
|
|
.SS Glibc Notes
|
2004-11-03 13:51:07 +00:00
|
|
|
If possible, the GNU C Library defines a macro
|
|
|
|
.B FE_NOMASK_ENV
|
|
|
|
which represents an environment where every exception raised causes a
|
2007-04-12 22:42:49 +00:00
|
|
|
trap to occur.
|
|
|
|
You can test for this macro using
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR #ifdef .
|
|
|
|
It is only defined if
|
|
|
|
.B _GNU_SOURCE
|
|
|
|
is defined.
|
|
|
|
The C99 standard does not define a way to set individual bits in the
|
2008-07-23 02:57:20 +00:00
|
|
|
floating-point mask, for example, to trap on specific flags.
|
2010-10-31 04:17:37 +00:00
|
|
|
Since version 2.2, glibc supports the functions
|
2005-11-02 11:34:24 +00:00
|
|
|
.BR feenableexcept ()
|
2004-11-03 13:51:07 +00:00
|
|
|
and
|
2005-11-02 11:34:24 +00:00
|
|
|
.BR fedisableexcept ()
|
2008-07-23 02:57:20 +00:00
|
|
|
to set individual floating-point traps, and
|
2005-11-02 11:34:24 +00:00
|
|
|
.BR fegetexcept ()
|
2004-11-03 13:51:07 +00:00
|
|
|
to query the state.
|
|
|
|
.sp
|
|
|
|
.nf
|
getresuid.2, mremap.2, poll.2, remap_file_pages.2, setresuid.2, splice.2, sync_file_range.2, syscall.2, tee.2, vmsplice.2, INFINITY.3, aio_init.3, asprintf.3, assert_perror.3, basename.3, bsd_signal.3, canonicalize_file_name.3, clog10.3, crypt.3, dl_iterate_phdr.3, dlopen.3, encrypt.3, exp10.3, fcloseall.3, fenv.3, fopencookie.3, ftw.3, getaddrinfo_a.3, getloadavg.3, getutent.3, grantpt.3, hsearch.3, lseek64.3, memmem.3, mempcpy.3, pow10.3, program_invocation_name.3, ptsname.3, putgrent.3, sched_getcpu.3, sincos.3, strchr.3, strfry.3, strnlen.3, strptime.3, strstr.3, strverscmp.3, swab.3, sysv_signal.3, tsearch.3, unlockpt.3, wcwidth.3: Add reference to feature_test_macros(7)
Some pages simply list feature test macro requirements in
the form:
#define #GNU_SOURCE
#include <someheader.h>
For these pages, add a "See feature_test_macros(7)" comment
on the "#define" line.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-10-31 04:31:47 +00:00
|
|
|
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
|
2004-11-03 13:51:07 +00:00
|
|
|
.br
|
|
|
|
.B "#include <fenv.h>"
|
|
|
|
.sp
|
2007-04-03 15:32:52 +00:00
|
|
|
.BI "int feenableexcept(int " excepts );
|
2004-11-03 13:51:07 +00:00
|
|
|
.br
|
2007-04-03 15:32:52 +00:00
|
|
|
.BI "int fedisableexcept(int " excepts );
|
2004-11-03 13:51:07 +00:00
|
|
|
.br
|
2007-09-20 16:26:31 +00:00
|
|
|
.B "int fegetexcept(void);"
|
2004-11-03 13:51:07 +00:00
|
|
|
.br
|
|
|
|
.fi
|
|
|
|
.LP
|
|
|
|
The
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR feenableexcept ()
|
2004-11-03 13:51:07 +00:00
|
|
|
and
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR fedisableexcept ()
|
2004-11-03 13:51:07 +00:00
|
|
|
functions enable (disable) traps for each of the exceptions represented by
|
|
|
|
.I excepts
|
|
|
|
and return the previous set of enabled exceptions when successful,
|
|
|
|
and \-1 otherwise.
|
|
|
|
The
|
2005-10-19 06:54:38 +00:00
|
|
|
.BR fegetexcept ()
|
2004-11-03 13:51:07 +00:00
|
|
|
function returns the set of all currently enabled exceptions.
|
2008-08-07 11:37:14 +00:00
|
|
|
.SH BUGS
|
|
|
|
C99 specifies that the value of
|
|
|
|
.B FLT_ROUNDS
|
|
|
|
should reflect changes to the current rounding mode, as set by
|
|
|
|
.BR fesetround ().
|
|
|
|
Currently,
|
|
|
|
.\" Aug 08, glibc 2.8
|
|
|
|
this does not occur:
|
|
|
|
.B FLT_ROUNDS
|
|
|
|
always has the value 1.
|
|
|
|
.\" See http://gcc.gnu.org/ml/gcc/2002-02/msg01535.html
|
2007-01-28 20:00:24 +00:00
|
|
|
.SH "SEE ALSO"
|
2008-07-23 13:04:14 +00:00
|
|
|
.BR math_error (7)
|