summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2013-08-07 12:46:00 +0000
committerMarc Espie <espie@cvs.openbsd.org>2013-08-07 12:46:00 +0000
commit9fa9c81fe15ac3a5b7732bd36e2b2aad74eb6982 (patch)
treea0ab0f42a4bded530a23cdb566ef84944d8b44a2
parent595bce8c699e700a0d6ed012cef1d013558306fe (diff)
simple inaccurate implementation of lrint* functions on vax, just so
we have them. Compiles on vax. okay martynas@
-rw-r--r--lib/libm/Makefile4
-rw-r--r--lib/libm/noieee_src/n_lrint.c56
2 files changed, 58 insertions, 2 deletions
diff --git a/lib/libm/Makefile b/lib/libm/Makefile
index dfa09fd3a4c..1ef4b0c0036 100644
--- a/lib/libm/Makefile
+++ b/lib/libm/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.104 2013/07/15 18:05:14 espie Exp $
+# $OpenBSD: Makefile,v 1.105 2013/08/07 12:45:58 espie Exp $
# $NetBSD: Makefile,v 1.28 1995/11/20 22:06:19 jtc Exp $
#
# @(#)Makefile 5.1beta 93/09/24
@@ -149,7 +149,7 @@ NOIEEE_SRCS = n_acosh.c n_asincos.c n_asinh.c n_atan.c \
n_fmod.c \
n_j0.c n_j1.c n_jn.c n_lgamma.c n_log.c n_log10.c \
n_log1p.c n_log__L.c n_nan.c n_pow.c \
- n_sinh.c n_tanh.c n_tgamma.c
+ n_sinh.c n_tanh.c n_tgamma.c n_lrint.c
# there for reference, they're replaced by an asm version on vax
NOIEEE_SRCS += n_argred.c n_atan2.c n_cbrt.c n_hypot.c n_infnan.c \
n_sincos.c n_sqrt.c n_support.c n_tan.c
diff --git a/lib/libm/noieee_src/n_lrint.c b/lib/libm/noieee_src/n_lrint.c
new file mode 100644
index 00000000000..9ef81478577
--- /dev/null
+++ b/lib/libm/noieee_src/n_lrint.c
@@ -0,0 +1,56 @@
+/* $OpenBSD: n_lrint.c,v 1.1 2013/08/07 12:45:59 espie Exp $ */
+/*
+ * Copyright (c) 2013 Marc Espie.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD
+ * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <math.h>
+
+long
+lrint(double x)
+{
+ return (long)rint(x);
+}
+
+__strong_alias(lrintl, lrint);
+
+long
+lrintf(float x)
+{
+ return (long)rintf(x);
+}
+
+long long
+llrint(double x)
+{
+ return (long long)rint(x);
+}
+
+__strong_alias(llrintl, llrint);
+
+long long
+llrintf(float x)
+{
+ return (long long)rintf(x);
+}
+