You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2008/05/12 17:03:07 UTC

svn commit: r655511 - /stdcxx/branches/4.2.x/tests/support/18.numeric.special.float.cpp

Author: faridz
Date: Mon May 12 08:03:07 2008
New Revision: 655511

URL: http://svn.apache.org/viewvc?rev=655511&view=rev
Log:
2008-05-12  Farid Zaripov  <fa...@epam.com>

	Merged r655509 from trunk with a fix for STDCXX-897.
	* tests/support/18.numeric.special.float.cpp [_MSC_VER] (_fpclass): Provide _fpclass() overloads
	for float and long double types, since the MSVC provides this function for double type only.
	(has_denorm): Add _MSC_VER in the list of platforms where denormalized value are present.

Modified:
    stdcxx/branches/4.2.x/tests/support/18.numeric.special.float.cpp

Modified: stdcxx/branches/4.2.x/tests/support/18.numeric.special.float.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/support/18.numeric.special.float.cpp?rev=655511&r1=655510&r2=655511&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/tests/support/18.numeric.special.float.cpp (original)
+++ stdcxx/branches/4.2.x/tests/support/18.numeric.special.float.cpp Mon May 12 08:03:07 2008
@@ -157,6 +157,34 @@
 
 /***********************************************************************/
 
+#ifdef _MSC_VER
+
+inline int _fpclass (float val)
+{
+    long lval = *_RWSTD_REINTERPRET_CAST (long*, &val);
+
+    if (0 == (lval & 0x7FFFFFFF))
+        return lval ? _FPCLASS_NZ : _FPCLASS_PZ;
+
+    if (0 == (lval & 0x7F800000))
+        return (lval & 0x80000000) ? _FPCLASS_ND : _FPCLASS_PD;
+
+    if (0x7F800000 == (lval & 0x7FFFFFFF))
+        return (lval & 0x80000000) ? _FPCLASS_NINF : _FPCLASS_PINF;
+
+    if (0x7F800000 == (lval & 0x7F800000))
+        return (lval & 0x00400000) ? _FPCLASS_QNAN : _FPCLASS_SNAN;
+
+    return (lval & 0x80000000) ? _FPCLASS_NN : _FPCLASS_PN;
+}
+
+inline int _fpclass (long double val)
+{
+    return _fpclass (double (val));
+}
+
+#endif
+
 template <class FloatT>
 void test_infinity (FloatT inf, FloatT max, const char *tname)
 {
@@ -451,9 +479,10 @@
 
     static std::float_denorm_style has_denorm () {
 
-#if defined (_AIX) \
-    || defined (__hpux) \
-    || defined (__osf__)
+#if defined (_AIX)       \
+    || defined (__hpux)  \
+    || defined (__osf__) \
+    || defined (_MSC_VER)
         return std::denorm_present;
 #else
         return std::denorm_indeterminate;
@@ -718,9 +747,10 @@
 
 
     static std::float_denorm_style has_denorm () {
-#if defined (_AIX) \
-    || defined (__hpux) \
-    || defined (__osf__)
+#if defined (_AIX)       \
+    || defined (__hpux)  \
+    || defined (__osf__) \
+    || defined (_MSC_VER)
         return std::denorm_present;
 #else
         return std::denorm_indeterminate;
@@ -978,9 +1008,10 @@
 
 
     static std::float_denorm_style has_denorm () {
-#if defined (_AIX) \
-    || defined (__hpux) \
-    || defined (__osf__)
+#if defined (_AIX)       \
+    || defined (__hpux)  \
+    || defined (__osf__) \
+    || defined (_MSC_VER)
         return std::denorm_present;
 #else
         return std::denorm_indeterminate;