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

[Commits] r15611 - in /libdfp/trunk: ./ base-math/ include/ sysdeps/soft-dfp/ tests/



Author: ryanarn
Date: Fri Oct 28 01:50:31 2011
New Revision: 15611

Log:
2011-10-27  Ryan S. Arnold  <rsa@xxxxxxxxxxxxxxxxxx>

	* Makefile.in (libdfp_tests): Added test-bfp-conversions.
	* base-math/Makefile (libdfp_files): Moved extendsfsd extendsddf
	extendsdtf extendsfdd extenddfdd extendddtf extendsftd extenddftd
	extendtftd truncsdsf truncdfsd trunctfsd truncddsf truncdddf
	trunctfdd trunctdsf trunctddf trunctdtf from sysdeps/soft-dfp/Makefile
	since they're required in all builds.
	* tests/test-bfp-conversions.c: New file to test bfp -> dfp and dfp ->
	bfp conversions.
	* include/convert.h: Moved from sysdeps/soft-dfp/ in preparation for
	moving extend and trunc bfp->dfp and dfp->bfp conversion functions.
	* sysdeps/soft-dfp/Makefile (libdfp_files): Removed extendsfsd
	extendsddf extendsdtf extendsfdd extenddfdd extendddtf extendsftd
	extenddftd extendtftd truncsdsf truncdfsd trunctfsd truncddsf
	truncdddf trunctfdd trunctdsf trunctddf trunctdtf and moved to
	base-math/Makefile since they're required in all builds.
	* sysdeps/soft-dfp/extendsfsd.c: Replaced magic number '24' with
	__FLT_MANT_DIG__.
	* sysdeps/soft-dfp/convert.h: Moved to include/convert.h.
	* sysdeps/soft-dfp/truncdfsd.c: Replaced magic number '53' with
	__DBL_MANT_DIG__.

Added:
    libdfp/trunk/include/convert.h
      - copied unchanged from r13627, libdfp/trunk/sysdeps/soft-dfp/convert.h
    libdfp/trunk/tests/test-bfp-conversions.c
Removed:
    libdfp/trunk/sysdeps/soft-dfp/convert.h
Modified:
    libdfp/trunk/Makefile.in
    libdfp/trunk/base-math/Makefile
    libdfp/trunk/sysdeps/soft-dfp/Makefile
    libdfp/trunk/sysdeps/soft-dfp/extendsfsd.c
    libdfp/trunk/sysdeps/soft-dfp/truncdfsd.c

Modified: libdfp/trunk/Makefile.in
==============================================================================
--- libdfp/trunk/Makefile.in (original)
+++ libdfp/trunk/Makefile.in Fri Oct 28 01:50:31 2011
@@ -304,7 +304,7 @@
 GLIBC_LIBS := $(glibc_builddir)/libc.so $(glibc_builddir)/math/libm.so $(glibc_builddir)/nptl/libpthread.so
 endif
 
-libdfp_tests = test-printf test-param test-amort test-decode test-quantize test-isnan test-isinf test-isfinite test-fpclassify test-logd test-log10d test-strtod test-numdigits test-get_digits test-round
+libdfp_tests = test-printf test-param test-amort test-decode test-quantize test-isnan test-isinf test-isfinite test-fpclassify test-logd test-log10d test-strtod test-numdigits test-get_digits test-round test-bfp-conversions
 
 # Explicitly link against the uninstalled GLIBC and the Libdfp.so.1 we just
 # built.

Modified: libdfp/trunk/base-math/Makefile
==============================================================================
--- libdfp/trunk/base-math/Makefile (original)
+++ libdfp/trunk/base-math/Makefile Fri Oct 28 01:50:31 2011
@@ -2,6 +2,9 @@
 		divsd3 divdd3 divtd3 \
 		eqsd2 eqdd2 eqtd2 \
 		extendsddd2 extendsdtd2 extendddtd2 \
+		extendsfsd extendsddf extendsdtf \
+		extendsfdd extenddfdd extendddtf \
+		extendsftd extenddftd extendtftd \
 		fixsdsi fixddsi fixtdsi \
 		fixsddi fixdddi fixtddi \
 		fixunssdsi fixunsddsi fixunstdsi \
@@ -18,4 +21,7 @@
 		nesd2 nedd2 netd2 \
 		subsd3 subdd3 subtd3 \
 		truncddsd2 trunctddd2 trunctdsd2 \
