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 fegetround 3M "12 Jul 2006" "SunOS 5.11" "Mathematical Library Functions"
  12 .SH NAME
  13 fegetround, fesetround \- get and set current rounding direction
  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 \fBfegetround\fR(\fBvoid\fR);
  21 .fi
  22 
  23 .LP
  24 .nf
  25 \fBint\fR \fBfesetround\fR(\fBint\fR \fIround\fR);
  26 .fi
  27 
  28 .SH DESCRIPTION
  29 .sp
  30 .LP
  31 The fegetround function gets the current rounding direction.
  32 .sp
  33 .LP
  34 The fesetround function establishes the rounding direction represented by its
  35 argument round. If the argument is not equal to the value of a rounding
  36 direction macro, the rounding direction is not changed.
  37 .SH RETURN VALUES
  38 .sp
  39 .LP
  40 The fegetround function returns the value of the rounding direction macro
  41 representing the current rounding direction, or a negative value if there is no
  42 such rounding direction macro or the current rounding direction is not
  43 determinable.
  44 .sp
  45 .LP
  46 The fesetround function returns a 0 value if and only if the requested rounding
  47 direction was established.
  48 .SH ERRORS
  49 .sp
  50 .LP
  51 No errors are defined.
  52 .SH EXAMPLES
  53 .sp
  54 .LP
  55 The following example saves, sets, and restores the rounding direction,
  56 reporting an error and aborting if setting the rounding direction fails:
  57 .LP
  58 \fBExample 1 \fRSave, set, and restore the rounding direction.
  59 .sp
  60 .in +2
  61 .nf
  62 #include <fenv.h>
  63 #include <assert.h>
  64 void f(int round_dir)
  65 {
  66       #pragma STDC FENV_ACCESS ON
  67       int save_round;
  68       int setround_ok;
  69       save_round = fegetround();
  70       setround_ok = fesetround(round_dir);
  71       assert(setround_ok == 0);
  72       /* ... */
  73       fesetround(save_round);
  74       /* ... */
  75 }
  76 .fi
  77 .in -2
  78 
  79 .SH ATTRIBUTES
  80 .sp
  81 .LP
  82 See \fBattributes\fR(5) for descriptions of the following attributes:
  83 .sp
  84 
  85 .sp
  86 .TS
  87 tab() box;
  88 cw(2.75i) |cw(2.75i) 
  89 lw(2.75i) |lw(2.75i) 
  90 .
  91 ATTRIBUTE TYPEATTRIBUTE VALUE
  92 _
  93 Interface StabilityStandard
  94 _
  95 MT-LevelMT-Safe
  96 .TE
  97 
  98 .SH SEE ALSO
  99 .sp
 100 .LP
 101 \fBfenv.h\fR(3HEAD), \fBattributes\fR(5), \fBstandards\fR(5)