Module: Elixir::Float

Defined in:
lib/elixir/float.rb

Class Method Summary collapse

Class Method Details

.ceil(number, precision = 0) ⇒ Object



5
6
7
8
# File 'lib/elixir/float.rb', line 5

def ceil number, precision = 0
  # TODO: precision
  number.ceil
end

.floor(number, precision = 0) ⇒ Object



10
11
12
13
# File 'lib/elixir/float.rb', line 10

def floor number, precision = 0
  # TODO: precision
  number.floor
end

.parse(string) ⇒ Object



15
16
17
18
19
20
# File 'lib/elixir/float.rb', line 15

def parse string
  return :error unless string =~ /\A\d/
  string_match = string.match /\A\d+\.?\d*/

  [Float(string_match.to_s), string_match.post_match]
end

.round(number, precision = 0) ⇒ Object



22
23
24
# File 'lib/elixir/float.rb', line 22

def round number, precision = 0
  number.round precision
end

.to_char_list(number, options = nil) ⇒ Object



26
27
28
# File 'lib/elixir/float.rb', line 26

def to_char_list number, options = nil
  # TODO
end

.to_string(float, options = nil) ⇒ Object



30
31
32
# File 'lib/elixir/float.rb', line 30

def to_string float, options = nil
  # TODO
end