Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libm / common / s_nearbyint.c
blobd142c68f25c93571e4dd346b4d318a7ba9901f68
1 /*
2 * ====================================================
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 * Developed at SunPro, a Sun Microsystems, Inc. business.
6 * Permission to use, copy, modify, and distribute this
7 * software is freely granted, provided that this notice
8 * is preserved.
9 * ====================================================
12 FUNCTION
13 <<nearbyint>>, <<nearbyintf>>---round to integer
14 INDEX
15 nearbyint
16 INDEX
17 nearbyintf
19 SYNOPSIS
20 #include <math.h>
21 double nearbyint(double <[x]>);
22 float nearbyintf(float <[x]>);
24 DESCRIPTION
25 The <<nearbyint>> functions round their argument to an integer value in
26 floating-point format, using the current rounding direction and
27 (supposedly) without raising the "inexact" floating-point exception.
28 See the <<rint>> functions for the same function with the "inexact"
29 floating-point exception being raised when appropriate.
31 BUGS
32 Newlib does not support the floating-point exception model, so that
33 the floating-point exception control is not present and thereby what may
34 be seen will be compiler and hardware dependent in this regard.
35 The Newlib <<nearbyint>> functions are identical to the <<rint>>
36 functions with respect to the floating-point exception behavior, and
37 will cause the "inexact" exception to be raised for most targets.
39 RETURNS
40 <[x]> rounded to an integral value, using the current rounding direction.
42 PORTABILITY
43 ANSI C, POSIX
45 SEEALSO
46 <<rint>>, <<round>>
49 #include <math.h>
50 #include "fdlibm.h"
52 #ifndef _DOUBLE_IS_32BITS
54 #ifdef __STDC__
55 double nearbyint(double x)
56 #else
57 double nearbyint(x)
58 double x;
59 #endif
61 return rint(x);
64 #endif /* _DOUBLE_IS_32BITS */