harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r441064 - 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 Thu, 07 Sep 2006 12:27:29 GMT
Author: pyang
Date: Thu Sep  7 05:27:28 2006
New Revision: 441064

URL: http://svn.apache.org/viewvc?view=rev&rev=441064
Log:
Patch applied for HARMONY-1399 ([classlib][luni] new method java.lang.Math.sinh, java.lang.Math.cosh,
java.lang.Math.tanh, java.lang.StrictMath.sinh, java.lang.StrictMath.cosh, java.lang.StrictMath.tanh)

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=441064&r1=441063&r2=441064
==============================================================================
--- 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
Thu Sep  7 05:27:28 2006
@@ -132,8 +132,7 @@
     
     /**
      * Answers the closest double approximation of the cube root of the
-     * argument. The final result should be within 1ulp of the one returned by
-     * StrictMath.
+     * argument. The final result should be within 1ulp of the real result.
      * 
      * @param d
      *            the value to compute cube root of
@@ -159,6 +158,16 @@
 	 * @return the cosine of the argument.
 	 */
 	public static native double cos(double d);
+    
+    /**
+     * Answers the closest double approximation of the hyperbolic cosine of the
+     * argument. The final result should be within 2.5ulps of the real result.
+     * 
+     * @param d
+     *            the value to compute hyperbolic cosine of
+     * @return the hyperbolic cosine of the argument.
+     */
+    public static native double cosh(double d);
 
 	/**
 	 * Answers the closest double approximation of the raising "e" to the power
@@ -429,6 +438,16 @@
 	 * @return the sine of the argument.
 	 */
 	public static native double sin(double d);
+    
+    /**
+     * Answers the closest double approximation of the hyperbolic sine of the
+     * argument. The final result should be within 2.5ulps of the real result.
+     * 
+     * @param d
+     *            the value to compute hyperbolic sine of
+     * @return the hyperbolic sine of the argument.
+     */
+    public static native double sinh(double d);
 
 	/**
 	 * Answers the closest double approximation of the square root of the
@@ -448,6 +467,18 @@
 	 * @return the tangent of the argument.
 	 */
 	public static native double tan(double d);
+    
+    /**
+     * Answers the closest double approximation of the hyperbolic tangent of the
+     * argument. The absolute value is always less than 1. The final result
+     * should be within 2.5ulps of the real result. If the real result is 
+     * within 0.5ulp of 1 or -1, it should answer exactly +1 or -1.
+     * 
+     * @param d
+     *            the value to compute hyperbolic tangent of
+     * @return the hyperbolic tangent of the argument.
+     */
+    public static native double tanh(double d);
 
 	/**
 	 * Returns a pseudo-random number between 0.0 and 1.0.

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=441064&r1=441063&r2=441064
==============================================================================
--- 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
Thu Sep  7 05:27:28 2006
@@ -154,6 +154,17 @@
 	 * @return the ceiling of the argument.
 	 */
 	public static native double ceil(double d);
+    
+    
+    /**
+     * Answers the closest double approximation of the hyperbolic cosine of the
+     * argument.
+     * 
+     * @param d
+     *            the value to compute hyperbolic cosine of
+     * @return the hyperbolic cosine of the argument.
+     */
+    public static native double cosh(double d);
 
 	/**
 	 * Answers the closest double approximation of the cosine of the argument
@@ -424,6 +435,16 @@
 		return (int) Math.floor(f + 0.5f);
 	}
 
+    /**
+     * Answers the closest double approximation of the hyperbolic sine of the
+     * argument. 
+     * 
+     * @param d
+     *            the value to compute hyperbolic sine of
+     * @return the hyperbolic sine of the argument.
+     */
+    public static native double sinh(double d);
+    
 	/**
 	 * Answers the closest double approximation of the sine of the argument
 	 * 
@@ -452,6 +473,16 @@
 	 */
 	public static native double tan(double d);
 
