Method: BinData::FloatingPoint.create_to_binary_s_code
- Defined in:
- lib/bindata/float.rb
.create_to_binary_s_code(precision, endian) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/bindata/float.rb', line 48 def create_to_binary_s_code(precision, endian) if precision == :single pack = (endian == :little) ? 'e' : 'g' else # double_precision pack = (endian == :little) ? 'E' : 'G' end "[val].pack('#{pack}')" end |