--- old/usr/src/pkg/manifests/system-test-libctest.mf	Thu Oct 30 00:34:28 2014
+++ new/usr/src/pkg/manifests/system-test-libctest.mf	Thu Oct 30 00:34:28 2014
@@ -28,6 +28,11 @@
 file path=opt/libc-tests/README mode=0444
 file path=opt/libc-tests/bin/libctest mode=0555
 file path=opt/libc-tests/runfiles/default.run mode=0444
+file path=opt/libc-tests/tests/fpround_test mode=0555
+$(i386_ONLY)file path=opt/libc-tests/tests/fpround_test.amd64 mode=0555
+$(i386_ONLY)file path=opt/libc-tests/tests/fpround_test.i386 mode=0555
+$(sparc_ONLY)file path=opt/libc-tests/tests/fpround_test.sparc mode=0555
+$(sparc_ONLY)file path=opt/libc-tests/tests/fpround_test.sparcv9 mode=0555
 file path=opt/libc-tests/tests/newlocale_test mode=0555
 $(i386_ONLY)file path=opt/libc-tests/tests/newlocale_test.amd64 mode=0555
 $(i386_ONLY)file path=opt/libc-tests/tests/newlocale_test.i386 mode=0555
--- old/usr/src/test/libc-tests/runfiles/default.run	Thu Oct 30 00:34:29 2014
+++ new/usr/src/test/libc-tests/runfiles/default.run	Thu Oct 30 00:34:29 2014
@@ -22,6 +22,8 @@
 post =
 outputdir = /var/tmp/test_results
 
+[/opt/libc-tests/tests/fpround_test]
+
 [/opt/libc-tests/tests/newlocale_test]
 
 [/opt/libc-tests/tests/nl_langinfo_test]
--- old/usr/src/test/libc-tests/tests/Makefile	Thu Oct 30 00:34:29 2014
+++ new/usr/src/test/libc-tests/tests/Makefile	Thu Oct 30 00:34:29 2014
@@ -14,7 +14,7 @@
 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
 #
 
-SUBDIRS = newlocale nl_langinfo wcsrtombs wctype
+SUBDIRS = fpround newlocale nl_langinfo wcsrtombs wctype
 
 include $(SRC)/Makefile.master
 include $(SRC)/test/Makefile.com
--- /dev/null	Thu Oct 30 00:34:29 2014
+++ new/usr/src/test/libc-tests/tests/fpround/Makefile	Thu Oct 30 00:34:29 2014
@@ -0,0 +1,24 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source.  A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright 2014 Garrett D'Amore <garrett@damore.org>
+#
+
+include $(SRC)/Makefile.master
+
+PROG = fpround_test
+ARCHPROG = fpround_test
+
+include ../Makefile.com
+
+LDLIBS += -lm
+LDLIBS64 += -lm
--- /dev/null	Thu Oct 30 00:34:29 2014
+++ new/usr/src/test/libc-tests/tests/fpround/fpround_test.c	Thu Oct 30 00:34:29 2014
@@ -0,0 +1,111 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2014 PALO, Richard. All rights reserved.
+ * Copyright 2014 OmniTI Computer Consulting, Inc. All rights reserved.
+ */
+
+/*
+ * Test rounding of floating point numbers in libc's *printf() routines.
+ *
+ * C99 must be enabled to get DECIMAL_DIG defined, but it looks like all
+ * of usr/src/test/libc is compiled that way.
+ */
+
+#include <float.h>
+#include <fenv.h>
+#include <stdio.h>
+#include <strings.h>
+#include "test_common.h"
+
+/*
+ * Returns negative if snprintf() fails.  Returns 0 upon
+ * successful execution of the test, return 1 upon a failure.
+ * Spews output if verbose is TRUE.
+ */
+int
+run_one(test_t t, int i, int j, int precision, boolean_t verbose)
+{
+	const int size = 100;
+	char buffer[size], check[size];
+	double val;
+	int status;
+
+	val = (double)(0.0 + j) / i;
+	/* first get max precision for control check */
+	status = snprintf(check, size, "%+-.*f", DECIMAL_DIG, val);
+	if (status < 0) {
+		test_failed(t, "Max precision snprintf() "
+		    "(i = %d, j = %d) returned %d\n", i, j, status);
+		return (status);
+	}
+	/* then get specific precision */
+	status = snprintf(buffer, size, "%+-#.*f", precision, val);
+	if (status < 0) {
+		test_failed(t, "Specific precision snprintf() "
+		    "(i = %d, j = %d, precision = %d) returned %d\n", i, j,
+		    precision, status);
+		return (status);
+	}
+
+	if (strlen(check) > strlen(buffer) &&
+	    strncmp(buffer, check, strlen(buffer))) {
+		/* last check if correctly rounded up */
+		if (check[strlen(buffer)] < '5' &&
+		    buffer[strlen(buffer) - 1] > check[strlen(buffer) - 1]) {
+			if (verbose)
+				(void) printf("failure:f precision %d "
+				    "for %02d/%02d => %s (%s)\n",
+				    precision, j, i, buffer, check);
+			return (1);
+		}
+	}
+
+	return (0);
+}
+
+int
+main(int argc, char *argv[])
+{
+	int status, i, j, precision;
+	int failures = 0;
+	int runs = 0;
+	test_t t;
+	/* NOTE:  Any argument after the command enables "VERBOSE" mode. */
+	boolean_t verbose = (argc > 1);
+
+	t = test_start("*printf() floating-point rounding tests.");
+
+	(void) fesetround(FE_TONEAREST);
+
+	for (j = 1; j < 100; j++) {
+		for (i = 2; i < 100; i++) {
+			for (precision = DBL_DIG - 1; precision <= DECIMAL_DIG;
+			    precision++) {
+				runs++;
+				status = run_one(t, i, j, precision, verbose);
+				if (status < 0)
+					return (status);
+				failures += status;
+			}
+		}
+	}
+
+	if (failures > 0) {
+		test_failed(t, "Tests failed %d times out of %d attempts.\n"
+		    "Run '%s full' to see the %d failures individually.\n",
+		    failures, runs, argv[0], failures);
+	} else
+		test_passed(t);
+
+	return (0);
+}
