harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r442112 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/lang/ main/native/luni/linux/ main/native/luni/shared/ main/native/luni/windows/ test/java/org/apache/harmony/luni/tests/java/lang/
Date Mon, 11 Sep 2006 06:37:29 GMT
Author: pyang
Date: Sun Sep 10 23:37:28 2006
New Revision: 442112

URL: http://svn.apache.org/viewvc?view=rev&rev=442112
Log:
Patch applied for HARMONY-1415 ([classlib][luni] new method java.lang.Math.expm1, java.lang.Math.hypot,java.lang.Math.log1p,
java.lang.StrictMath.expm1, java.lang.StrictMath.hypot,java.lang.StrictMath.log10, java.lang.StrictMath.log1p)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Math.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/StrictMath.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/libhyluni.exp
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/math.c
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/hyluni.def
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/MathTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StrictMathTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Math.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Math.java?view=diff&rev=442112&r1=442111&r2=442112
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Math.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/Math.java
Sun Sep 10 23:37:28 2006
@@ -178,6 +178,21 @@
 	 * @return the exponential of the argument.
 	 */
 	public static native double exp(double d);
+    
+    /**
+     * Answers the closest double approximation of <i>e</i><sup>d</sup>
- 1.
+     * If the argument is very close to 0, it is much more accurate to use
+     * expm1(d)+1 than exp(d).
+     * 
+     * The final result should be within 1 ulp of the real result. For any
+     * finite input, the result should be no less than -1.0. If the real result
+     * is within 0.5 ulp of -1, -1.0 should be answered.
+     * 
+     * @param d
+     *            the value to compute the <i>e</i><sup>d</sup> -
1 of
+     * @return the <i>e</i><sup>d</sup> - 1 value of the argument.
+     */
+    public static native double expm1(double d);
 
 	/**
 	 * Answers the double conversion of the most positive (i.e. closest to
@@ -188,6 +203,22 @@
 	 * @return the ceiling of the argument.
 	 */
 	public static native double floor(double d);
+    
+    /**
+     * Answers sqrt(<i>x</i><sup>2</sup>+<i>y</i><sup>2</sup>).
The
+     * final result is without medium underflow or overflow.
+     * 
+     * The final result should be within 1 ulp of the real result. If one
+     * parameter remains constant, the result should be semi-monotonic.
+     * 
+     * @param x
+     *            a double number
+     * @param y
+     *            a double number
+     * @return the sqrt(<i>x</i><sup>2</sup>+<i>y</i><sup>2</sup>)
value
+     *         of the arguments.
+     */
+    public static native double hypot(double x, double y);
 
 	/**
 	 * Answers the remainder of dividing the first argument by the second using
@@ -223,6 +254,20 @@
         //TODO: this is a stub to integrate HARMONY-935
         return log(d)/log(10);
     }
+    
+    /**
+     * Answers the closest double approximation of the natural logarithm of the
+     * sum of the argument and 1. If the argument is very close to 0, it is much
+     * more accurate to use log1p(d) than log(1.0+d).
+     * 
+     * The final result should be within 1 ulp of the real result and be
+     * semi-monotonic.
+     * 
+     * @param d
+     *            the value to compute the ln(1+d) of
+     * @return the natural logarithm of the sum of the argument and 1.
+     */
+    public static native double log1p(double d);
 
 	/**
 	 * Answers the most positive (i.e. closest to positive infinity) of the two

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/StrictMath.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/StrictMath.java?view=diff&rev=442112&r1=442111&r2=442112
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/StrictMath.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/lang/StrictMath.java
Sun Sep 10 23:37:28 2006
@@ -184,6 +184,17 @@
 	 * @return the exponential of the argument.
 	 */
 	public static native double exp(double d);
+    
+    /**
+     * Answers the closest double approximation of <i>e</i><sup>d</sup>
- 1.
+     * If the argument is very close to 0, it is much more accurate to use
+     * expm1(d)+1 than exp(d).
+     * 
+     * @param d
+     *            the value to compute the <i>e</i><sup>d</sup> -
1 of
+     * @return the <i>e</i><sup>d</sup> - 1 value of the argument.
+     */
+    public static native double expm1(double d);
 
 	/**
 	 * Answers the double conversion of the most positive (i.e. closest to
@@ -195,6 +206,19 @@
 	 * @return the ceiling of the argument.
 	 */
 	public static native double floor(double d);