+		truncsdsf truncdfsd trunctfsd \
+		truncddsf truncdddf trunctfdd \
+		trunctdsf trunctddf trunctdtf \
 		unordsd2 unorddd2 unordtd2 \

Modified: libdfp/trunk/sysdeps/soft-dfp/Makefile
==============================================================================
--- libdfp/trunk/sysdeps/soft-dfp/Makefile (original)
+++ libdfp/trunk/sysdeps/soft-dfp/Makefile Fri Oct 28 01:50:31 2011
@@ -1,11 +1,13 @@
 # base-math/Makefile defines all of the arithmetic and comparison functions
-# and SOME of the conversion functions.  We provide the conversion functions
+# and SOME of the conversion functions.
+libdfp_files += decroundtls classify
+
+#  We provide the conversion functions
 # which are decimal->binary and binary->decimal here that aren't provided by
 # base-math/Makefile.
-libdfp_files += decroundtls classify \
-		extendsfsd extendsddf extendsdtf \
-		extendsfdd extenddfdd extendddtf \
-		extendsftd extenddftd extendtftd \
-		truncsdsf truncdfsd trunctfsd \
-		truncddsf truncdddf trunctfdd \
-		trunctdsf trunctddf trunctdtf
+#extendsfsd extendsddf extendsdtf \
+#extendsfdd extenddfdd extendddtf \
+#extendsftd extenddftd extendtftd \
+#truncsdsf truncdfsd trunctfsd \
+#truncddsf truncdddf trunctfdd \
+#trunctdsf trunctddf trunctdtf

