stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r655512 - /stdcxx/branches/4.3.x/tests/support/18.numeric.special.float.cpp
Date Mon, 12 May 2008 15:03:31 GMT
Author: faridz
Date: Mon May 12 08:03:31 2008
New Revision: 655512

URL: http://svn.apache.org/viewvc?rev=655512&view=rev
Log:
2008-05-12  Farid Zaripov  <farid_zaripov@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.3.x/tests/support/18.numeric.special.float.cpp

Modified: stdcxx/branches/4.3.x/tests/support/18.numeric.special.float.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/support/18.numeric.special.float.cpp?rev=655512&r1=655511&r2=655512&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/support/18.numeric.special.float.cpp (original)
+++ stdcxx/branches/4.3.x/tests/support/18.numeric.special.float.cpp Mon May 12 08:03:31 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;



Mime
View raw message