+    /**
+     * Answers the closest double approximation of the hyperbolic tangent of the
+     * argument. The absolute value is always less than 1. 
+     * 
+     * @param d
+     *            the value to compute hyperbolic tangent of
+     * @return the hyperbolic tangent of the argument.
+     */
+    public static native double tanh(double d);
+    
 	/**
 	 * Returns the measure in degrees of the supplied radian angle
 	 * 

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=441064&r1=441063&r2=441064
==============================================================================
--- 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
Thu Sep  7 05:27:28 2006
@@ -97,6 +97,7 @@
 		Java_java_lang_Math_cbrt;
 		Java_java_lang_Math_ceil;
 		Java_java_lang_Math_cos;
+		Java_java_lang_Math_cosh;
 		Java_java_lang_Math_exp;
 		Java_java_lang_Math_floor;
 		Java_java_lang_Math_IEEEremainder;
@@ -104,8 +105,10 @@
 		Java_java_lang_Math_pow;
 		Java_java_lang_Math_rint;
 		Java_java_lang_Math_sin;
+		Java_java_lang_Math_sinh;
 		Java_java_lang_Math_sqrt;
 		Java_java_lang_Math_tan;
+		Java_java_lang_Math_tanh;
 		Java_java_lang_reflect_Proxy_defineClassImpl;
 		Java_java_lang_StrictMath_acos;
 		Java_java_lang_StrictMath_asin;
@@ -114,6 +117,7 @@
 		Java_java_lang_StrictMath_cbrt;
 		Java_java_lang_StrictMath_ceil;
 		Java_java_lang_StrictMath_cos;
+		Java_java_lang_StrictMath_cosh;
 		Java_java_lang_StrictMath_exp;
 		Java_java_lang_StrictMath_floor;
 		Java_java_lang_StrictMath_IEEEremainder;
@@ -121,8 +125,10 @@
 		Java_java_lang_StrictMath_pow;
 		Java_java_lang_StrictMath_rint;
 		Java_java_lang_StrictMath_sin;
+		Java_java_lang_StrictMath_sinh;
 		Java_java_lang_StrictMath_sqrt;
 		Java_java_lang_StrictMath_tan;
+		Java_java_lang_StrictMath_tanh;
 		Java_java_net_InetAddress_getAliasesByNameImpl;
 		Java_java_net_InetAddress_getHostByAddrImpl;
 		Java_java_net_InetAddress_getHostByNameImpl;

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=441064&r1=441063&r2=441064
==============================================================================
--- 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
Thu Sep  7 05:27:28 2006
@@ -37,6 +37,9 @@
 jdouble internal_sin (jdouble arg1);
 jdouble internal_rint (jdouble arg1);
 jdouble internal_cbrt (jdouble arg1);
+jdouble internal_sinh (jdouble arg1);
+jdouble internal_cosh (jdouble arg1);
+jdouble internal_tanh (jdouble arg1);
 
 extern scaleUpDouble (double *, int);
 
@@ -123,6 +126,16 @@
 }
 
 jdouble
+internal_cosh (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_cosh (arg1);
+
+  return result;
+}
+
+jdouble
 internal_exp (jdouble arg1)
 {
   jdouble result;
@@ -193,6 +206,16 @@
 }
 
 jdouble
+internal_sinh (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_sinh (arg1);
+
+  return result;
+}
+
+jdouble
 internal_sqrt (jdouble arg1)
 {
   jdouble result;
@@ -212,6 +235,17 @@
   return result;
 }
 
+jdouble
+internal_tanh (jdouble arg1)
+{
+  jdouble result;
+
+  result = fdlibm_tanh (arg1);
+
+  return result;
+}
+
+
 jdouble JNICALL
 Java_java_lang_StrictMath_asin (JNIEnv * env, jclass jclazz, jdouble arg1)
 {
@@ -287,6 +321,18 @@
 }
 
 jdouble JNICALL
+Java_java_lang_StrictMath_cosh (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_cosh (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_cosh (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_cosh (arg1);
+}
+
+jdouble JNICALL
 Java_java_lang_StrictMath_exp (JNIEnv * env, jclass jclazz, jdouble arg1)
 {
   return internal_exp (arg1);
@@ -375,6 +421,18 @@
 }
 
 jdouble JNICALL
+Java_java_lang_StrictMath_sinh (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_sinh (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_sinh (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_sinh (arg1);
+}
+
+jdouble JNICALL
 Java_java_lang_StrictMath_sqrt (JNIEnv * env, jclass jclazz, jdouble arg1)
 {
   return internal_sqrt (arg1);
@@ -397,3 +455,16 @@
 {
   return internal_tan (arg1);
 }
+
+jdouble JNICALL
+Java_java_lang_StrictMath_tanh (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_tanh (arg1);
+}
+
+jdouble JNICALL
+Java_java_lang_Math_tanh (JNIEnv * env, jclass jclazz, jdouble arg1)
+{
+  return internal_tanh (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=441064&r1=441063&r2=441064
==============================================================================
--- 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
Thu Sep  7 05:27:28 2006
@@ -90,6 +90,7 @@
 	Java_java_lang_Math_cbrt
 	Java_java_lang_Math_ceil
 	Java_java_lang_Math_cos
+	Java_java_lang_Math_cosh
 	Java_java_lang_Math_exp
 	Java_java_lang_Math_floor
 	Java_java_lang_Math_IEEEremainder
@@ -97,8 +98,10 @@
 	Java_java_lang_Math_pow
 	Java_java_lang_Math_rint
 	Java_java_lang_Math_sin
+	Java_java_lang_Math_sinh
 	Java_java_lang_Math_sqrt
 	Java_java_lang_Math_tan
+	Java_java_lang_Math_tanh
 	Java_java_lang_reflect_Proxy_defineClassImpl
 	Java_java_lang_StrictMath_acos
 	Java_java_lang_StrictMath_asin
@@ -107,6 +110,7 @@
 	Java_java_lang_StrictMath_cbrt
 	Java_java_lang_StrictMath_ceil
 	Java_java_lang_StrictMath_cos
+	Java_java_lang_StrictMath_cosh
 	Java_java_lang_StrictMath_exp
 	Java_java_lang_StrictMath_floor
 	Java_java_lang_StrictMath_IEEEremainder
@@ -114,8 +118,10 @@
 	Java_java_lang_StrictMath_pow
 	Java_java_lang_StrictMath_rint
 	Java_java_lang_StrictMath_sin
+	Java_java_lang_StrictMath_sinh
 	Java_java_lang_StrictMath_sqrt
 	Java_java_lang_StrictMath_tan
+	Java_java_lang_StrictMath_tanh
 	Java_java_net_InetAddress_getAliasesByNameImpl
 	Java_java_net_InetAddress_getHostByAddrImpl
 	Java_java_net_InetAddress_getHostByNameImpl

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=441064&r1=441063&r2=441064
==============================================================================
--- 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
Thu Sep  7 05:27:28 2006
@@ -173,6 +173,36 @@
 		assertEquals("Incorrect answer", 0.5403023058681398, Math.cos(1));
 	}
 
+    /**
+     * @tests java.lang.Math#cosh(double)
+     */
+    @SuppressWarnings("boxing")
+    public void test_cosh_D() {
+        // Test for special situations
+        assertEquals("Should return NaN", Double.NaN, Math.cosh(Double.NaN));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.cosh(Double.POSITIVE_INFINITY));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.cosh(Double.NEGATIVE_INFINITY));
+        assertEquals("Should return 1.0", 1.0, Math.cosh(+0.0));
+        assertEquals("Should return 1.0", 1.0, Math.cosh(-0.0));
+
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.cosh(1234.56));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.cosh(-1234.56));
+        assertEquals("Should return 1.0000000000005", 1.0000000000005, Math
+                .cosh(0.000001));
+        assertEquals("Should return 1.0000000000005", 1.0000000000005, Math
+                .cosh(-0.000001));
+        assertEquals("Should return 5.212214351945598", 5.212214351945598, Math
+                .cosh(2.33482));
+
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.cosh(Double.MAX_VALUE));
+        assertEquals("Should return 1.0", 1.0, Math.cosh(Double.MIN_VALUE));
+    }
+    
 	/**
 	 * @tests java.lang.Math#exp(double)
 	 */
