source: trunk/libs/newlib/src/newlib/libm/common/s_nearbyint.c @ 567

Last change on this file since 567 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.6 KB
Line 
1/*
2 * ====================================================
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
4 *
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 * ====================================================
10 */
11/*
12FUNCTION
13<<nearbyint>>, <<nearbyintf>>---round to integer
14INDEX
15        nearbyint
16INDEX
17        nearbyintf
18
19SYNOPSIS
20        #include <math.h>
21        double nearbyint(double <[x]>);
22        float nearbyintf(float <[x]>);
23
24DESCRIPTION
25The <<nearbyint>> functions round their argument to an integer value in
26floating-point format, using the current rounding direction and
27(supposedly) without raising the "inexact" floating-point exception.
28See the <<rint>> functions for the same function with the "inexact"
29floating-point exception being raised when appropriate.
30
31BUGS
32Newlib does not support the floating-point exception model, so that
33the floating-point exception control is not present and thereby what may
34be seen will be compiler and hardware dependent in this regard.
35The Newlib <<nearbyint>> functions are identical to the <<rint>>
36functions with respect to the floating-point exception behavior, and
37will cause the "inexact" exception to be raised for most targets.
38
39RETURNS
40<[x]> rounded to an integral value, using the current rounding direction.
41
42PORTABILITY
43ANSI C, POSIX
44
45SEEALSO
46<<rint>>, <<round>>
47*/
48
49#include <math.h>
50#include "fdlibm.h"
51
52#ifndef _DOUBLE_IS_32BITS
53
54#ifdef __STDC__
55        double nearbyint(double x)
56#else
57        double nearbyint(x)
58        double x;
59#endif
60{
61  return rint(x);
62}
63
64#endif /* _DOUBLE_IS_32BITS */
Note: See TracBrowser for help on using the repository browser.