Module: Argus::FloatEncoding

Included in:
Controller
Defined in:
lib/argus/float_encoding.rb

Class Method Summary collapse

Class Method Details

.decode_float(encoded_float) ⇒ Object



9
10
11
# File 'lib/argus/float_encoding.rb', line 9

def decode_float(encoded_float)
  [encoded_float].pack("l>").unpack("g").first
end

.encode_float(float) ⇒ Object



5
6
7
# File 'lib/argus/float_encoding.rb', line 5

def encode_float(float)
  [float].pack('g').unpack("l>").first
end