1.\" $OpenBSD: fpgetmask.3,v 1.10 2015/09/14 15:14:55 schwarze Exp $ 2.\" $NetBSD: fpgetmask.3,v 1.3 2001/09/16 02:57:03 wiz Exp $ 3.\" 4.\" Copyright (c) 1999 The NetBSD Foundation, Inc. 5.\" All rights reserved. 6.\" 7.\" This code is derived from software contributed to The NetBSD Foundation 8.\" by Ross Harvey. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29.\" POSSIBILITY OF SUCH DAMAGE. 30.\" 31.Dd $Mdocdate: September 14 2015 $ 32.Dt FPGETMASK 3 33.Os 34.Sh NAME 35.Nm fpgetmask , 36.Nm fpgetround , 37.Nm fpgetsticky , 38.Nm fpsetmask , 39.Nm fpsetround , 40.Nm fpsetsticky 41.Nd IEEE FP mode control 42.Sh SYNOPSIS 43.In ieeefp.h 44.Ft fp_except 45.Fn fpgetmask void 46.Ft fp_rnd 47.Fn fpgetround void 48.Ft fp_except 49.Fn fpgetsticky void 50.Ft fp_except 51.Fn fpsetmask "fp_except mask" 52.Ft fp_rnd 53.Fn fpsetround "fp_rnd rnd_dir" 54.Ft fp_except 55.Fn fpsetsticky "fp_except sticky" 56.Sh DESCRIPTION 57A rounding mode is one of 58.Dv FP_RZ , FP_RM , FP_RN , 59or 60.Dv FP_RP , 61for rounding towards zero, rounding 62.Pq Em Minus infinity 63down, rounding to 64.Em nearest , 65and rounding 66.Pq Em Plus infinity 67up. 68The default mode is 69.Dv FP_RN . 70.Pp 71An 72.Ft fp_except 73value is a bitmask specifying an exception type and containing any of 74the values listed below. 75.Bl -column FP_X_UFLxx -offset indent 76.It Dv FP_X_INV Ta Invalid\ Operation 77.It Dv FP_X_DZ Ta Division\ by\ zero 78.It Dv FP_X_OFL Ta Overflow 79.It Dv FP_X_UFL Ta Underflow 80.It Dv FP_X_IMP Ta Imprecision (inexact) 81.It Dv FP_X_DNML Ta Denormalization Pq amd64 and i386 only 82.El 83.Pp 84The 85.Fn fpsetmask 86function will cause future operations with the specified result status to 87raise the 88.Dv SIGFPE 89exception. 90The 91.Fn fpsetround 92function will cause future operations to use the specified dynamic mode. 93.Bl -tag -width Note:x 94.It Em Note : 95On some architectures, instructions can optionally specify static 96rounding modes and exception enables that will supersede the specified 97dynamic mode. 98On other architectures, these features may not be fully supported. 99.El 100.Pp 101The 102.Fn fpsetsticky 103function will set or clear the specified exception history bits. 104.Sh RETURN VALUES 105The 106.Fn fpgetround 107and 108.Fn fpsetround 109functions return the 110.Pq previous 111rounding mode. 112The 113.Fn fpgetmask , 114.Fn fpsetmask , 115.Fn fpgetsticky , 116and 117.Fn fpsetsticky 118functions return the 119.Pq previous 120exception mask and exception history bits. 121.Sh SEE ALSO 122.Xr sigaction 2 123