java_lang_VMMath.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /* VMMath.c - java.lang.VMMath native functions
  2. Copyright (C) 1998, 1999, 2004, 2006 Free Software Foundation, Inc.
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. 02110-1301 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. #include <config.h>
  32. #include <java_lang_VMMath.h>
  33. #include <fdlibm.h>
  34. JNIEXPORT jdouble JNICALL
  35. Java_java_lang_VMMath_sin
  36. (JNIEnv * env __attribute__ ((__unused__)),
  37. jclass cls __attribute__ ((__unused__)), jdouble x)
  38. {
  39. return sin (x);
  40. }
  41. JNIEXPORT jdouble JNICALL
  42. Java_java_lang_VMMath_cos
  43. (JNIEnv * env __attribute__ ((__unused__)),
  44. jclass cls __attribute__ ((__unused__)), jdouble x)
  45. {
  46. return cos (x);
  47. }
  48. JNIEXPORT jdouble JNICALL
  49. Java_java_lang_VMMath_tan
  50. (JNIEnv * env __attribute__ ((__unused__)),
  51. jclass cls __attribute__ ((__unused__)), jdouble x)
  52. {
  53. return tan (x);
  54. }
  55. JNIEXPORT jdouble JNICALL
  56. Java_java_lang_VMMath_asin
  57. (JNIEnv * env __attribute__ ((__unused__)),
  58. jclass cls __attribute__ ((__unused__)), jdouble x)
  59. {
  60. return asin (x);
  61. }
  62. JNIEXPORT jdouble JNICALL
  63. Java_java_lang_VMMath_acos
  64. (JNIEnv * env __attribute__ ((__unused__)),
  65. jclass cls __attribute__ ((__unused__)), jdouble x)
  66. {
  67. return acos (x);
  68. }
  69. JNIEXPORT jdouble JNICALL
  70. Java_java_lang_VMMath_atan
  71. (JNIEnv * env __attribute__ ((__unused__)),
  72. jclass cls __attribute__ ((__unused__)), jdouble x)
  73. {
  74. return atan (x);
  75. }
  76. JNIEXPORT jdouble JNICALL
  77. Java_java_lang_VMMath_atan2
  78. (JNIEnv * env __attribute__ ((__unused__)),
  79. jclass cls __attribute__ ((__unused__)), jdouble y, jdouble x)
  80. {
  81. return atan2 (y, x);
  82. }
  83. JNIEXPORT jdouble JNICALL
  84. Java_java_lang_VMMath_exp
  85. (JNIEnv * env __attribute__ ((__unused__)),
  86. jclass cls __attribute__ ((__unused__)), jdouble x)
  87. {
  88. return exp (x);
  89. }
  90. JNIEXPORT jdouble JNICALL
  91. Java_java_lang_VMMath_log
  92. (JNIEnv * env __attribute__ ((__unused__)),
  93. jclass cls __attribute__ ((__unused__)), jdouble x)
  94. {
  95. return log (x);
  96. }
  97. JNIEXPORT jdouble JNICALL
  98. Java_java_lang_VMMath_sqrt
  99. (JNIEnv * env __attribute__ ((__unused__)),
  100. jclass cls __attribute__ ((__unused__)), jdouble x)
  101. {
  102. return sqrt (x);
  103. }
  104. JNIEXPORT jdouble JNICALL
  105. Java_java_lang_VMMath_pow
  106. (JNIEnv * env __attribute__ ((__unused__)),
  107. jclass cls __attribute__ ((__unused__)), jdouble x, jdouble y)
  108. {
  109. return pow (x, y);
  110. }
  111. JNIEXPORT jdouble JNICALL
  112. Java_java_lang_VMMath_IEEEremainder
  113. (JNIEnv * env __attribute__ ((__unused__)),
  114. jclass cls __attribute__ ((__unused__)), jdouble x, jdouble y)
  115. {
  116. return remainder (x, y);
  117. }
  118. JNIEXPORT jdouble JNICALL
  119. Java_java_lang_VMMath_ceil
  120. (JNIEnv * env __attribute__ ((__unused__)),
  121. jclass cls __attribute__ ((__unused__)), jdouble x)
  122. {
  123. return ceil (x);
  124. }
  125. JNIEXPORT jdouble JNICALL
  126. Java_java_lang_VMMath_floor
  127. (JNIEnv * env __attribute__ ((__unused__)),
  128. jclass cls __attribute__ ((__unused__)), jdouble x)
  129. {
  130. return floor (x);
  131. }
  132. JNIEXPORT jdouble JNICALL
  133. Java_java_lang_VMMath_rint
  134. (JNIEnv * env __attribute__ ((__unused__)),
  135. jclass cls __attribute__ ((__unused__)), jdouble x)
  136. {
  137. return rint (x);
  138. }
  139. JNIEXPORT jdouble JNICALL
  140. Java_java_lang_VMMath_cbrt
  141. (JNIEnv * env __attribute__ ((__unused__)),
  142. jclass cls __attribute__ ((__unused__)), jdouble x)
  143. {
  144. return cbrt (x);
  145. }
  146. JNIEXPORT jdouble JNICALL
  147. Java_java_lang_VMMath_cosh
  148. (JNIEnv * env __attribute__ ((__unused__)),
  149. jclass cls __attribute__ ((__unused__)), jdouble x)
  150. {
  151. return cosh (x);
  152. }
  153. JNIEXPORT jdouble JNICALL
  154. Java_java_lang_VMMath_expm1
  155. (JNIEnv * env __attribute__ ((__unused__)),
  156. jclass cls __attribute__ ((__unused__)), jdouble x)
  157. {
  158. return expm1 (x);
  159. }
  160. JNIEXPORT jdouble JNICALL
  161. Java_java_lang_VMMath_hypot
  162. (JNIEnv * env __attribute__ ((__unused__)),
  163. jclass cls __attribute__ ((__unused__)), jdouble x, jdouble y)
  164. {
  165. return hypot (x, y);
  166. }
  167. JNIEXPORT jdouble JNICALL
  168. Java_java_lang_VMMath_log10
  169. (JNIEnv * env __attribute__ ((__unused__)),
  170. jclass cls __attribute__ ((__unused__)), jdouble x)
  171. {
  172. return log10 (x);
  173. }
  174. JNIEXPORT jdouble JNICALL
  175. Java_java_lang_VMMath_log1p
  176. (JNIEnv * env __attribute__ ((__unused__)),
  177. jclass cls __attribute__ ((__unused__)), jdouble x)
  178. {
  179. return log1p (x);
  180. }
  181. JNIEXPORT jdouble JNICALL
  182. Java_java_lang_VMMath_sinh
  183. (JNIEnv * env __attribute__ ((__unused__)),
  184. jclass cls __attribute__ ((__unused__)), jdouble x)
  185. {
  186. return sinh (x);
  187. }
  188. JNIEXPORT jdouble JNICALL
  189. Java_java_lang_VMMath_tanh
  190. (JNIEnv * env __attribute__ ((__unused__)),
  191. jclass cls __attribute__ ((__unused__)), jdouble x)
  192. {
  193. return tanh (x);
  194. }