[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r8807 - in /libdfp/trunk: sysdeps/powerpc/dfpu/numdigits.h tests/test-printf.c



Author: ryanarn
Date: Wed Aug 12 12:57:47 2009
New Revision: 8807

Log:
2009-08-12  Ryan S. Arnold  <rsa@xxxxxxxxxx>

	* tests/test-printf.c: Added print statements for _Decimal32 and
	_Decimal128.
	* sysdeps/powerpc/dfpu/numdigits.h (numdigits getexp): Use FUNC_D
	wrapper.
	(FUNC_D PASTE): Conditionally define these macros.

Modified:
    libdfp/trunk/sysdeps/powerpc/dfpu/numdigits.h
    libdfp/trunk/tests/test-printf.c

Modified: libdfp/trunk/sysdeps/powerpc/dfpu/numdigits.h
==============================================================================
--- libdfp/trunk/sysdeps/powerpc/dfpu/numdigits.h (original)
+++ libdfp/trunk/sysdeps/powerpc/dfpu/numdigits.h Wed Aug 12 12:57:47 2009
@@ -49,9 +49,17 @@
 #  define DECIMAL_BIAS 6176
 #endif
 
+#ifndef PASTE
+# define PASTE(x,y) PASTE2(x,y)
+# define PASTE2(x,y) x##y
+#endif
+
+#ifndef FUNC_D
+# define FUNC_D(x)		PASTE(x,PASTE(d,_DECIMAL_SIZE))
+#endif
 
 static inline int
-getexp (DEC_TYPE x)
+FUNC_D (getexp) (DEC_TYPE x)
 {
   union {
     double f;
@@ -116,7 +124,7 @@
 
 
 static inline int
-numdigits (DEC_TYPE x)
+FUNC_D (numdigits) (DEC_TYPE x)
 {
 #if _DECIMAL_SIZE == 128
   register DEC_TYPE tmp asm ("fr0") = x;

Modified: libdfp/trunk/tests/test-printf.c
==============================================================================
--- libdfp/trunk/tests/test-printf.c (original)
+++ libdfp/trunk/tests/test-printf.c Wed Aug 12 12:57:47 2009
@@ -9,15 +9,17 @@
 
 int main ()
 {
-	//_Decimal32 d32 = 1.11111111111DF;
-	//_Decimal128 d128 = 0.000033333DL;
+	_Decimal32 d32 = 1.11111111111DF;
+	_Decimal128 d128 = 0.000033333DL;
 	_Decimal64 d64 = 2.22222222222DD;
 
 	double d = 1.234567;
 	printf("%e.\n",d);
 
 	register_printf_dfp();
+	printf("%Hf.\n",d32);
 	printf("%Df.\n",d64);
+	printf("%DDf.\n",d128);
 
 	d = 3.1415962;
 	printf("%e.\n",d);