+    
+    /**
+     * Answers sqrt(<i>x</i><sup>2</sup>+<i>y</i><sup>2</sup>).
The
+     * final result is without medium underflow or overflow.
+     * 
+     * @param x
+     *            a double number
+     * @param y
+     *            a double number
+     * @return the sqrt(<i>x</i><sup>2</sup>+<i>y</i><sup>2</sup>)
value
+     *         of the arguments.
+     */
+    public static native double hypot(double x, double y);
 
 	/**
 	 * Answers the remainder of dividing the first argument by the second using
@@ -217,6 +241,26 @@
 	 * @return the natural logarithm of the argument.
 	 */
 	public static native double log(double d);
+    
+    /**
+     * Answers the logarithm of the argument and the base is 10.
+     * 
+     * @param d
+     *            the value to compute the base 10 log of
+     * @return the base 10 logarithm of the argument.
+     */
+    public static native double log10(double d);
+    
+    /**
+     * Answers the closest double approximation of the natural logarithm of the
+     * sum of the argument and 1. If the argument is very close to 0, it is much
+     * more accurate to use log1p(d) than log(1.0+d).
+     * 
+     * @param d
+     *            the value to compute the ln(1+d) of
+     * @return the natural logarithm of the sum of the argument and 1.
+     */
+    public static native double log1p(double d);
 
 	/**
 	 * Answers the most positive (i.e. closest to positive infinity) of the two

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/libhyluni.exp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/libhyluni.exp?view=diff&rev=442112&r1=442111&r2=442112
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/libhyluni.exp
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/libhyluni.exp
Sun Sep 10 23:37:28 2006
@@ -99,9 +99,12 @@
 		Java_java_lang_Math_cos;
 		Java_java_lang_Math_cosh;
 		Java_java_lang_Math_exp;
+		Java_java_lang_Math_expm1;
 		Java_java_lang_Math_floor;
+		Java_java_lang_Math_hypot;
 		Java_java_lang_Math_IEEEremainder;
 		Java_java_lang_Math_log;
+		Java_java_lang_Math_log1p;
 		Java_java_lang_Math_pow;
 		Java_java_lang_Math_rint;
 		Java_java_lang_Math_sin;
@@ -119,9 +122,13 @@
 		Java_java_lang_StrictMath_cos;
 		Java_java_lang_StrictMath_cosh;
 		Java_java_lang_StrictMath_exp;
+		Java_java_lang_StrictMath_expm1;
 		Java_java_lang_StrictMath_floor;
+		Java_java_lang_StrictMath_hypot;
 		Java_java_lang_StrictMath_IEEEremainder;
 		Java_java_lang_StrictMath_log;
+		Java_java_lang_StrictMath_log10;
+		Java_java_lang_StrictMath_log1p;
 		Java_java_lang_StrictMath_pow;
 		Java_java_lang_StrictMath_rint;
 		Java_java_lang_StrictMath_sin;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/math.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/math.c?view=diff&rev=442112&r1=442111&r2=442112
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/math.c
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/math.c
Sun Sep 10 23:37:28 2006
@@ -40,6 +40,10 @@
 jdouble internal_sinh (jdouble arg1);
 jdouble internal_cosh (jdouble arg1);
 jdouble internal_tanh (jdouble arg1);
+jdouble internal_expm1(jdouble arg1);
+jdouble internal_hypot(jdouble arg1, jdouble arg2);
+jdouble internal_log1p(jdouble arg1);
+jdouble internal_log10(jdouble arg1);
 
 extern scaleUpDouble (double *, int);
 
@@ -146,6 +150,16 @@
 }
 
 jdouble
+internal_expm1 (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_expm1 (arg1);
+
+  return result;
+}
+
+jdouble
 internal_floor (jdouble arg1)
 {
   jdouble result;
@@ -156,6 +170,16 @@
 }
 
 jdouble
+internal_hypot (jdouble arg1, jdouble arg2)
+{
+  jdouble result;
+
+  result = fdlibm_hypot (arg1, arg2);
+
+  return result;
+}
+
+jdouble
 internal_IEEEremainder (jdouble arg1, jdouble arg2)
 {
   jdouble result;
@@ -176,6 +200,26 @@
 }
 
 jdouble
+internal_log10 (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_log10 (arg1);
+
+  return result;
+}
+
+jdouble
+internal_log1p (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_log1p (arg1);
+
+  return result;
+}
+
+jdouble
 internal_pow (jdouble arg1, jdouble arg2)
 {
   jdouble result;
@@ -345,6 +389,18 @@
 }
 
 jdouble JNICALL
+Java_java_lang_StrictMath_expm1 (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_expm1 (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_expm1 (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_expm1 (arg1);
+}
+
+jdouble JNICALL
 Java_java_lang_StrictMath_floor (JNIEnv * env, jclass jclazz, jdouble arg1)
 {
   return internal_floor (arg1);
@@ -357,6 +413,20 @@
 }
 
 jdouble JNICALL
+Java_java_lang_StrictMath_hypot (JNIEnv * env, jclass jclazz,
+                                         jdouble arg1, jdouble arg2)
+{
+  return internal_hypot (arg1, arg2);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_hypot (JNIEnv * env, jclass jclazz, jdouble arg1,
+                                   jdouble arg2)
+{
+  return internal_hypot (arg1, arg2);
+}
+
+jdouble JNICALL
 Java_java_lang_StrictMath_IEEEremainder (JNIEnv * env, jclass jclazz,
                                          jdouble arg1, jdouble arg2)
 {
@@ -381,6 +451,26 @@
 {
   return internal_log (arg1);
 }
+
+jdouble JNICALL
+Java_java_lang_StrictMath_log10 (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_log10 (arg1);
+}
+
+
+jdouble JNICALL
+Java_java_lang_StrictMath_log1p (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_log1p (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_log1p(JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_log1p (arg1);
+}
+
 
 jdouble JNICALL
 Java_java_lang_StrictMath_pow (JNIEnv * env, jclass jclazz, jdouble arg1,

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/hyluni.def
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/hyluni.def?view=diff&rev=442112&r1=442111&r2=442112
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/hyluni.def
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/hyluni.def
Sun Sep 10 23:37:28 2006
@@ -92,9 +92,12 @@
 	Java_java_lang_Math_cos
 	Java_java_lang_Math_cosh
 	Java_java_lang_Math_exp
+	Java_java_lang_Math_expm1
 	Java_java_lang_Math_floor
+	Java_java_lang_Math_hypot
 	Java_java_lang_Math_IEEEremainder
 	Java_java_lang_Math_log
+	Java_java_lang_Math_log1p
 	Java_java_lang_Math_pow
 	Java_java_lang_Math_rint
 	Java_java_lang_Math_sin
@@ -112,9 +115,13 @@
 	Java_java_lang_StrictMath_cos
 	Java_java_lang_StrictMath_cosh
 	Java_java_lang_StrictMath_exp
+	Java_java_lang_StrictMath_expm1	
 	Java_java_lang_StrictMath_floor
+	Java_java_lang_StrictMath_hypot	
 	Java_java_lang_StrictMath_IEEEremainder
 	Java_java_lang_StrictMath_log
+	Java_java_lang_StrictMath_log10	
+	Java_java_lang_StrictMath_log1p	
 	Java_java_lang_StrictMath_pow
 	Java_java_lang_StrictMath_rint
 	Java_java_lang_StrictMath_sin

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/MathTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/MathTest.java?view=diff&rev=442112&r1=442111&r2=442112
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/MathTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/MathTest.java
Sun Sep 10 23:37:28 2006
@@ -214,10 +214,38 @@
 		assertTrue("Incorrect answer returned for larger power", Math.log(Math
 				.abs(Math.exp(5.5D)) - 5.5D) < 10.0D);
 	}
+    
+    /**
+     * @tests java.lang.Math#expm1(double)
+     */
+    @SuppressWarnings("boxing")
+    public void test_expm1_D() {
+        // Test for special cases
+        assertEquals("Should return NaN", Double.NaN, Math.expm1(Double.NaN));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.expm1(Double.POSITIVE_INFINITY));
+        assertEquals("Should return -1.0", -1.0, Math
+                .expm1(Double.NEGATIVE_INFINITY));
+        assertEquals("Should return 0.0", 0.0, Math.expm1(0.0));
+        assertEquals("Should return +0.0", +0.0, Math.expm1(+0.0));
+        assertEquals("Should return -0.0", -0.0, Math.expm1(-0.0));
 
