Re-enable spec/library for full CI runs.
[rbx.git] / kernel / platform / math.rb
blob8076019fed34553e309a6c16dd1e30d04c2f10a8
1 # depends on: ffi.rb
3 ##
4 # Platform specific behavior for Math.
6 module Platform::Math
7   attach_function "atan2", [:double, :double], :double
8   attach_function "cos",   [:double], :double
9   attach_function "sin",   [:double], :double
10   attach_function "tan",   [:double], :double
11   attach_function "acos",  [:double], :double
12   attach_function "asin",  [:double], :double
13   attach_function "atan",  [:double], :double
14   attach_function "cosh",  [:double], :double
15   attach_function "sinh",  [:double], :double
16   attach_function "tanh",  [:double], :double
17   attach_function "acosh", [:double], :double
18   attach_function "asinh", [:double], :double
19   attach_function "atanh", [:double], :double
20   attach_function "exp",   [:double], :double
21   attach_function "log",   [:double], :double
22   attach_function "log10", [:double], :double
23   attach_function "sqrt",  [:double], :double
24   attach_function "frexp", [:double, :pointer], :double
25   attach_function "ldexp", [:double, :int], :double
26   attach_function "hypot", [:double, :double], :double
27   attach_function "erf",   [:double], :double
28   attach_function "erfc",  [:double], :double
30   # TODO: we need a way to determine whether a function
31   #   is defined for a particular platform.
32   # attach_function "log2",  [:double], :double
33   def self.log2(x)
34     log10(x) / log10(2.0)
35   end
36 end