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 fegetenv 3M "12 Jul 2006" "SunOS 5.11" "Mathematical Library Functions"
  12 .SH NAME
  13 fegetenv, fesetenv \- get and set current floating-point environment
  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 \fBfegetenv\fR(\fBfenv_t *\fR\fIenvp\fR);
  21 .fi
  22 
  23 .LP
  24 .nf
  25 \fBint\fR \fBfesetenv\fR(\fBconst fenv_t *\fR\fIenvp\fR);
  26 .fi
  27 
  28 .SH DESCRIPTION
  29 .sp
  30 .LP
  31 The \fBfegetenv()\fR function attempts to store the current floating-point
  32 environment in the object pointed to by \fIenvp\fR.
  33 .sp
  34 .LP
  35 The \fBfesetenv()\fR function attempts to establish the floating-point
  36 environment represented by the object pointed to by \fIenvp\fR. The \fIenvp\fR
  37 argument points to an object set by a call to \fBfegetenv()\fR or
  38 \fBfeholdexcept\fR(3M), or equals a floating-point environment macro. The
  39 \fBfesetenv()\fR function does not raise floating-point exceptions, but only
  40 installs the state of the floating-point status flags represented through its
  41 argument.
  42 .SH RETURN VALUES
  43 .sp
  44 .LP
  45 If the representation was successfully stored, fegetenv returns 0. Otherwise,
  46 it returns a non-zero value.
  47 .sp
  48 .LP
  49 If the environment was successfully established, fesetenv returns 0. Otherwise,
  50 it returns a non-zero value.
  51 .SH ERRORS
  52 .sp
  53 .LP
  54 No errors are defined.
  55 .SH ATTRIBUTES
  56 .sp
  57 .LP
  58 See \fBattributes\fR(5) for descriptions of the following attributes:
  59 .sp
  60 
  61 .sp
  62 .TS
  63 tab() box;
  64 cw(2.75i) |cw(2.75i) 
  65 lw(2.75i) |lw(2.75i) 
  66 .
  67 ATTRIBUTE TYPEATTRIBUTE VALUE
  68 _
  69 Interface StabilityStandard
  70 _
  71 MT-LevelMT-Safe
  72 .TE
  73 
  74 .SH SEE ALSO
  75 .sp
  76 .LP
  77 \fBfeholdexcept\fR(3M), \fBfenv.h\fR(3HEAD), \fBfeupdateenv\fR(3M),
  78 \fBattributes\fR(5), \fBstandards\fR(5)
  79 .SH NOTES
  80 .sp
  81 .LP
  82 In a multithreaded program, the \fBfegetenv()\fR and \fBfegetenv()\fR functions
  83 affect the floating point environment only for the calling thread.
  84 .sp
  85 .LP
  86 These functions automatically install and deinstall \fBSIGFPE\fR handlers and
  87 set and clear the trap enable mode bits in the floating point status register
  88 as needed. If a program uses these functions and attempts to install a
  89 \fBSIGFPE\fR handler or control the trap enable mode bits independently, the
  90 resulting behavior is not defined.
  91 .sp
  92 .LP
  93 As described in \fBfex_set_handling\fR(3M)\fB\fR, when a handling function
  94 installed in \fBFEX_CUSTOM\fR mode is invoked, all exception traps are disabled
  95 (and will not be reenabled while \fBSIGFPE\fR is blocked). Thus, attempting to
  96 change the environment from within a handler by calling \fBfesetenv\fR or
  97 \fBfeupdateenv\fR(3M) might not produce the expected results.