activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r563235 - in /activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang: Math.cpp Math.h
Date Mon, 06 Aug 2007 19:42:32 GMT
Author: tabish
Date: Mon Aug  6 12:42:32 2007
New Revision: 563235

URL: http://svn.apache.org/viewvc?view=rev&rev=563235
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103

Implementing the Primitive Wrappers fully

Modified:
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.cpp
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.h

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.cpp?view=diff&rev=563235&r1=563234&r2=563235
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.cpp (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.cpp Mon Aug  6 12:42:32
2007
@@ -17,10 +17,31 @@
 
 #include "Math.h"
 
+#include <decaf/lang/Double.h>
+#include <decaf/lang/Float.h>
+#include <decaf/lang/Integer.h>
+#include <decaf/lang/Long.h>
+
 using namespace decaf;
 using namespace decaf::lang;
 
+#include <cmath>
+#include <cstdlib>
+
 ////////////////////////////////////////////////////////////////////////////////
 const double Math::E = 2.718281828459045;
 const double Math::PI = 3.141592653589793;
 
+////////////////////////////////////////////////////////////////////////////////
+double Math::log( double value ) {
+
+    if( value != value || value < 0.0 ) {
+        return Double::NaN;
+    } else if( value == Double::POSITIVE_INFINITY ) {
+        return Double::POSITIVE_INFINITY;
+    } else if( value == 0.0 || value == -0.0 ) {
+        return Double::NEGATIVE_INFINITY;
+    }
+
+    return std::log( value );
+}

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.h?view=diff&rev=563235&r1=563234&r2=563235
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang/Math.h Mon Aug  6 12:42:32 2007
@@ -96,6 +96,20 @@
             return ( a >= b ? a : b );
         }
 
+        /**
+         * Returns the natural logarithm (base e) of a double  value. Special cases:
+         *
+         *  o If the argument is NaN or less than zero, then the result is NaN.
+         *  o If the argument is positive infinity, then the result is
+         *    positive infinity.
+         *  o If the argument is positive zero or negative zero, then the result
+         *    is negative infinity.
+         *
+         * @param value the value to compute the natural log of.
+         * @returns the natural log of value.
+         */
+        static double log( double value );
+
     };
 
 }}



Mime
View raw message