10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 */
25 /*
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30 #if defined(ELFOBJ)
31 #pragma weak llrint = __llrint
32 #if defined(__sparcv9) || defined(__amd64)
33 #pragma weak lrint = __llrint
34 #pragma weak __lrint = __llrint
35 #endif
36 #endif
37
38 /*
39 * llrint(x) rounds its argument to the nearest integer according
40 * to the current rounding direction and converts the result to a
41 * 64 bit signed integer.
42 *
43 * If x is NaN, infinite, or so large that the nearest integer would
44 * exceed 64 bits, the invalid operation exception is raised. If x
45 * is not an integer, the inexact exception is raised.
46 */
47
48 #include "libm.h"
49
50 long long
51 llrint(double x) {
52 /*
53 * Note: The following code works on x86 (in the default rounding
54 * precision mode), but one should just use the fistpll instruction
55 * instead.
56 */
|
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 */
25 /*
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
28 */
29
30 #pragma weak llrint = __llrint
31 #if defined(__sparcv9) || defined(__amd64)
32 #pragma weak lrint = __llrint
33 #pragma weak __lrint = __llrint
34 #endif
35
36 /*
37 * llrint(x) rounds its argument to the nearest integer according
38 * to the current rounding direction and converts the result to a
39 * 64 bit signed integer.
40 *
41 * If x is NaN, infinite, or so large that the nearest integer would
42 * exceed 64 bits, the invalid operation exception is raised. If x
43 * is not an integer, the inexact exception is raised.
44 */
45
46 #include "libm.h"
47
48 long long
49 llrint(double x) {
50 /*
51 * Note: The following code works on x86 (in the default rounding
52 * precision mode), but one should just use the fistpll instruction
53 * instead.
54 */
|