diff --git a/misc/Makefile b/misc/Makefile
index eb77b87b0d..ca0c6b398a 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -90,12 +90,24 @@ tests-internal := tst-atomic tst-atomic-long tst-allocate_once
 tests-static := tst-empty
 
 tests-internal += tst-ldbl-warn
+tests-internal += tst-ldbl-error-err
+tests-internal += tst-ldbl-error-errx
+tests-internal += tst-ldbl-error-verr
+tests-internal += tst-ldbl-error-verrx
+tests-internal += tst-ldbl-error-error
+tests-internal += tst-ldbl-error-error_at_line
 
 ifeq ($(run-built-tests),yes)
 tests-special += $(objpfx)tst-error1-mem.out \
   $(objpfx)tst-allocate_once-mem.out
 
 tests-special += $(objpfx)tst-ldbl-warn.out
+tests-special += $(objpfx)tst-ldbl-error-err.out
+tests-special += $(objpfx)tst-ldbl-error-errx.out
+tests-special += $(objpfx)tst-ldbl-error-verr.out
+tests-special += $(objpfx)tst-ldbl-error-verrx.out
+tests-special += $(objpfx)tst-ldbl-error-error.out
+tests-special += $(objpfx)tst-ldbl-error-error_at_line.out
 endif
 
 $(objpfx)tst-ldbl-warn.out: \
@@ -103,6 +115,11 @@ $(objpfx)tst-ldbl-warn.out: \
 	$(SHELL) $^ '$(test-program-prefix)' $@; \
 	$(evaluate-test)
 
+$(objpfx)tst-ldbl-error-%.out: \
+  tst-ldbl-error.sh $(objpfx)tst-ldbl-error-%
+	$(SHELL) $^ '$(test-program-prefix)' $@; \
+	$(evaluate-test)
+
 CFLAGS-select.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-tsearch.c += $(uses-callbacks)
 CFLAGS-lsearch.c += $(uses-callbacks)
diff --git a/misc/tst-ldbl-error-err.c b/misc/tst-ldbl-error-err.c
new file mode 100644
index 0000000000..9a57b13025
--- /dev/null
+++ b/misc/tst-ldbl-error-err.c
@@ -0,0 +1,3 @@
+#define ERROR_FUNCTION		err
+#define ERROR_FUNCTION_PARAMS	(0, format, ld)
+#include <tst-ldbl-error-template.c>
diff --git a/misc/tst-ldbl-error-error.c b/misc/tst-ldbl-error-error.c
new file mode 100644
index 0000000000..be06513c0b
--- /dev/null
+++ b/misc/tst-ldbl-error-error.c
@@ -0,0 +1,3 @@
+#define ERROR_FUNCTION		error
+#define ERROR_FUNCTION_PARAMS	(0, 0, format, ld)
+#include <tst-ldbl-error-template.c>
diff --git a/misc/tst-ldbl-error-error_at_line.c b/misc/tst-ldbl-error-error_at_line.c
new file mode 100644
index 0000000000..ca4cea13ae
--- /dev/null
+++ b/misc/tst-ldbl-error-error_at_line.c
@@ -0,0 +1,3 @@
+#define ERROR_FUNCTION		error_at_line
+#define ERROR_FUNCTION_PARAMS	(0, 0, "", 1234, format, ld)
+#include <tst-ldbl-error-template.c>
diff --git a/misc/tst-ldbl-error-errx.c b/misc/tst-ldbl-error-errx.c
new file mode 100644
index 0000000000..bf3e6ac64e
--- /dev/null
+++ b/misc/tst-ldbl-error-errx.c
@@ -0,0 +1,3 @@
+#define ERROR_FUNCTION		errx
+#define ERROR_FUNCTION_PARAMS	(0, format, ld)
+#include <tst-ldbl-error-template.c>
diff --git a/misc/tst-ldbl-error-template.c b/misc/tst-ldbl-error-template.c
new file mode 100644
index 0000000000..24fd580d4c
--- /dev/null
+++ b/misc/tst-ldbl-error-template.c
@@ -0,0 +1,45 @@
+/* Test for the long double conversions in *err* functions.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <err.h>
+#include <error.h>
+#include <stdarg.h>
+
+#include <support/check.h>
+
+static void
+do_test_call (long double ld, const char *format, ...)
+{
+  va_list args;
+
+  va_start (args, format);
+  ERROR_FUNCTION ERROR_FUNCTION_PARAMS;
+  va_end (args);
+}
+
+static int
+do_test (void)
+{
+  long double ld = -1;
+
+  do_test_call (ld, "%.60Lf", ld);
+
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/misc/tst-ldbl-error-verr.c b/misc/tst-ldbl-error-verr.c
new file mode 100644
index 0000000000..9ac51f1c34
--- /dev/null
+++ b/misc/tst-ldbl-error-verr.c
@@ -0,0 +1,3 @@
+#define ERROR_FUNCTION		verr
+#define ERROR_FUNCTION_PARAMS	(0, format, args)
+#include <tst-ldbl-error-template.c>
diff --git a/misc/tst-ldbl-error-verrx.c b/misc/tst-ldbl-error-verrx.c
new file mode 100644
index 0000000000..995f4a26b1
--- /dev/null
+++ b/misc/tst-ldbl-error-verrx.c
@@ -0,0 +1,3 @@
+#define ERROR_FUNCTION		verrx
+#define ERROR_FUNCTION_PARAMS	(0, format, args)
+#include <tst-ldbl-error-template.c>
diff --git a/misc/tst-ldbl-error.sh b/misc/tst-ldbl-error.sh
new file mode 100644
index 0000000000..cec3f53a63
--- /dev/null
+++ b/misc/tst-ldbl-error.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+# Test for the long double conversions in *err* functions.
+# Copyright (C) 2018 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+set -e
+
+test_program=$1; shift
+test_program_prefix=$1; shift
+test_program_output=$1; shift
+
+status=0
+
+${test_program_prefix} \
+  ${test_program} \
+  2> ${test_program_output} || status=1
+
+# This script is shared among different test cases that have different
+# names and print different messages, however, the goal of the tests is
+# to detect if floating-point conversions worked, not if the messages
+# and filenames are correct, thus:
+#
+# Remove the trailing messages, if any.
+sed -i ${test_program_output} -e "s/: Success//"
+#
+# Remove the program name.
+sed -i ${test_program_output} -e "s/.*tst-[^:]*: //"
+#
+# Remove the line number annotation (error_at_line).
+sed -i ${test_program_output} -e "s/.*1234: //"
+
+cat <<'EOF' |
+-1.000000000000000000000000000000000000000000000000000000000000
+EOF
+cmp - ${test_program_output} > /dev/null 2>&1 ||
+{
+  status=1
+  echo "*** output comparison failed"
+}
+
+exit $status