Removed: libdfp/trunk/sysdeps/soft-dfp/convert.h
==============================================================================
--- libdfp/trunk/sysdeps/soft-dfp/convert.h (original)
+++ libdfp/trunk/sysdeps/soft-dfp/convert.h (removed)
@@ -1,343 +1,0 @@
-/* Handle conversion from binary integers, floats and decimal types
-   Copyright (C) 2007,2008 IBM Corporation.
-
-   Author(s): Pete Eberlein <eberlein@xxxxxxxxxx>
-
-   The Decimal Floating Point C Library is free software; you can
-   redistribute it and/or modify it under the terms of the GNU Lesser
-   General Public License version 2.1.
-
-   The Decimal Floating Point 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 version 2.1 for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License version 2.1 along with the Decimal Floating Point C Library;
-   if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-   Suite 330, Boston, MA 02111-1307 USA.
-
-   Please see dfp/COPYING.txt for more information.  */
-
-
-#include <math.h>
-#include <stdlib.h>
-
-/* decimal source */
-#if defined DECIMAL_TO_INTEGER || defined DECIMAL_TO_BINARY || defined DECIMAL_TO_DECIMAL
-
-#if SRC==32
-# define SRC_TYPE _Decimal32
-# define IEEE_SRC_TYPE decimal32
-# define SRC_LITERAL(n) n##DF
-# define SRC_KIND sd
-# define SIGNBIT __signbitd32
-# define CLASSIFY __fpclassifyd32
-#endif
-
-#if SRC==64
-# define SRC_TYPE _Decimal64
-# define IEEE_SRC_TYPE decimal64
-# define SRC_LITERAL(n) n##DD
-# define SRC_KIND dd
-# define SIGNBIT __signbitd64
-# define CLASSIFY __fpclassifyd64
-#endif
-
-#if SRC==128
-# define SRC_TYPE _Decimal128
-# define IEEE_SRC_TYPE decimal128
-# define SRC_LITERAL(n) n##DL
-# define SRC_KIND td
-# define SIGNBIT __signbitd128
-# define CLASSIFY __fpclassifyd128
-#endif
-
-extern int SIGNBIT (SRC_TYPE);
-extern int CLASSIFY (SRC_TYPE);
-
-
-#define DECIMAL_SIZE SRC
-
-#endif //DECIMAL_TO_INTEGER || DECIMAL_TO_BINARY || DECIMAL_TO_DECIMAL
-
-
-/* float source */
-#if defined BINARY_TO_DECIMAL
-
-#if SRC==32
-#define SRC_TYPE float
-#define SRC_LITERAL(n) n##f
-#define SRC_KIND sf
-#define SIGNBIT __builtin_signbitf
-//extern int __dfp_classify_sf (float a);
-#define CLASSIFY __dfp_classify_sf
-#endif
-
-#if SRC==64
-#define SRC_TYPE double
-#define SRC_LITERAL(n) n##d
-#define SRC_KIND df
-#define SIGNBIT __builtin_signbit
-//extern int __dfp_classify_df (double a);
-#define CLASSIFY __dfp_classify_df
-#endif
-
-#if SRC==128
-#define SRC_TYPE long double
-#define SRC_LITERAL(n) n##l
-#define SRC_KIND tf
-#define SIGNBIT __builtin_signbitl
-//extern int __dfp_classify_df (double a);
-/* For IBM 128-bit long double we use the double version.  */
-#define CLASSIFY __dfp_classify_df
-#endif
-
-extern int SIGNBIT (SRC_TYPE);
-extern int CLASSIFY (SRC_TYPE);
-
-
-#endif // BINARY_TO_DECIMAL
-
-
-/* integer source */
-#if defined INTEGER_TO_DECIMAL
-
-#if SRC==32
-#if defined UNSIGNED
-#define SRC_TYPE unsigned int
-#define INT_FMT "%u"
-#define CAST_FOR_FMT(A) (unsigned int)A
-#else
-#define SRC_TYPE int
-#define INT_FMT "%d"
-#define CAST_FOR_FMT(A) (int)A
-#endif
-#define SRC_LITERAL(n) n
-#define SRC_KIND si
-#endif
-
-#if SRC==64
-#if defined UNSIGNED
-#define SRC_TYPE unsigned long long
-#define INT_FMT "%llu"
-#define CAST_FOR_FMT(A) (unsigned long long)A
-#else
-#define SRC_TYPE long long
-#define INT_FMT "%lld"
-#define CAST_FOR_FMT(A) (long long)A
-#endif
-#define SRC_LITERAL(n) n
-#define SRC_KIND di
-#endif
-
-#endif // INTEGER_TO_DECIMAL
-
-
-
-/* decimal dest */
-#if defined DECIMAL_TO_DECIMAL || defined INTEGER_TO_DECIMAL || defined BINARY_TO_DECIMAL
-
-#if DEST==32
-#define DEST_TYPE _Decimal32
-#define IEEE_DEST_TYPE decimal32
-#define DEST_LITERAL(n) n##DF
-#define DEST_KIND sd
-#endif
-
-#if DEST==64
-#define DEST_TYPE _Decimal64
-#define IEEE_DEST_TYPE decimal64
-#define DEST_LITERAL(n) n##DD
-#define DEST_KIND dd
-#endif
-
-#if DEST==128
-#define DEST_TYPE _Decimal128
-#define IEEE_DEST_TYPE decimal128
-#define DEST_LITERAL(n) n##DL
-#define DEST_KIND td
-#endif
-
-#define DEST_INFINITY DEC_INFINITY
-#define DEST_NAN DEC_NAN
-
-#if defined DECIMAL_SIZE
-#if DECIMAL_SIZE < DEST
-#undef DECIMAL_SIZE
-#define DECIMAL_SIZE DEST
-#endif
-#endif
-
-#define CONTEXT_INIT PASTE(DEC_INIT_DECIMAL,DEST)
-
-#endif //DECIMAL_TO_DECIMAL || INTEGER_TO_DECIMAL || BINARY_TO_DECIMAL
-
-
-/* float dest */
-#if defined DECIMAL_TO_BINARY
-
-#if DEST==32
-#define DEST_TYPE float
-#define DEST_LITERAL(n) n##F
-#define DEST_KIND sf
-#endif
-
-#if DEST==64
-#define DEST_TYPE double
-#define DEST_LITERAL(n) n
-#define DEST_KIND df
-#endif
-
-#if DEST==128
-#define DEST_TYPE long double
-#define DEST_LITERAL(n) n##L
-#define DEST_KIND tf
-#endif
-
-#define DEST_INFINITY INFINITY
-#define DEST_NAN NAN
-
-
-#endif //DECIMAL_TO_BINARY
-
-
-/* integer dest */
-#if defined DECIMAL_TO_INTEGER
-
-#if DEST==32
-#if defined UNSIGNED
-#define DEST_TYPE unsigned int
-#define STR_TO_INT strtoul
-#else
-#define DEST_TYPE int
-#define STR_TO_INT strtol
-#endif
-#define DEST_LITERAL(n) n
-#define DEST_KIND si
-#endif
-
-#if DEST==64
-#if defined UNSIGNED
-#define DEST_TYPE unsigned long long
-#define STR_TO_INT strtoull
-#else
-#define DEST_TYPE long long
-#define STR_TO_INT strtoll
-#endif
-#define DEST_LITERAL(n) n
-#define DEST_KIND di
-#endif
-
-#endif //DECIMAL_TO_INTEGER
-
-
-extern long double binpowof10[];
-extern const _Decimal128 decpowof2[];
-
-#define BINPOWOF10 binpowof10
-#define BINPOWOF10_LIMIT 308
-#define DECPOWOF2 decpowof2
-
-#define FREXPSF		__builtin_frexpf
-#define FREXPDF		__builtin_frexp
-#define FREXPTF		__builtin_frexpl
-#define FREXPD32	__frexpd32
-#define FREXPD64	__frexpd64
-#define FREXPD128	__frexpd128
-
-
-
-#ifndef PASTE
-# define PASTE(a,b) PASTE2(a,b)
-# define PASTE2(x,y) x##y
-#endif
-#define PASTE4(a,b,c,d) PASTE(PASTE(a,b),PASTE(c,d))
-#define PASTE5(a,b,c,d,e) PASTE(PASTE4(a,b,c,d),e)
-
-#if defined DECIMAL_TO_DECIMAL
-#define FUNCTION_NAME PASTE4(NAME,SRC_KIND,DEST_KIND,2)
-#else
-#define FUNCTION_NAME PASTE4(NAME,SRC_KIND,DEST_KIND,)
-#endif
-
-/* Functions will need to be prefixed with __bid_ or __dpd_ depending on 
- * how GCC was configured. --enable-decimal-float=[bid,dpd] */
-#if __DECIMAL_BID_FORMAT__==1
-#define PREFIXED_FUNCTION_NAME  PASTE(__bid_,FUNCTION_NAME)
-#else
-/* #define PREFIXED_FUNCTION_NAME  PASTE(__dfp_,FUNCTION_NAME) */
-#define PREFIXED_FUNCTION_NAME  PASTE(__dpd_,FUNCTION_NAME)
-#endif
-
-#if (SRC == 128 && (defined DECIMAL_TO_DECIMAL || defined DECIMAL_TO_INTEGER)) || \
-    (DEST == 128 && (defined DECIMAL_TO_DECIMAL || defined INTEGER_TO_DECIMAL))
-#include "decimal128.h"
-#include <dfptypeconv128.h>
-#endif
-#if (SRC == 64 && (defined DECIMAL_TO_DECIMAL || defined DECIMAL_TO_INTEGER)) || \
-    (DEST == 64 && (defined DECIMAL_TO_DECIMAL || defined INTEGER_TO_DECIMAL))
-#include "decimal64.h"
-#include <dfptypeconv64.h>
-#endif
-#if (SRC == 32 && (defined DECIMAL_TO_DECIMAL || defined DECIMAL_TO_INTEGER)) || \
-    (DEST == 32 && (defined DECIMAL_TO_DECIMAL || defined INTEGER_TO_DECIMAL))
-#include "decimal32.h"
-#include <dfptypeconv32.h>
-#endif
-
-#define DFP_EXCEPTIONS_ENABLED 1
-
-#define DFP_IEEE_FLAGS(status) (					\
-      (((status) & DEC_IEEE_854_Division_by_zero) ? FE_DIVBYZERO : 0) |	\
-      (((status) & DEC_IEEE_854_Inexact) ? FE_INEXACT : 0) |		\
-      (((status) & DEC_IEEE_854_Invalid_operation) ? FE_INVALID : 0) |	\
-      (((status) & DEC_IEEE_854_Overflow) ? FE_OVERFLOW : 0) |		\
-      (((status) & DEC_IEEE_854_Underflow) ? FE_UNDERFLOW : 0))
-
-#include <fenv_libdfp.h>
-
-#ifdef fegetenv_register
-# define DFP_TEST_EXCEPTIONS(status)	({	\
-	fenv_union_t u; 			\
-	u.fenv = fegetenv_register(); 		\
-	u.l[1] & (status);			\
-	})
-# define DFP_CLEAR_EXCEPTIONS(status)	{	\
-	fenv_union_t u;				\
-	u.fenv = fegetenv_register();		\
-	u.l[1] &= ~status;			\
-	fesetenv_register(u.fenv);		\
-	}
-#else
-/* Non-register targets might want to use the standard functions.
- * Note that it is necessary to include these symbols in libdfp
- * to avoid libm dependencies.  */
-# define DFP_TEST_EXCEPTIONS(status)	fetestexcept (status)
-# define DFP_CLEAR_EXCEPTIONS(status)	feclearexcept (status)
-#endif
-
-#define DFP_HANDLE_EXCEPTIONS(status)	feraiseexcept(status)
-
-#define CONVERT_WRAPPER(...)			\
-DEST_TYPE					\
-PREFIXED_FUNCTION_NAME (SRC_TYPE a)		\
-{						\
-	DEST_TYPE result = DEST_LITERAL(0.);	\
-						\
-	switch (CLASSIFY (a)) {			\
-		case FP_ZERO:			\
-			result = SIGNBIT(a) ? DEST_LITERAL(-0.) : DEST_LITERAL(0.);	\
-			break;			\
-		case FP_INFINITE: 		\
-			result = SIGNBIT(a) ? -DEST_INFINITY : DEST_INFINITY;	\
-			break;			\
-		case FP_NAN:			\
-			result = DEST_NAN;	\
-			break;			\
-		default: {			\
-			__VA_ARGS__		\
-			}			\
-	}					\
-	return result;				\
-}