@@ -378,6 +408,36 @@
 		assertEquals("Incorrect answer", 0.8414709848078965, Math.sin(1));
 	}
 
+    /**
+     * @tests java.lang.Math#sinh(double)
+     */
+    public void test_sinh_D() {
+        // Test for special situations
+        assertEquals("Should return NaN", Double.NaN, Math.sinh(Double.NaN));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.sinh(Double.POSITIVE_INFINITY));
+        assertEquals("Should return NEGATIVE_INFINITY",
+                Double.NEGATIVE_INFINITY, Math.sinh(Double.NEGATIVE_INFINITY));
+        assertEquals("Should return 0.0", 0.0, Math.sinh(0.0));
+        assertEquals("Should return +0.0", +0.0, Math.sinh(+0.0));
+        assertEquals("Should return -0.0", -0.0, Math.sinh(-0.0));
+
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.sinh(1234.56));
+        assertEquals("Should return NEGATIVE_INFINITY",
+                Double.NEGATIVE_INFINITY, Math.sinh(-1234.56));
+        assertEquals("Should return 1.0000000000001666E-6",
+                1.0000000000001666E-6, Math.sinh(0.000001));
+        assertEquals("Should return -1.0000000000001666E-6",
+                -1.0000000000001666E-6, Math.sinh(-0.000001));
+        assertEquals("Should return 5.115386441963859", 5.115386441963859, Math
+                .sinh(2.33482));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, Math.sinh(Double.MAX_VALUE));
+        assertEquals("Should return 4.9E-324", 4.9E-324, Math
+                .sinh(Double.MIN_VALUE));
+    }
+    
 	/**
 	 * @tests java.lang.Math#sqrt(double)
 	 */
