Math.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. #include <math.h>
  2. #include <stdio.h>
  3. #include "BfObjects.h"
  4. namespace bf
  5. {
  6. namespace System
  7. {
  8. class Math
  9. {
  10. public:
  11. BFRT_EXPORT static float Acos(float d);
  12. BFRT_EXPORT static double Acos(double d);
  13. BFRT_EXPORT static float Asin(float d);
  14. BFRT_EXPORT static double Asin(double d);
  15. BFRT_EXPORT static float Atan(float d);
  16. BFRT_EXPORT static double Atan(double d);
  17. BFRT_EXPORT static float Atan2(float y, float x);
  18. BFRT_EXPORT static double Atan2(double y, double x);
  19. BFRT_EXPORT static float Ceiling(float a);
  20. BFRT_EXPORT static double Ceiling(double a);
  21. BFRT_EXPORT static float Cos(float d);
  22. BFRT_EXPORT static double Cos(double d);
  23. BFRT_EXPORT static float Cosh(float d);
  24. BFRT_EXPORT static double Cosh(double d);
  25. BFRT_EXPORT static float Floor(float d);
  26. BFRT_EXPORT static double Floor(double d);
  27. BFRT_EXPORT static float Sin(float a);
  28. BFRT_EXPORT static double Sin(double a);
  29. BFRT_EXPORT static float Tan(float a);
  30. BFRT_EXPORT static double Tan(double a);
  31. BFRT_EXPORT static float Sinh(float value);
  32. BFRT_EXPORT static double Sinh(double value);
  33. BFRT_EXPORT static float Tanh(float value);
  34. BFRT_EXPORT static double Tanh(double value);
  35. BFRT_EXPORT static float Round(float a);
  36. BFRT_EXPORT static double Round(double a);
  37. BFRT_EXPORT static float Sqrt(float f);
  38. BFRT_EXPORT static double Sqrt(double d);
  39. BFRT_EXPORT static float Cbrt(float f);
  40. BFRT_EXPORT static double Cbrt(double d);
  41. BFRT_EXPORT static float Log(float d);
  42. BFRT_EXPORT static double Log(double d);
  43. BFRT_EXPORT static float Log10(float d);
  44. BFRT_EXPORT static double Log10(double d);
  45. BFRT_EXPORT static float Exp(float d);
  46. BFRT_EXPORT static double Exp(double d);
  47. BFRT_EXPORT static float Pow(float x, float y);
  48. BFRT_EXPORT static double Pow(double x, double y);
  49. BFRT_EXPORT static float Abs(float value);
  50. BFRT_EXPORT static double Abs(double value);
  51. };
  52. }
  53. }
  54. using namespace bf::System;
  55. float Math::Acos(float d)
  56. {
  57. return acosf(d);
  58. }
  59. double Math::Acos(double d)
  60. {
  61. return acos(d);
  62. }
  63. float Math::Asin(float d)
  64. {
  65. return asinf(d);
  66. }
  67. double Math::Asin(double d)
  68. {
  69. return asin(d);
  70. }
  71. float Math::Atan(float d)
  72. {
  73. return atanf(d);
  74. }
  75. double Math::Atan(double d)
  76. {
  77. return atan(d);
  78. }
  79. float Math::Atan2(float y, float x)
  80. {
  81. return atan2f(y, x);
  82. }
  83. double Math::Atan2(double y,double x)
  84. {
  85. return atan2(y, x);
  86. }
  87. float Math::Ceiling(float a)
  88. {
  89. return ceilf(a);
  90. }
  91. double Math::Ceiling(double a)
  92. {
  93. return ceil(a);
  94. }
  95. float Math::Cos(float d)
  96. {
  97. return cosf(d);
  98. }
  99. double Math::Cos(double d)
  100. {
  101. return cos(d);
  102. }
  103. float Math::Cosh(float d)
  104. {
  105. return coshf(d);
  106. }
  107. double Math::Cosh(double d)
  108. {
  109. return cosh(d);
  110. }
  111. float Math::Floor(float d)
  112. {
  113. return floorf(d);
  114. }
  115. double Math::Floor(double d)
  116. {
  117. return floor(d);
  118. }
  119. float Math::Sin(float a)
  120. {
  121. return sinf(a);
  122. }
  123. double Math::Sin(double a)
  124. {
  125. return sin(a);
  126. }
  127. float Math::Tan(float a)
  128. {
  129. return tanf(a);
  130. }
  131. double Math::Tan(double a)
  132. {
  133. return tan(a);
  134. }
  135. float Math::Sinh(float value)
  136. {
  137. return sinhf(value);
  138. }
  139. double Math::Sinh(double value)
  140. {
  141. return sinh(value);
  142. }
  143. float Math::Tanh(float value)
  144. {
  145. return tanhf(value);
  146. }
  147. double Math::Tanh(double value)
  148. {
  149. return tanh(value);
  150. }
  151. float Math::Round(float a)
  152. {
  153. return roundf(a);
  154. }
  155. double Math::Round(double a)
  156. {
  157. return round(a);
  158. }
  159. float Math::Sqrt(float f)
  160. {
  161. return sqrtf(f);
  162. }
  163. double Math::Sqrt(double d)
  164. {
  165. return sqrt(d);
  166. }
  167. float Math::Cbrt(float f)
  168. {
  169. return cbrtf(f);
  170. }
  171. double Math::Cbrt(double d)
  172. {
  173. return cbrt(d);
  174. }
  175. float Math::Log(float d)
  176. {
  177. return logf(d);
  178. }
  179. double Math::Log(double d)
  180. {
  181. return log(d);
  182. }
  183. float Math::Log10(float d)
  184. {
  185. return log10f(d);
  186. }
  187. double Math::Log10(double d)
  188. {
  189. return log10(d);
  190. }
  191. float Math::Exp(float d)
  192. {
  193. return expf(d);
  194. }
  195. double Math::Exp(double d)
  196. {
  197. return exp(d);
  198. }
  199. float Math::Pow(float x, float y)
  200. {
  201. return powf(x, y);
  202. }
  203. double Math::Pow(double x, double y)
  204. {
  205. return pow(x, y);
  206. }
  207. float Math::Abs(float value)
  208. {
  209. return (float)fabs(value);
  210. }
  211. double Math::Abs(double value)
  212. {
  213. return fabs(value);
  214. }