summaryrefslogtreecommitdiff
path: root/regress/lib/libm/exp
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2006-03-15 21:44:07 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2006-03-15 21:44:07 +0000
commit20e258e5a26780ea908d09047c6b2d279e5103a3 (patch)
tree9dbe3f231093558af857fad640e1e2be0c123b2c /regress/lib/libm/exp
parent02521dc8079fad719abb3db7564dfbc647bc3608 (diff)
Simple exp(3) and expf(3) regression test for +Inf and -Inf
Diffstat (limited to 'regress/lib/libm/exp')
-rw-r--r--regress/lib/libm/exp/Makefile8
-rw-r--r--regress/lib/libm/exp/exp.c28
2 files changed, 36 insertions, 0 deletions
diff --git a/regress/lib/libm/exp/Makefile b/regress/lib/libm/exp/Makefile
new file mode 100644
index 00000000000..ebfd5904d80
--- /dev/null
+++ b/regress/lib/libm/exp/Makefile
@@ -0,0 +1,8 @@
+# $OpenBSD: Makefile,v 1.1 2006/03/15 21:44:06 otto Exp $
+
+PROG=exp
+
+LDADD=-lm
+DPADD=${LIBM}
+
+.include <bsd.regress.mk>
diff --git a/regress/lib/libm/exp/exp.c b/regress/lib/libm/exp/exp.c
new file mode 100644
index 00000000000..0d8ee897977
--- /dev/null
+++ b/regress/lib/libm/exp/exp.c
@@ -0,0 +1,28 @@
+/* $OpenBSD: exp.c,v 1.1 2006/03/15 21:44:06 otto Exp $ */
+
+/* Written by Otto Moerbeek, 2006, Public domain. */
+
+#include <math.h>
+#include <err.h>
+
+int
+main(void)
+{
+ double rd, bigd = HUGE_VAL;
+ float rf, bigf = HUGE_VAL;
+
+ rd = exp(bigd);
+ if (!isinf(rd))
+ errx(1, "exp(bigd) = %f", rd);
+ rd = exp(-bigd);
+ if (rd != 0.0)
+ errx(1, "exp(-bigd) = %f", rd);
+
+ rf = expf(bigf);
+ if (!isinff(rf))
+ errx(1, "exp(bigf) = %f", rf);
+ rf = expf(-bigf);
+ if (rf != 0.0F)
+ errx(1, "exp(-bigf) = %f", rf);
+ return (0);
+}