Modified: libdfp/trunk/sysdeps/soft-dfp/extendsfsd.c
==============================================================================
--- libdfp/trunk/sysdeps/soft-dfp/extendsfsd.c (original)
+++ libdfp/trunk/sysdeps/soft-dfp/extendsfsd.c Fri Oct 28 01:50:31 2011
@@ -1,7 +1,7 @@
 /* Handle conversion from binary float (32) to Decimal32
 
    Copyright (C) 2007, 2008 IBM Corporation.
-   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
 
    This file is part of the Decimal Floating Point C Library.
 
@@ -33,6 +33,7 @@
 #include "fenv_libdfp.h"
 #include "dfpacc.h"
 #include "convert.h"
+#include <float.h> /* To pick up __FLT_MANT_DIG__  */
 
 #if DEST==32
 #define TEMP_TYPE	_Decimal64
@@ -49,7 +50,8 @@
 
 	a_norm = FREXPSF (a, &exp);
 	mant = a_norm * 16777216.0;	/* 24 bits of mantissa.  */
-	sexp = exp - 24;		/* Exponent adjusted for mantissa.  */
+	//sexp = exp - 24;		/* Exponent adjusted for mantissa.  */
+	sexp = exp - __FLT_MANT_DIG__;	/* Exponent adjusted for mantissa.  */
 	temp = mant;
 	if (sexp > 0)
 		temp *= DECPOWOF2[sexp];

