First NIT release and new clean mercurial repository
[nit.git] / lib / standard / math.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2004-2008 Jean Privat <jean@pryen.org>
4 #
5 # This file is free software, which comes along with NIT. This software is
6 # distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
7 # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
8 # PARTICULAR PURPOSE. You can modify it is you want, provided this header
9 # is kept unaltered, and a notification of the changes is added.
10 # You are allowed to redistribute it and sell it, alone or is a part of
11 # another product.
12
13 # Mathematical operations
14 package math
15
16 import kernel
17
18 redef class Int
19 meth rand: Int is extern "kernel_Int_Int_rand_0"
20 end
21
22 redef class Float
23 meth sqrt: Float is extern "kernel_Float_Float_sqrt_0"
24 meth cos: Float is extern "kernel_Float_Float_cos_0"
25 meth sin: Float is extern "kernel_Float_Float_sin_0"
26 meth tan: Float is extern "kernel_Float_Float_tan_0"
27 meth acos: Float is extern "kernel_Float_Float_acos_0"
28 meth asin: Float is extern "kernel_Float_Float_asin_0"
29 meth atan: Float is extern "kernel_Float_Float_atan_0"
30
31 meth pow(e: Float): Float is extern "kernel_Float_Float_pow_1"
32 meth log: Float is extern "kernel_Float_Float_log_0"
33 meth exp: Float is extern "kernel_Float_Float_exp_0"
34
35 meth rand: Float is extern "kernel_Float_Float_rand_0"
36 end
37
38 meth atan2(x: Float, y: Float): Float is extern "kernel_Any_Any_atan2_2"
39 meth pi: Float is extern "kernel_Any_Any_pi_0"
40 meth srand_from(x: Int) is extern "kernel_Any_Any_srand_from_1"
41 meth srand is extern "kernel_Any_Any_srand_0"