Class: Exonum::Float64T

Inherits:
Object
  • Object
show all
Defined in:
lib/exonum/types/primitive.rb

Class Method Summary collapse

Class Method Details

.fixed?Boolean

Returns:

  • (Boolean)


181
182
183
# File 'lib/exonum/types/primitive.rb', line 181

def self.fixed?
  true
end

.serialize(value, buffer, from, shift = 0) ⇒ Object



185
186
187
188
189
190
191
# File 'lib/exonum/types/primitive.rb', line 185

def self.serialize value, buffer, from, shift=0
  value = (value * FLOAT_PRECISION_MULTIPLIER).round / FLOAT_PRECISION_MULTIPLIER
  [value].pack('E').bytes.each do |byte|
    buffer[from] = byte
    from += 1
  end
end

.sizeObject



177
178
179
# File 'lib/exonum/types/primitive.rb', line 177

def self.size
  8
end