You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/08/07 02:03:10 UTC
svn commit: r563348 - in
/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/lang: Math.cpp Math.h
Author: tabish
Date: Mon Aug 6 17:03:08 2007
New Revision: 563348
URL: http://svn.apache.org/viewvc?view=rev&rev=563348
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103
Adding in more Types wrappers
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=563348&r1=563347&r2=563348
==============================================================================
--- 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 17:03:08 2007
@@ -45,3 +45,29 @@
return std::log( value );
}
+
+////////////////////////////////////////////////////////////////////////////////
+double Math::ceil( double value ) {
+
+ if( Double::isNaN( value ) || Double::isInfinite( value ) ) {
+ return value;
+ } else if( value == 0.0 || value == -0.0 ) {
+ return value;
+ } else if( -1.0 <= value <= 0.0 ) {
+ return -0.0;
+ }
+
+ return std::ceil( value );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+double Math::floor( double value ) {
+
+ if( Double::isNaN( value ) || Double::isInfinite( value ) ) {
+ return value;
+ } else if( value == 0.0 || value == -0.0 ) {
+ return value;
+ }
+
+ return std::floor( 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=563348&r1=563347&r2=563348
==============================================================================
--- 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 17:03:08 2007
@@ -110,6 +110,43 @@
*/
static double log( double value );
+ /**
+ * Returns the smallest (closest to negative infinity) double value that is
+ * greater than or equal to the argument and is equal to a mathematical
+ * integer. Special cases:
+ *
+ * o If the argument value is already equal to a mathematical integer,
+ * then the result is the same as the argument.
+ * o If the argument is NaN or an infinity or positive zero or negative
+ * zero, then the result is the same as the argument.
+ * o If the argument value is less than zero but greater than -1.0, then
+ * the result is negative zero.
+ *
+ * Note that the value of Math.ceil(x) is exactly the value of -Math.floor(-x).
+ * @param value - the value to find the ceiling of
+ * @returns the smallest (closest to negative infinity) floating-point value
+ * that is greater than or equal to the argument and is equal to a
+ * mathematical integer.
+ */
+ static double ceil( double value );
+
+ /**
+ * Returns the largest (closest to positive infinity) double value that is
+ * less than or equal to the argument and is equal to a mathematical integer.
+ * Special cases:
+ *
+ * o If the argument value is already equal to a mathematical integer,
+ * then the result is the same as the argument.
+ * o If the argument is NaN or an infinity or positive zero or negative
+ * zero, then the result is the same as the argument.
+ *
+ * @param value - the value to find the floor of
+ * @returns the largest (closest to positive infinity) floating-point value
+ * that less than or equal to the argument and is equal to a mathematical
+ * integer.
+ */
+ static double floor( double value );
+
};
}}