@@ -396,6 +456,31 @@
 
 	}
 
+    /**
+     * @tests java.lang.Math#tanh(double)
+     */
+    public void test_tanh_D() {
+        // Test for special situations
+        assertEquals("Should return NaN", Double.NaN, Math.tanh(Double.NaN));
+        assertEquals("Should return +1.0", +1.0, Math
+                .tanh(Double.POSITIVE_INFINITY));
+        assertEquals("Should return -1.0", -1.0, Math
+                .tanh(Double.NEGATIVE_INFINITY));
+        assertEquals("Should return +0.0", +0.0, Math.tanh(+0.0));
+        assertEquals("Should return -0.0", -0.0, Math.tanh(-0.0));
+        assertEquals("Should return 0.0", 0.0, Math.tanh(0.0));
+
+        assertEquals("Should return 1.0", 1.0, Math.tanh(1234.56));
+        assertEquals("Should return -1.0", -1.0, Math.tanh(-1234.56));
+        assertEquals("Should return 9.999999999996666E-7",
+                9.999999999996666E-7, Math.tanh(0.000001));
+        assertEquals("Should return 0.981422884124941", 0.981422884124941, Math
+                .tanh(2.33482));
+        assertEquals("Should return 1.0", 1.0, Math.tanh(Double.MAX_VALUE));
+        assertEquals("Should return 4.9E-324", 4.9E-324, Math
+                .tanh(Double.MIN_VALUE));
+    }
+    
 	/**
 	 * @tests java.lang.Math#random()
 	 */

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=441064&r1=441063&r2=441064
==============================================================================
--- 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
Thu Sep  7 05:27:28 2006
@@ -169,6 +169,40 @@
 		assertTrue("Returned incorrect cosine", StrictMath.cos(StrictMath
 				.acos(ADJ / HYP)) == ADJ / HYP);
 	}