Modified: libdfp/trunk/sysdeps/soft-dfp/truncdfsd.c
==============================================================================
--- libdfp/trunk/sysdeps/soft-dfp/truncdfsd.c (original)
+++ libdfp/trunk/sysdeps/soft-dfp/truncdfsd.c Fri Oct 28 01:50:31 2011
@@ -1,7 +1,7 @@
 /* Handle conversion from binary double (64) to Decimal32
 
    Copyright (C) 2007, 2008 IBM Corporation.
-   Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
 
    This file is part of the Decimal Floating Point C Library.
 
@@ -32,6 +32,7 @@
 
 #include "dfpacc.h"
 #include "convert.h"
+#include <float.h> /* To pick up __DBL_MANT_DIG__  */
 
 CONVERT_WRAPPER(
 // truncdfsd, extenddfdd, extenddftd
@@ -42,7 +43,8 @@
 
 	a_norm = FREXPDF (a, &exp);
 	mant = a_norm * 9007199254740992.0;	/* 53 bits of mantissa.  */
-	sexp = exp - 53;			/* Exponent adjusted for mantissa.  */
+	//sexp = exp - 53;			/* Exponent adjusted for mantissa.  */
+	sexp = exp - __DBL_MANT_DIG__;		/* Exponent adjusted for mantissa.  */
 	temp = mant;				/* DI -> TD.  */
 	if (sexp > 0)
 		temp *= DECPOWOF2[sexp];

Added: libdfp/trunk/tests/test-bfp-conversions.c
==============================================================================
--- libdfp/trunk/tests/test-bfp-conversions.c (added)
+++ libdfp/trunk/tests/test-bfp-conversions.c Fri Oct 28 01:50:31 2011
@@ -1,0 +1,125 @@
+/* Test bfp -> dfp and dfp -> bfp conversions
+
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This file is part of the Decimal Floating Point C Library.
+
+   Author(s): Ryan S. Arnold <rsa@xxxxxxxxxx>
+
+   The Decimal Floating Point C Library is free software; you can
+   redistribute it and/or modify it under the terms of the GNU Lesser
+   General Public License version 2.1.
+
+   The Decimal Floating Point 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 version 2.1 for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License version 2.1 along with the Decimal Floating Point C Library;
+   if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+   Suite 330, Boston, MA 02111-1307 USA.
+
+   Please see libdfp/COPYING.txt for more information.  */
+
+#ifndef __STDC_WANT_DEC_FP__
+#define __STDC_WANT_DEC_FP__
+#endif
+
+
+#define _WANT_VC 1 /* Pick up the _VC_P(x,y,fmt) macro.  */
+#include "scaffold.c" /* Pick up the _VC_P(x,y,fmt) macro.  */
+
+/* Inspired by GLIBC stdio-common/tfformat.c  */
+
+/* Test extendsfsd () - Single float to single decimal conversions,
+ * i.e., float -> _Decimal32.  */
+typedef struct{
+  int line;
+  float x;       /* sf 'single float' value to convert.  */
+  _Decimal32 e;  /* sd 'single decimal' converted value.  */
+  const char *format; /* printf %Hf */
+} sfsd_type;
+
+sfsd_type sfsd_tests[] =
+{
+  {__LINE__, 12.345, 12.345DF,  "%He"},
+  {__LINE__, 12.345678, 12.345678DF,  "%He"},
+  {__LINE__, 123456.7, 123456.7DF,  "%He"},
+  {__LINE__, 999999.9, 999999.9DF,  "%He"},
+  {0,0,0,0 }
+};
+
+
+/* Test extendsfdd () - Single float to double decimal conversions,
+ * i.e., float -> _Decimal64.  */
+typedef struct{
+  int line;
+  float x;       /* sf 'single float' value to convert.  */
+  _Decimal64 e;  /* dd 'double decimal' converted value.  */
+  const char *format; /* printf %Df */
+} sfdd_type;
+
+sfdd_type sfdd_tests[] =
+{
+  {__LINE__, 12.345, 12.345DD,  "%.De"},
+  {0,0,0,0 }
+};
+
+/* Test extendsftd () - Single float to quad decimal conversions,
+ * i.e., float -> _Decimal128.  */
+typedef struct{
+  int line;
+  float x;       /* sf 'single float' value to convert.  */
+  _Decimal128 e;  /* td 'quad decimal' converted value.  */
+  const char *format; /* printf %DDf */
+} sftd_type;
+
+sftd_type sftd_tests[] =
+{
+  {__LINE__, 12.345, 12.345DL,  "%DDe"},
+  {0,0,0,0 }
+};
+
+int main (void)
+{
+  sfsd_type *sfsdp;
+  sfdd_type *sfddp;
+  sftd_type *sftdp;
+
+#include "decode.h"
+  char buf[256];
+
+  for (sfsdp = sfsd_tests; sfsdp->line; sfsdp++)
+    {
+      /* This will force the conversion and result in the hidden call to
+       * __dpd_extendsfsd ().  */
+      _Decimal32 retval = sfsdp->x;
+      /* Broken into two because printf has a bug when you do %Hf and %f in the
+       * same printf statement.  */
+      fprintf(stdout, "%He = (_Decimal32) ", retval);
+      fprintf(stdout, "%f; /* float */ in: %s: %d\n", (double) sfsdp->x,__FILE__,__LINE__-4);
+      fprintf(stdout, "expected: %s\n", decoded32(sfsdp->e,buf));
+      fprintf(stdout, "retval:   %s\n", decoded32(retval,buf));
+      _VC_P(__FILE__,sfsdp->line, sfsdp->e, retval, sfsdp->format);
+    }
+
+  for (sfddp = sfdd_tests; sfddp->line; sfddp++)
+    {
+      /* This will force the conversion and result in the hidden call to
+       * __dpd_extendsfdd ().  */
+      _Decimal64 retval = sfddp->x;
+      float f = retval;
+      /* Broken into two because printf has a bug when you do %Hf and %f in the
+       * same printf statement.  */
+      fprintf(stdout, "%De = (_Decimal64)", retval);
+      fprintf(stdout, "%f; /* float */ in: %s: %d\n", (double) sfddp->x,__FILE__,__LINE__-4);
+      fprintf(stdout, "expected: %s\n", decoded64(sfddp->e,buf));
+      fprintf(stdout, "retval:   %s\n", decoded64(retval,buf));
+      _VC_P(__FILE__,sfddp->line, sfddp->e, retval, sfddp->format);
+    }
+
+
+
+}
+

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits