about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-96
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/ieee754/ldbl-96')
-rw-r--r--sysdeps/ieee754/ldbl-96/Makefile2
-rw-r--r--sysdeps/ieee754/ldbl-96/include/bits/iscanonical.h5
-rw-r--r--sysdeps/ieee754/ldbl-96/s_iscanonicall.c1
-rw-r--r--sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c (renamed from sysdeps/ieee754/ldbl-96/test-iscanonical-ldbl-96.c)33
4 files changed, 37 insertions, 4 deletions
diff --git a/sysdeps/ieee754/ldbl-96/Makefile b/sysdeps/ieee754/ldbl-96/Makefile
index 931976d7b1..dcbfbbac25 100644
--- a/sysdeps/ieee754/ldbl-96/Makefile
+++ b/sysdeps/ieee754/ldbl-96/Makefile
@@ -17,5 +17,5 @@
 # <http://www.gnu.org/licenses/>.
 
 ifeq ($(subdir),math)
-tests += test-iscanonical-ldbl-96 test-totalorderl-ldbl-96
+tests += test-canonical-ldbl-96 test-totalorderl-ldbl-96
 endif
diff --git a/sysdeps/ieee754/ldbl-96/include/bits/iscanonical.h b/sysdeps/ieee754/ldbl-96/include/bits/iscanonical.h
new file mode 100644
index 0000000000..bee080bd29
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-96/include/bits/iscanonical.h
@@ -0,0 +1,5 @@
+#include_next <bits/iscanonical.h>
+
+#ifndef _ISOMAC
+libm_hidden_proto (__iscanonicall)
+#endif
diff --git a/sysdeps/ieee754/ldbl-96/s_iscanonicall.c b/sysdeps/ieee754/ldbl-96/s_iscanonicall.c
index f820030dc0..91ce80d4f1 100644
--- a/sysdeps/ieee754/ldbl-96/s_iscanonicall.c
+++ b/sysdeps/ieee754/ldbl-96/s_iscanonicall.c
@@ -41,3 +41,4 @@ __iscanonicall (long double x)
        the high bit to be set.  */
     return ix == 0 || ix == 0x7fff || mant_high;
 }
+libm_hidden_def (__iscanonicall)
diff --git a/sysdeps/ieee754/ldbl-96/test-iscanonical-ldbl-96.c b/sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c
index 6827aa8108..ce6dc5b3fa 100644
--- a/sysdeps/ieee754/ldbl-96/test-iscanonical-ldbl-96.c
+++ b/sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c
@@ -1,4 +1,4 @@
-/* Test iscanonical for ldbl-96.
+/* Test iscanonical and canonicalizel for ldbl-96.
    Copyright (C) 2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -99,10 +99,37 @@ do_test (void)
 			 tests[i].mantissa & 0xffffffffULL);
       bool canonical = iscanonical (ld);
       if (canonical == tests[i].canonical)
-	printf ("PASS: test %zu\n", i);
+	{
+	  printf ("PASS: iscanonical test %zu\n", i);
+	  long double ldc = 12345.0L;
+	  bool canonicalize_ret = canonicalizel (&ldc, &ld);
+	  if (canonicalize_ret == !canonical)
+	    {
+	      printf ("PASS: canonicalizel test %zu\n", i);
+	      bool canon_ok;
+	      if (!canonical)
+		canon_ok = ldc == 12345.0L;
+	      else if (isnan (ld))
+		canon_ok = isnan (ldc) && !issignaling (ldc);
+	      else
+		canon_ok = ldc == ld;
+	      if (canon_ok)
+		printf ("PASS: canonicalized value test %zu\n", i);
+	      else
+		{
+		  printf ("FAIL: canonicalized value test %zu\n", i);
+		  result = 1;
+		}
+	    }
+	  else
+	    {
+	      printf ("FAIL: canonicalizel test %zu\n", i);
+	      result = 1;
+	    }
+	}
       else
 	{
-	  printf ("FAIL: test %zu\n", i);
+	  printf ("FAIL: iscanonical test %zu\n", i);
 	  result = 1;
 	}
     }