+    
+    /**
+     * @tests java.lang.StrictMath#cosh(double)
+     */
+    @SuppressWarnings("boxing")
+    public void test_cosh_D() {
+        // Test for special situations
+        assertEquals("Should return NaN", Double.NaN, StrictMath
+                .cosh(Double.NaN));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath
+                        .cosh(Double.POSITIVE_INFINITY));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath
+                        .cosh(Double.NEGATIVE_INFINITY));
+        assertEquals("Should return 1.0", 1.0, StrictMath.cosh(+0.0));
+        assertEquals("Should return 1.0", 1.0, StrictMath.cosh(-0.0));
+
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath.cosh(1234.56));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath.cosh(-1234.56));
+        assertEquals("Should return 1.0000000000005", 1.0000000000005,
+                StrictMath.cosh(0.000001));
+        assertEquals("Should return 1.0000000000005", 1.0000000000005,
+                StrictMath.cosh(-0.000001));
+        assertEquals("Should return 5.212214351945598", 5.212214351945598,
+                StrictMath.cosh(2.33482));
+
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath.cosh(Double.MAX_VALUE));
+        assertEquals("Should return 1.0", 1.0, StrictMath
+                .cosh(Double.MIN_VALUE));
+    }
 
 	/**
 	 * @tests java.lang.StrictMath#exp(double)
@@ -380,6 +414,39 @@
 				.asin(OPP / HYP)) == OPP / HYP);
 	}
 
+    /**
+     * @tests java.lang.StrictMath#sinh(double)
+     */
+    public void test_sinh_D() {
+        // Test for special situations
+        assertEquals("Should return NaN", Double.NaN, StrictMath
+                .sinh(Double.NaN));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath
+                        .sinh(Double.POSITIVE_INFINITY));
+        assertEquals("Should return NEGATIVE_INFINITY",
+                Double.NEGATIVE_INFINITY, StrictMath
+                        .sinh(Double.NEGATIVE_INFINITY));
+        assertEquals("Should return 0.0", 0.0, StrictMath.sinh(0.0));
+        assertEquals("Should return +0.0", +0.0, StrictMath.sinh(+0.0));
+        assertEquals("Should return -0.0", -0.0, StrictMath.sinh(-0.0));
+
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath.sinh(1234.56));
+        assertEquals("Should return NEGATIVE_INFINITY",
+                Double.NEGATIVE_INFINITY, StrictMath.sinh(-1234.56));
+        assertEquals("Should return 1.0000000000001666E-6",
+                1.0000000000001666E-6, StrictMath.sinh(0.000001));
+        assertEquals("Should return -1.0000000000001666E-6",
+                -1.0000000000001666E-6, StrictMath.sinh(-0.000001));
+        assertEquals("Should return 5.115386441963859", 5.115386441963859,
+                StrictMath.sinh(2.33482));
+        assertEquals("Should return POSITIVE_INFINITY",
+                Double.POSITIVE_INFINITY, StrictMath.sinh(Double.MAX_VALUE));
+        assertEquals("Should return 4.9E-324", 4.9E-324, StrictMath
+                .sinh(Double.MIN_VALUE));
+    }
+    
 	/**
 	 * @tests java.lang.StrictMath#sqrt(double)
 	 */
@@ -401,6 +468,33 @@
 						|| StrictMath.tan(StrictMath.atan(1.0)) >= 9.9999999999999983E-1);
 	}
 
+    /**
+     * @tests java.lang.StrictMath#tanh(double)
+     */
+    public void test_tanh_D() {
+        // Test for special situations
+        assertEquals("Should return NaN", Double.NaN, StrictMath
+                .tanh(Double.NaN));
+        assertEquals("Should return +1.0", +1.0, StrictMath
+                .tanh(Double.POSITIVE_INFINITY));
+        assertEquals("Should return -1.0", -1.0, StrictMath
+                .tanh(Double.NEGATIVE_INFINITY));
+        assertEquals("Should return +0.0", +0.0, StrictMath.tanh(+0.0));
+        assertEquals("Should return -0.0", -0.0, StrictMath.tanh(-0.0));
+        assertEquals("Should return 0.0", 0.0, StrictMath.tanh(0.0));
+
+        assertEquals("Should return 1.0", 1.0, StrictMath.tanh(1234.56));
+        assertEquals("Should return -1.0", -1.0, StrictMath.tanh(-1234.56));
+        assertEquals("Should return 9.999999999996666E-7",
+                9.999999999996666E-7, StrictMath.tanh(0.000001));
+        assertEquals("Should return 0.981422884124941", 0.981422884124941,
+                StrictMath.tanh(2.33482));
+        assertEquals("Should return 1.0", 1.0, StrictMath
+                .tanh(Double.MAX_VALUE));
+        assertEquals("Should return 4.9E-324", 4.9E-324, StrictMath
+                .tanh(Double.MIN_VALUE));
+    }
+    
 	/**
 	 * @tests java.lang.StrictMath#random()
 	 */



Mime
View raw message