-	/**
-	 * @tests java.lang.Math#floor(double)
-	 */
+        assertEquals("Should return -9.999950000166666E-6",
+                -9.999950000166666E-6, Math.expm1(-0.00001));
+        assertEquals("Should return 1.0145103074469635E60",
+                1.0145103074469635E60, Math.expm1(138.16951162));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math
+                        .expm1(123456789123456789123456789.4521584223));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.expm1(Double.MAX_VALUE));
+        assertEquals("Should return MIN_VALUE", Double.MIN_VALUE, Math
+                .expm1(Double.MIN_VALUE));
+    }
+
+    /**
+     * @tests java.lang.Math#floor(double)
+     */
 	public void test_floorD() {
 		// Test for method double java.lang.Math.floor(double)
                 assertEquals("Incorrect floor for double",
@@ -225,6 +253,45 @@
 		assertEquals("Incorrect floor for double",
                              -79, Math.floor(-78.89), 0);
 	}
+    
+    /**
+     * @tests java.lang.Math#hypot(double, double)
+     */
+    @SuppressWarnings("boxing")
+    public void test_hypot_DD() {
+        // Test for special cases
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.hypot(Double.POSITIVE_INFINITY,
+                        1.0));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.hypot(Double.NEGATIVE_INFINITY,
+                        123.324));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.hypot(-758.2587,
+                        Double.POSITIVE_INFINITY));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.hypot(5687.21,
+                        Double.NEGATIVE_INFINITY));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.hypot(Double.POSITIVE_INFINITY,
+                        Double.NEGATIVE_INFINITY));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.hypot(Double.NEGATIVE_INFINITY,
+                        Double.POSITIVE_INFINITY));
+        assertEquals("Should return NaN", Double.NaN, Math.hypot(Double.NaN,
+                2342301.89843));
+        assertEquals("Should return NaN", Double.NaN, Math.hypot(-345.2680,
+                Double.NaN));
+
+        assertEquals("Should return 2396424.905416697", 2396424.905416697, Math
+                .hypot(12322.12, -2396393.2258));
+        assertEquals("Should return 138.16958070558556", 138.16958070558556,
+                Math.hypot(-138.16951162, 0.13817035864));
+        assertEquals("Should return 1.7976931348623157E308",
+                1.7976931348623157E308, Math.hypot(Double.MAX_VALUE, 211370.35));
+        assertEquals("Should return 5413.7185", 5413.7185, Math.hypot(
+                -5413.7185, Double.MIN_VALUE));
+    }
 
 	/**
 	 * @tests java.lang.Math#IEEEremainder(double, double)
@@ -250,6 +317,32 @@
 					.abs(d * 0.00000001));
 		}
 	}
+    
+    /**
+     * @tests java.lang.Math#log1p(double)
+     */
+    @SuppressWarnings("boxing")
+    public void test_log1p_D() {
+        // Test for special cases
+        assertEquals("Should return NaN", Double.NaN, Math.log1p(Double.NaN));
+        assertEquals("Should return NaN", Double.NaN, Math.log1p(-32.0482175));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.log1p(Double.POSITIVE_INFINITY));
+        assertEquals("Should return 0.0", 0.0, Math.log1p(0.0));
+        assertEquals("Should return +0.0", +0.0, Math.log1p(+0.0));
+        assertEquals("Should return -0.0", -0.0, Math.log1p(-0.0));
+
+        assertEquals("Should return -0.2941782295312541", -0.2941782295312541,
+                Math.log1p(-0.254856327));
+        assertEquals("Should return 7.368050685564151", 7.368050685564151, Math
+                .log1p(1583.542));
+        assertEquals("Should return 0.4633708685409921", 0.4633708685409921,
+                Math.log1p(0.5894227));
+        assertEquals("Should return 709.782712893384", 709.782712893384, Math
+                .log1p(Double.MAX_VALUE));
+        assertEquals("Should return Double.MIN_VALUE", Double.MIN_VALUE, Math
+                .log1p(Double.MIN_VALUE));
+    }
 
 	/**
 	 * @tests java.lang.Math#max(double, double)

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StrictMathTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StrictMathTest.java?view=diff&rev=442112&r1=442111&r2=442112
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StrictMathTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/luni/tests/java/lang/StrictMathTest.java
Sun Sep 10 23:37:28 2006
@@ -215,6 +215,35 @@
 		assertTrue("Incorrect answer returned for larger power", StrictMath
 				.log(StrictMath.abs(StrictMath.exp(5.5D)) - 5.5D) < 10.0D);
 	}
+    
+    /**
+     * @tests java.lang.StrictMath#expm1(double)
+     */
+    @SuppressWarnings("boxing")
+    public void test_expm1_D() {
+        //Test for special cases
+        assertEquals("Should return NaN", Double.NaN, StrictMath.expm1(Double.NaN));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath.expm1(Double.POSITIVE_INFINITY));
+        assertEquals("Should return -1.0", -1.0, StrictMath
+                .expm1(Double.NEGATIVE_INFINITY));
+        assertEquals("Should return 0.0", 0.0, StrictMath.expm1(0.0));
+        assertEquals("Should return +0.0", +0.0, StrictMath.expm1(+0.0));
+        assertEquals("Should return -0.0", -0.0, StrictMath.expm1(-0.0));
+
+        assertEquals("Should return -9.999950000166666E-6",
+                -9.999950000166666E-6, StrictMath.expm1(-0.00001));
+        assertEquals("Should return 1.0145103074469635E60",
+                1.0145103074469635E60, StrictMath.expm1(138.16951162));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath
+                        .expm1(123456789123456789123456789.4521584223));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath.expm1(Double.MAX_VALUE));
+        assertEquals("Should return MIN_VALUE", Double.MIN_VALUE, StrictMath
+                .expm1(Double.MIN_VALUE));
+       
+    }    
 
 	/**
 	 * @tests java.lang.StrictMath#floor(double)
@@ -226,6 +255,46 @@
 		assertEquals("Incorrect floor for double",
                              -79, StrictMath.floor(-78.89), 0.0);
 	}
+    
+    /**
+     * @tests java.lang.StrictMath#hypot(double, double)
+     */
+    @SuppressWarnings("boxing")
+    public void test_hypot_DD() {
+        // Test for special cases
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath.hypot(Double.POSITIVE_INFINITY,
+                        1.0));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath.hypot(Double.NEGATIVE_INFINITY,
+                        123.324));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath.hypot(-758.2587,
+                        Double.POSITIVE_INFINITY));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath.hypot(5687.21,
+                        Double.NEGATIVE_INFINITY));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath.hypot(Double.POSITIVE_INFINITY,
+                        Double.NEGATIVE_INFINITY));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath.hypot(Double.NEGATIVE_INFINITY,
+                        Double.POSITIVE_INFINITY));
+        assertEquals("Should return NaN", Double.NaN, StrictMath.hypot(Double.NaN,
+                2342301.89843));
+        assertEquals("Should return NaN", Double.NaN, StrictMath.hypot(-345.2680,
+                Double.NaN));
+
+        assertEquals("Should return 2396424.905416697", 2396424.905416697, StrictMath
+                .hypot(12322.12, -2396393.2258));
+        assertEquals("Should return 138.16958070558556", 138.16958070558556,
+                StrictMath.hypot(-138.16951162, 0.13817035864));
+        assertEquals("Should return 1.7976931348623157E308",
+                1.7976931348623157E308, StrictMath.hypot(Double.MAX_VALUE, 211370.35));
+        assertEquals("Should return 5413.7185", 5413.7185, StrictMath.hypot(
+                -5413.7185, Double.MIN_VALUE));
+
+    }
 
 	/**
 	 * @tests java.lang.StrictMath#IEEEremainder(double, double)
@@ -254,10 +323,72 @@
 							.abs(d * 0.00000001));
 		}
 	}
+    
+    /**
+     * @tests java.lang.StrictMath#log10(double)
+     */
+    @SuppressWarnings("boxing")
+    public void test_log10_D() {
+        // Test for special cases
+        assertEquals("Should return NaN", Double.NaN, StrictMath
+                .log10(Double.NaN));
+        assertEquals("Should return NaN", Double.NaN, StrictMath
+                .log10(-2541.05745687234187532));
+        assertEquals("Should return NaN", Double.POSITIVE_INFINITY, StrictMath
+                .log10(Double.POSITIVE_INFINITY));
+        assertEquals("Should return NEGATIVE_INFINITY",
+                Double.NEGATIVE_INFINITY, StrictMath.log10(0.0));
+        assertEquals("Should return NEGATIVE_INFINITY",
+                Double.NEGATIVE_INFINITY, StrictMath.log10(+0.0));
+        assertEquals("Should return NEGATIVE_INFINITY",
+                Double.NEGATIVE_INFINITY, StrictMath.log10(-0.0));
+        assertEquals("Should return 14.0", 14.0, StrictMath.log10(StrictMath
+                .pow(10, 14)));
 
-	/**
-	 * @tests java.lang.StrictMath#max(double, double)
-	 */
+        assertEquals("Should return 3.7389561269540406", 3.7389561269540406,
+                StrictMath.log10(5482.2158));
+        assertEquals("Should return 14.661551142893833", 14.661551142893833,
+                StrictMath.log10(458723662312872.125782332587));
+        assertEquals("Should return -0.9083828622192334", -0.9083828622192334,
+                StrictMath.log10(0.12348583358871));
+        assertEquals("Should return 308.25471555991675", 308.25471555991675,
+                StrictMath.log10(Double.MAX_VALUE));
+        assertEquals("Should return -323.3062153431158", -323.3062153431158,
+                StrictMath.log10(Double.MIN_VALUE));
+    }
+
+    /**
+     * @tests java.lang.StrictMath#log1p(double)
+     */
+    @SuppressWarnings("boxing")
+    public void test_log1p_D() {
+        // Test for special cases
+        assertEquals("Should return NaN", Double.NaN, StrictMath
+                .log1p(Double.NaN));
+        assertEquals("Should return NaN", Double.NaN, StrictMath
+                .log1p(-32.0482175));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath
+                        .log1p(Double.POSITIVE_INFINITY));
+        assertEquals("Should return 0.0", 0.0, StrictMath.log1p(0.0));
+        assertEquals("Should return +0.0", +0.0, StrictMath.log1p(+0.0));
+        assertEquals("Should return -0.0", -0.0, StrictMath.log1p(-0.0));
+
+        assertEquals("Should return -0.2941782295312541", -0.2941782295312541,
+                StrictMath.log1p(-0.254856327));
+        assertEquals("Should return 7.368050685564151", 7.368050685564151,
+                StrictMath.log1p(1583.542));
+        assertEquals("Should return 0.4633708685409921", 0.4633708685409921,
+                StrictMath.log1p(0.5894227));
+        assertEquals("Should return 709.782712893384", 709.782712893384,
+                StrictMath.log1p(Double.MAX_VALUE));
+        assertEquals("Should return Double.MIN_VALUE", Double.MIN_VALUE,
+                StrictMath.log1p(Double.MIN_VALUE));
+    }
+
+    /**
+     * @tests java.lang.StrictMath#max(double, double)
+     */
 	public void test_maxDD() {
 		// Test for method double java.lang.StrictMath.max(double, double)
 		assertEquals("Incorrect double max value", 1908897.6000089, StrictMath.max(



Mime
View raw message