Author: tabish
Date: Tue Apr 15 06:47:58 2008
New Revision: 648252
URL: http://svn.apache.org/viewvc?rev=648252&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-164
Forcing certain methods in Math to not be built on Windows since there are no libraries on
windows that include these math functions.
Modified:
activemq/activemq-cpp/decaf/trunk/src/main/decaf/lang/Math.cpp
activemq/activemq-cpp/decaf/trunk/src/main/decaf/lang/Math.h
activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.cpp
activemq/activemq-cpp/decaf/trunk/src/test/decaf/lang/MathTest.cpp
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/lang/Math.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/lang/Math.cpp?rev=648252&r1=648251&r2=648252&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/lang/Math.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/lang/Math.cpp Tue Apr 15 06:47:58 2008
@@ -70,6 +70,7 @@
}
////////////////////////////////////////////////////////////////////////////////
+#ifndef _WIN32
double Math::cbrt( double value ) {
if( Double::isNaN( value ) ) {
@@ -80,12 +81,9 @@
return value;
}
-#if defined(_WIN32)
- return 0;
-#else
return ::cbrt( value );
-#endif
}
+#endif
////////////////////////////////////////////////////////////////////////////////
double Math::cos( double value ) {
@@ -180,6 +178,7 @@
}
////////////////////////////////////////////////////////////////////////////////
+#ifndef _WIN32
double Math::rint( double value ) {
if( Double::isNaN( value ) || Double::isInfinite( value ) ) {
@@ -188,12 +187,9 @@
return value;
}
-#if defined(_WIN32)
- return 0;
-#else
return ::rint( value );
-#endif
}
+#endif
////////////////////////////////////////////////////////////////////////////////
double Math::exp( double value ) {
@@ -210,6 +206,7 @@
}
////////////////////////////////////////////////////////////////////////////////
+#ifndef _WIN32
double Math::expm1( double value ) {
if( Double::isNaN( value ) ) {
@@ -222,12 +219,9 @@
return value;
}
-#if defined(_WIN32)
- return 0;
-#else
return ::expm1( value );
-#endif
}
+#endif
////////////////////////////////////////////////////////////////////////////////
float Math::min( float a, float b ) {
@@ -351,6 +345,7 @@
}
////////////////////////////////////////////////////////////////////////////////
+#ifndef _WIN32
double Math::log1p( double value ) {
if( Double::isNaN( value ) || value < -1.0 ) {
@@ -363,12 +358,9 @@
return value;
}
-#if defined(_WIN32)
- return 0;
-#else
return ::log1p( value );
-#endif
}
+#endif
////////////////////////////////////////////////////////////////////////////////
double Math::ceil( double value ) {
@@ -418,6 +410,7 @@
}
////////////////////////////////////////////////////////////////////////////////
+#ifndef _WIN32
double Math::IEEEremainder( double f1, double f2 ) {
if( Double::isNaN( f1 ) || Double::isNaN( f2 ) ||
@@ -427,12 +420,9 @@
return f1;
}
-#if defined(_WIN32)
- return 0;
-#else
return ::remainder( f1, f2 );
-#endif
}
+#endif
////////////////////////////////////////////////////////////////////////////////
float Math::signum( float value ) {
@@ -489,6 +479,7 @@
}
////////////////////////////////////////////////////////////////////////////////
+#ifndef _WIN32
float Math::ulp( float value ) {
if( Float::isNaN( value ) ) {
@@ -502,14 +493,12 @@
}
value = abs( value );
-#if defined(_WIN32)
- return 0;
-#else
return ::nextafterf( value, Float::MAX_VALUE ) - value;
-#endif
}
+#endif
////////////////////////////////////////////////////////////////////////////////
+#ifndef _WIN32
double Math::ulp( double value ) {
if( Double::isNaN( value ) ) {
@@ -523,9 +512,6 @@
}
value = abs( value );
-#if defined(_WIN32)
- return 0;
-#else
return ::nextafter( value, Double::MAX_VALUE ) - value;
-#endif
}
+#endif
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/lang/Math.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/lang/Math.h?rev=648252&r1=648251&r2=648252&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/lang/Math.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/lang/Math.h Tue Apr 15 06:47:58 2008
@@ -201,7 +201,9 @@
* @param value - the double to compute the cube root of
* @returns the cube root of value
*/
+ #ifndef _WIN32
static double cbrt( double value );
+ #endif
/**
* Returns the trigonometric cosine of an angle. Special cases:
@@ -332,7 +334,9 @@
* @param value - the value to round to the nearest integer
* @returns the rounded value
*/
+ #ifndef _WIN32
static double rint( double value );
+ #endif
/**
* Returns the smaller of two <code>short</code> values. That is,
@@ -526,7 +530,9 @@
* @param value - the value to operate on
* @returns the the value ln(x + 1), the natural log of x + 1
*/
+ #ifndef _WIN32
static double log1p( double value );
+ #endif
/**
* Returns the smallest (closest to negative infinity) double value that is
@@ -622,7 +628,9 @@
* @param f2 - the divisor
* @return the IEEE remainder of value
*/
+ #ifndef _WIN32
static double IEEEremainder( double f1, double f2 );
+ #endif
/**
* Returns a double value with a positive sign, greater than or equal to 0.0
@@ -669,7 +677,9 @@
* @param the value to raise e^x - 1
* @returns the value ex - 1.
*/
+ #ifndef _WIN32
static double expm1( double value );
+ #endif
/**
* Returns sqrt(x^2 + y^2) without intermediate overflow or underflow.
@@ -747,7 +757,9 @@
* @param value - the floating-point value whose ulp is to be returned
* @returns the size of an ulp of the argument
*/
+ #ifndef _WIN32
static float ulp( float value );
+ #endif
/**
* Returns the size of an ulp of the argument. An ulp of a double value is
@@ -765,8 +777,9 @@
* @param value - the floating-point value whose ulp is to be returned
* @returns the size of an ulp of the argument
*/
+ #ifndef _WIN32
static double ulp( double value );
-
+ #endif
};
}}
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.cpp?rev=648252&r1=648251&r2=648252&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.cpp
(original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/internal/nio/FloatArrayBufferTest.cpp
Tue Apr 15 06:47:58 2008
@@ -509,7 +509,7 @@
for( std::size_t i = 0; i < testBuffer1->capacity(); i++ ) {
CPPUNIT_ASSERT( testBuffer1->position() == 0 );
- FloatBuffer& ret = testBuffer1->put(i, i );
+ FloatBuffer& ret = testBuffer1->put(i, (float)i );
CPPUNIT_ASSERT( testBuffer1->get(i) == i );
CPPUNIT_ASSERT( &ret == testBuffer1 );
}
Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/lang/MathTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/lang/MathTest.cpp?rev=648252&r1=648251&r2=648252&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/lang/MathTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/lang/MathTest.cpp Tue Apr 15 06:47:58
2008
@@ -106,6 +106,7 @@
////////////////////////////////////////////////////////////////////////////////
void MathTest::test_cbrt_D() {
//Test for special situations
+#ifndef _WIN32
CPPUNIT_ASSERT_MESSAGE("Should return Double::NaN",
Double::isNaN(Math::cbrt(Double::NaN)));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return Double::POSITIVE_INFINITY",
@@ -129,6 +130,7 @@
CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.7031839360032603E-108",
1.7031839360032603E-108, Math::cbrt(Double::MIN_VALUE));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return -0.01", -0.01, Math::cbrt(-0.000001));
+#endif
}
////////////////////////////////////////////////////////////////////////////////
@@ -187,6 +189,8 @@
////////////////////////////////////////////////////////////////////////////////
void MathTest::test_expm1_D() {
+
+#ifndef _WIN32
// Test for special cases
CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::expm1(Double::NaN)));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return POSITIVE_INFINITY",
@@ -211,6 +215,7 @@
Double::POSITIVE_INFINITY, Math::expm1(Double::MAX_VALUE));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return MIN_VALUE", Double::MIN_VALUE,
Math::expm1(Double::MIN_VALUE));
+#endif
}
////////////////////////////////////////////////////////////////////////////////
@@ -252,20 +257,24 @@
2396424.905416697, Math::hypot(12322.12, -2396393.2258));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 138.16958070558556", 138.16958070558556,
Math::hypot(-138.16951162, 0.13817035864));
+#ifndef _WIN32
CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 1.7976931348623157E308",
1.7976931348623157E308, Math::hypot(Double::MAX_VALUE, 211370.35));
+#endif
CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return 5413.7185", 5413.7185, Math::hypot(
-5413.7185, Double::MIN_VALUE));
}
////////////////////////////////////////////////////////////////////////////////
void MathTest::test_IEEEremainderDD() {
+#ifndef _WIN32
// Test for method double decaf.lang.Math::IEEEremainder(double, double)
CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect remainder returned",
0.0, Math::IEEEremainder(1.0, 1.0));
CPPUNIT_ASSERT_MESSAGE("Incorrect remainder returned",
Math::IEEEremainder(1.32,89.765) >= 1.4705063220631647E-2 ||
Math::IEEEremainder(1.32, 89.765) >= 1.4705063220631649E-2);
+#endif
}
////////////////////////////////////////////////////////////////////////////////
@@ -302,6 +311,7 @@
////////////////////////////////////////////////////////////////////////////////
void MathTest::test_log1p_D() {
+#ifndef _WIN32
// Test for special cases
CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::log1p(Double::NaN)));
CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::log1p(-32.0482175)));
@@ -324,6 +334,7 @@
Math::log1p(Double::MAX_VALUE));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Should return Double::MIN_VALUE", Double::MIN_VALUE,
Math::log1p(Double::MIN_VALUE));
+#endif
}
////////////////////////////////////////////////////////////////////////////////
@@ -426,6 +437,7 @@
////////////////////////////////////////////////////////////////////////////////
void MathTest::test_rintD() {
+#ifndef _WIN32
// Test for method double decaf.lang.Math::rint(double)
CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to round properly - up to odd",
3.0, Math::rint(2.9));
@@ -435,6 +447,7 @@
2.0, Math::rint(2.1));
CPPUNIT_ASSERT_MESSAGE("Failed to round properly to even",
Math::rint(2.5) == 2.0);
+#endif
}
////////////////////////////////////////////////////////////////////////////////
@@ -618,6 +631,7 @@
////////////////////////////////////////////////////////////////////////////////
void MathTest::test_ulp_D() {
+#ifndef _WIN32
// Test for special cases
CPPUNIT_ASSERT_MESSAGE("Should return NaN", Double::isNaN(Math::ulp(Double::NaN)));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", Double::POSITIVE_INFINITY,
@@ -646,11 +660,12 @@
Math::ulp(-1.0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value", 2.2737367544323206E-13,
Math::ulp(1153.0));
+#endif
}
////////////////////////////////////////////////////////////////////////////////
void MathTest::test_ulp_f() {
-
+#ifndef _WIN32
// Test for special cases
CPPUNIT_ASSERT_MESSAGE("Should return NaN", Float::isNaN(Math::ulp(Float::NaN)));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
@@ -681,5 +696,6 @@
1.2207031E-4f, Math::ulp(1153.0f));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Returned incorrect value",
5.6E-45f, Math::ulp(9.403954E-38f) );
+#endif
}
|