--- a/src/JavaVM.st Mon Sep 05 20:12:35 2011 +0000
+++ b/src/JavaVM.st Tue Sep 06 19:04:29 2011 +0000
@@ -5767,13 +5767,42 @@
_java_lang_StrictMath_cosh: nativeContext
- <javanative: 'java/lang/StrictMath' name: 'cos'>
+ <javanative: 'java/lang/StrictMath' name: 'cosh'>
+
+ "
+ /**
+ * Returns the hyperbolic cosine of a {@code double} value.
+ * The hyperbolic cosine of <i>x</i> is defined to be
+ * (<i>e<sup>x</sup> + e<sup>-x</sup></i>)/2
+ * where <i>e</i> is {@linkplain Math#E Euler's number}.
+ *
+ * <p>Special cases:
+ * <ul>
+ *
+ * <li>If the argument is NaN, then the result is NaN.
+ *
+ * <li>If the argument is infinite, then the result is positive
+ * infinity.
+ *
+ * <li>If the argument is zero, then the result is {@code 1.0}.
+ *
+ * </ul>
+ *
+ * @param x The number whose hyperbolic cosine is to be returned.
+ * @return The hyperbolic cosine of {@code x}.
+ * @since 1.5
+ */
+ public static native double cosh(double x);
+ "
| f |
f := nativeContext argAt: 1.
+ f isNaN ifTrue:[^f].
+ f isInfinite ifTrue:[(1.0 uncheckedDivide: 0.0)].
+
^f cosh
- "Modified: / 08-08-2011 / 23:44:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 06-09-2011 / 19:25:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
_java_lang_StrictMath_expm1: nativeContext
@@ -5818,24 +5847,92 @@
_java_lang_StrictMath_sinh: nativeContext
- <javanative: 'java/lang/StrictMath' name: 'cos'>
+ <javanative: 'java/lang/StrictMath' name: 'sinh'>
+
+ "
+ /**
+ * Returns the hyperbolic sine of a {@code double} value.
+ * The hyperbolic sine of <i>x</i> is defined to be
+ * (<i>e<sup>x</sup> - e<sup>-x</sup></i>)/2
+ * where <i>e</i> is {@linkplain Math#E Euler's number}.
+ *
+ * <p>Special cases:
+ * <ul>
+ *
+ * <li>If the argument is NaN, then the result is NaN.
+ *
+ * <li>If the argument is infinite, then the result is an infinity
+ * with the same sign as the argument.
+ *
+ * <li>If the argument is zero, then the result is a zero with the
+ * same sign as the argument.
+ *
+ * </ul>
+ *
+ * @param x The number whose hyperbolic sine is to be returned.
+ * @return The hyperbolic sine of {@code x}.
+ * @since 1.5
+ */
+ public static native double sinh(double x);
+
+ "
| f |
f := nativeContext argAt: 1.
+ f isNaN ifTrue:[^f].
+ f isInfinite ifTrue:[(1.0 uncheckedDivide: 0.0)].
+
^f sinh
- "Modified: / 08-08-2011 / 23:44:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 06-09-2011 / 19:36:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
_java_lang_StrictMath_tanh: nativeContext
- <javanative: 'java/lang/StrictMath' name: 'cos'>
+ <javanative: 'java/lang/StrictMath' name: 'tanh'>
+ "
+ /**
+ * Returns the hyperbolic tangent of a {@code double} value.
+ * The hyperbolic tangent of <i>x</i> is defined to be
+ * (<i>e<sup>x</sup> - e<sup>-x</sup></i>)/(<i>e<sup>x</sup> + e<sup>-x</sup></i>),
+ * in other words, {@linkplain Math#sinh
+ * sinh(<i>x</i>)}/{@linkplain Math#cosh cosh(<i>x</i>)}. Note
+ * that the absolute value of the exact tanh is always less than
+ * 1.
+ *
+ * <p>Special cases:
+ * <ul>
+ *
+ * <li>If the argument is NaN, then the result is NaN.
+ *
+ * <li>If the argument is zero, then the result is a zero with the
+ * same sign as the argument.
+ *
+ * <li>If the argument is positive infinity, then the result is
+ * {@code +1.0}.
+ *
+ * <li>If the argument is negative infinity, then the result is
+ * {@code -1.0}.
+ *
+ * </ul>
+ *
+ * @param x The number whose hyperbolic tangent is to be returned.
+ * @return The hyperbolic tangent of {@code x}.
+ * @since 1.5
+ */
+ public static native double tanh(double x);
+ "
| f |
f := nativeContext argAt: 1.
+ f isNaN ifTrue:[^f].
+ ( 0.0) = f ifTrue:[ f].
+ ( 1.0 uncheckedDivide: 0.0) = f ifTrue:[ 1.0].
+ (-1.0 uncheckedDivide: 0.0) = f ifTrue:[-1.0].
+
^f tanh
- "Modified: / 08-08-2011 / 23:44:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 06-09-2011 / 19:40:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
_java_lang_String_intern: nativeContext
@@ -5886,6 +5983,10 @@
dstIdx := nativeContext argAt:4.
count := nativeContext argAt:5.
+ count < 0 ifTrue:[
+ ^ self throwArrayIndexOutOfBoundsException:(srcIdx + count - 1)
+ ].
+
((srcIdx < 0) or:[srcIdx + count > srcArray size]) ifTrue:[
srcArray size == 0 ifTrue:[
srcArray isVariable ifFalse:[
@@ -5907,14 +6008,25 @@
dstIdx := dstIdx + 1. "/ ST uses 1-based indexing
srcIdx := srcIdx + 1. "/ ST uses 1-based indexing
+
+
(srcArray class isBytes and:[dstArray class isBytes]) ifTrue:[
dstArray replaceBytesFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx.
] ifFalse:[
- dstArray replaceFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx.
+ dstArrayCC isJavaPrimitiveType ifFalse:[
+ 1 to: count do:[:i|
+ (self canCast: (srcArray at:srcIdx + i - 1) class to: dstArrayCC) ifFalse:[
+ ^ self throwArrayStoreException:dstArray
+ ].
+ dstArray at: dstIdx + i - 1 put: (srcArray at:srcIdx + i - 1)
+ ]
+ ] ifTrue:[
+ dstArray replaceFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx.
+ ]
].
^ nil.
- "Modified: / 23-06-2011 / 09:17:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 06-09-2011 / 20:03:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
_java_lang_System_currentTimeMillis: nativeContext
@@ -15171,9 +15283,10 @@
!
_DDIV:op1 _:op2
- ^ op1 asFloat / op2 asFloat.
-
- "Created: / 8.1.1999 / 15:09:10 / cg"
+ ^ op1 asFloat uncheckedDivide: op2 asFloat.
+
+ "Created: / 08-01-1999 / 15:09:10 / cg"
+ "Modified: / 06-09-2011 / 19:31:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
_DMUL:op1 _:op2