1*05a0b428SJohn Marino.\" $OpenBSD: fegetenv.3,v 1.3 2013/06/05 03:40:26 tedu Exp $ 2*05a0b428SJohn Marino.\" 3*05a0b428SJohn Marino.\" Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org> 4*05a0b428SJohn Marino.\" 5*05a0b428SJohn Marino.\" Permission to use, copy, modify, and distribute this software for any 6*05a0b428SJohn Marino.\" purpose with or without fee is hereby granted, provided that the above 7*05a0b428SJohn Marino.\" copyright notice and this permission notice appear in all copies. 8*05a0b428SJohn Marino.\" 9*05a0b428SJohn Marino.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10*05a0b428SJohn Marino.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11*05a0b428SJohn Marino.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12*05a0b428SJohn Marino.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13*05a0b428SJohn Marino.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14*05a0b428SJohn Marino.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15*05a0b428SJohn Marino.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16*05a0b428SJohn Marino.\" 17*05a0b428SJohn Marino.Dd $Mdocdate: June 5 2013 $ 18*05a0b428SJohn Marino.Dt FEGETENV 3 19*05a0b428SJohn Marino.Os 20*05a0b428SJohn Marino.Sh NAME 21*05a0b428SJohn Marino.Nm fegetenv , 22*05a0b428SJohn Marino.Nm feholdexcept , 23*05a0b428SJohn Marino.Nm fesetenv , 24*05a0b428SJohn Marino.Nm feupdateenv 25*05a0b428SJohn Marino.Nd manage floating-point environment 26*05a0b428SJohn Marino.Sh SYNOPSIS 27*05a0b428SJohn Marino.In fenv.h 28*05a0b428SJohn Marino.Ft int 29*05a0b428SJohn Marino.Fn fegetenv "fenv_t *envp" 30*05a0b428SJohn Marino.Ft int 31*05a0b428SJohn Marino.Fn feholdexcept "fenv_t *envp" 32*05a0b428SJohn Marino.Ft int 33*05a0b428SJohn Marino.Fn fesetenv "const fenv_t *envp" 34*05a0b428SJohn Marino.Ft int 35*05a0b428SJohn Marino.Fn feupdateenv "const fenv_t *envp" 36*05a0b428SJohn Marino.Sh DESCRIPTION 37*05a0b428SJohn MarinoThese functions manage the floating-point environment -- status 38*05a0b428SJohn Marinoflags, rounding direction modes and exception masks -- as one entity. 39*05a0b428SJohn MarinoThe 40*05a0b428SJohn Marino.Fa envp 41*05a0b428SJohn Marinoinput argument is an object representing the floating-point environment. 42*05a0b428SJohn MarinoThe macro 43*05a0b428SJohn Marino.Dv FE_DFL_ENV 44*05a0b428SJohn Marinorepresents the default floating-point environment -- the one installed 45*05a0b428SJohn Marinoat program startup. 46*05a0b428SJohn Marino.Pp 47*05a0b428SJohn MarinoThe 48*05a0b428SJohn Marino.Fn fegetenv 49*05a0b428SJohn Marinofunction stores the current floating-point environment in the object 50*05a0b428SJohn Marinopointed to by 51*05a0b428SJohn Marino.Pa envp . 52*05a0b428SJohn Marino.Pp 53*05a0b428SJohn MarinoThe 54*05a0b428SJohn Marino.Fn feholdexcept 55*05a0b428SJohn Marinofunction saves the current floating-point environment in the object 56*05a0b428SJohn Marinopointed to by 57*05a0b428SJohn Marino.Pa envp , 58*05a0b428SJohn Marinoclears the floating-point status flags, and then installs a non-stop 59*05a0b428SJohn Marino(continue on floating-point exceptions) mode for all floating-point 60*05a0b428SJohn Marinoexceptions. 61*05a0b428SJohn Marino.Pp 62*05a0b428SJohn MarinoThe 63*05a0b428SJohn Marino.Fn fesetenv 64*05a0b428SJohn Marinofunction establishes the floating-point environment represented by 65*05a0b428SJohn Marinothe object pointed to by 66*05a0b428SJohn Marino.Pa envp . 67*05a0b428SJohn MarinoThe argument 68*05a0b428SJohn Marino.Pa envp 69*05a0b428SJohn Marinoshall point to an object set by a call to 70*05a0b428SJohn Marino.Fn fegetenv 71*05a0b428SJohn Marinoor 72*05a0b428SJohn Marino.Fn feholdexcept , 73*05a0b428SJohn Marinoor equal the macro 74*05a0b428SJohn Marino.Dv FE_DFL_ENV . 75*05a0b428SJohn MarinoNote that 76*05a0b428SJohn Marino.Fn fesetenv 77*05a0b428SJohn Marinomerely installs the state of the floating-point status flags 78*05a0b428SJohn Marinorepresented through its argument, and does not raise these 79*05a0b428SJohn Marinofloating-point exceptions. 80*05a0b428SJohn Marino.Pp 81*05a0b428SJohn MarinoThe 82*05a0b428SJohn Marino.Fn feupdateenv 83*05a0b428SJohn Marinofunction saves the currently raised floating-point exceptions in 84*05a0b428SJohn Marinoits automatic storage, installs the floating-point environment 85*05a0b428SJohn Marinorepresented by the object pointed to by 86*05a0b428SJohn Marino.Pa envp , 87*05a0b428SJohn Marinoand then raises the saved floating-point exceptions. 88*05a0b428SJohn MarinoThe argument 89*05a0b428SJohn Marino.Pa envp 90*05a0b428SJohn Marinoshall point to an object set by a call to 91*05a0b428SJohn Marino.Fn feholdexcept 92*05a0b428SJohn Marinoor 93*05a0b428SJohn Marino.Fn fegetenv , 94*05a0b428SJohn Marinoor equal the macro 95*05a0b428SJohn Marino.Dv FE_DFL_ENV . 96*05a0b428SJohn Marino.Sh RETURN VALUES 97*05a0b428SJohn MarinoThe 98*05a0b428SJohn Marino.Fn fegetenv , 99*05a0b428SJohn Marino.Fn feholdexcept , 100*05a0b428SJohn Marino.Fn fesetenv , 101*05a0b428SJohn Marinoand 102*05a0b428SJohn Marino.Fn feupdateenv 103*05a0b428SJohn Marinofunctions return zero on success, and non-zero if an error occurred. 104*05a0b428SJohn Marino.Sh SEE ALSO 105*05a0b428SJohn Marino.Xr feclearexcept 3 , 106*05a0b428SJohn Marino.Xr feenableexcept 3 , 107*05a0b428SJohn Marino.Xr fegetround 3 108*05a0b428SJohn Marino.Sh STANDARDS 109*05a0b428SJohn MarinoThe 110*05a0b428SJohn Marino.Fn fegetenv , 111*05a0b428SJohn Marino.Fn feholdexcept , 112*05a0b428SJohn Marino.Fn fesetenv , 113*05a0b428SJohn Marinoand 114*05a0b428SJohn Marino.Fn feupdateenv 115*05a0b428SJohn Marinofunctions conform to 116*05a0b428SJohn Marino.St -isoC-99 . 117*05a0b428SJohn Marino.Pp 118*05a0b428SJohn MarinoThe return types for 119*05a0b428SJohn Marino.Fn fegetenv , 120*05a0b428SJohn Marino.Fn fesetenv , 121*05a0b428SJohn Marinoand 122*05a0b428SJohn Marino.Fn feupdateenv 123*05a0b428SJohn Marinoare 124*05a0b428SJohn Marino.Vt int 125*05a0b428SJohn Marinofor alignment with 126*05a0b428SJohn Marino.St -isoC-99 127*05a0b428SJohn MarinoDefect Report #202. 128