Class: Float

Inherits:
Object show all
Defined in:
lib/gri/mmsgpack.rb

Instance Method Summary collapse

Instance Method Details

#to_msgpackObject



16
17
18
19
20
21
22
23
24
# File 'lib/gri/mmsgpack.rb', line 16

def to_msgpack
  if self < 4294967296
    "\xce"+[(self/65536).to_i, self%65536].pack('n2')
  else
    "\xcf"+[(self/281474976710656).to_i,
      (self/4294967296%65536).to_i,
      (self%4294967296/65536).to_i, self%65536].pack('n4')
  end
end