1 '\" te 2 .\" Copyright (c) 2001, the Institute of Electrical and Electronics Engineers, Inc. and The Open Group. All Rights Reserved. 3 .\" Portions Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved. 4 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at 5 .\" http://www.opengroup.org/bookstore/. 6 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. 7 .\" This notice shall appear on any product containing this material. 8 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. 9 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. 10 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] 11 .TH fetestexcept 3M "12 Jul 2006" "SunOS 5.11" "Mathematical Library Functions" 12 .SH NAME 13 fetestexcept \- test floating-point exception flags 14 .SH SYNOPSIS 15 .LP 16 .nf 17 c99 [ \fIflag\fR... ] \fIfile\fR... \fB-lm\fR [ \fIlibrary\fR... ] 18 #include <fenv.h> 19 20 \fBint\fR \fBfetestexcept\fR(\fBint\fR \fIexcepts\fR); 21 .fi 22 23 .SH DESCRIPTION 24 .sp 25 .LP 26 The \fBfetestexcept()\fR function determines which of a specified subset of the 27 floating-point exception flags are currently set. The \fIexcepts\fR argument 28 specifies the floating-point status flags to be queried. 29 .SH RETURN VALUES 30 .sp 31 .LP 32 The \fBfetestexcept()\fR function returns the value of the bitwise-inclusive OR 33 of the floating-point exception macros corresponding to the currently set 34 floating-point exceptions included in \fIexcepts\fR. 35 .SH ERRORS 36 .sp 37 .LP 38 No errors are defined. 39 .SH EXAMPLES 40 .LP 41 \fBExample 1 \fRExample using \fBfetestexcept()\fR 42 .sp 43 .LP 44 The following example calls function \fIf\fR( ) if an invalid exception is set, 45 and then function \fIg\fR( ) if an overflow exception is set: 46 47 .sp 48 .in +2 49 .nf 50 #include <fenv.h> 51 /* ... */ 52 { 53 # pragma STDC FENV_ACCESS ON 54 int set_excepts; 55 feclearexcept(FE_INVALID | FE_OVERFLOW); 56 // maybe raise exceptions 57 set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW); 58 if (set_excepts & FE_INVALID) f(); 59 if (set_excepts & FE_OVERFLOW) g(); 60 /* ... */ 61 } 62 .fi 63 .in -2 64 65 .SH ATTRIBUTES 66 .sp 67 .LP 68 See \fBattributes\fR(5) for descriptions of the following attributes: 69 .sp 70 71 .sp 72 .TS 73 tab() box; 74 cw(2.75i) |cw(2.75i) 75 lw(2.75i) |lw(2.75i) 76 . 77 ATTRIBUTE TYPEATTRIBUTE VALUE 78 _ 79 Interface StabilityStandard 80 _ 81 MT-LevelMT-Safe 82 .TE 83 84 .SH SEE ALSO 85 .sp 86 .LP 87 \fBfeclearexcept\fR(3M), \fBfegetexceptflag\fR(3M), \fBfenv.h\fR(3HEAD), 88 \fBattributes\fR(5), \fBstandards\fR(5)