fenv.3 (165794) | fenv.3 (208027) |
---|---|
1.\" Copyright (c) 2004 David Schultz <das@FreeBSD.org> 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" | 1.\" Copyright (c) 2004 David Schultz <das@FreeBSD.org> 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" |
25.\" $FreeBSD: head/lib/msun/man/fenv.3 165794 2007-01-05 07:14:26Z das $ | 25.\" $FreeBSD: head/lib/msun/man/fenv.3 208027 2010-05-13 12:07:55Z uqs $ |
26.\" 27.Dd March 16, 2005 28.Dt FENV 3 29.Os 30.Sh NAME 31.Nm feclearexcept , 32.Nm fegetexceptflag , 33.Nm feraiseexcept , --- 157 unchanged lines hidden (view full) --- 191function restores a saved environment similarly to 192.Fn fesetenv , 193but it also re-raises any floating-point exceptions from the old 194environment. 195.Pp 196The macro 197.Dv FE_DFL_ENV 198expands to a pointer to the default environment. | 26.\" 27.Dd March 16, 2005 28.Dt FENV 3 29.Os 30.Sh NAME 31.Nm feclearexcept , 32.Nm fegetexceptflag , 33.Nm feraiseexcept , --- 157 unchanged lines hidden (view full) --- 191function restores a saved environment similarly to 192.Fn fesetenv , 193but it also re-raises any floating-point exceptions from the old 194environment. 195.Pp 196The macro 197.Dv FE_DFL_ENV 198expands to a pointer to the default environment. |
199.Sh CAVEATS 200The FENV_ACCESS pragma can be enabled with 201.Dl "#pragma STDC FENV_ACCESS ON" 202and disabled with the 203.Dl "#pragma STDC FENV_ACCESS OFF" 204directive. 205This lexically-scoped annotation tells the compiler that the program 206may access the floating-point environment, so optimizations that would 207violate strict IEEE-754 semantics are disabled. 208If execution reaches a block of code for which 209.Dv FENV_ACCESS 210is off, the floating-point environment will become undefined. | |
211.Sh EXAMPLES 212The following routine computes the square root function. 213It explicitly raises an invalid exception on appropriate inputs using 214.Fn feraiseexcept . 215It also defers inexact exceptions while it computes intermediate 216values, and then it allows an inexact exception to be raised only if 217the final answer is inexact. 218.Bd -literal -offset indent --- 50 unchanged lines hidden (view full) --- 269The 270.In fenv.h 271header first appeared in 272.Fx 5.3 . 273It supersedes the non-standard routines defined in 274.In ieeefp.h 275and documented in 276.Xr fpgetround 3 . | 199.Sh EXAMPLES 200The following routine computes the square root function. 201It explicitly raises an invalid exception on appropriate inputs using 202.Fn feraiseexcept . 203It also defers inexact exceptions while it computes intermediate 204values, and then it allows an inexact exception to be raised only if 205the final answer is inexact. 206.Bd -literal -offset indent --- 50 unchanged lines hidden (view full) --- 257The 258.In fenv.h 259header first appeared in 260.Fx 5.3 . 261It supersedes the non-standard routines defined in 262.In ieeefp.h 263and documented in 264.Xr fpgetround 3 . |
265.Sh CAVEATS 266The FENV_ACCESS pragma can be enabled with 267.Dl "#pragma STDC FENV_ACCESS ON" 268and disabled with the 269.Dl "#pragma STDC FENV_ACCESS OFF" 270directive. 271This lexically-scoped annotation tells the compiler that the program 272may access the floating-point environment, so optimizations that would 273violate strict IEEE-754 semantics are disabled. 274If execution reaches a block of code for which 275.Dv FENV_ACCESS 276is off, the floating-point environment will become undefined. |
|
277.Sh BUGS 278The 279.Dv FENV_ACCESS 280pragma is unimplemented in the system compiler. 281However, non-constant expressions generally produce the correct 282side-effects at low optimization levels. | 277.Sh BUGS 278The 279.Dv FENV_ACCESS 280pragma is unimplemented in the system compiler. 281However, non-constant expressions generally produce the correct 282side-effects at low optimization levels. |