# File lib/spreadsheet/excel/writer/worksheet.rb, line 58
  def encode_rk value
    #  Bit  Mask        Contents
    #    0  0x00000001  0 = Value not changed 1 = Value is multiplied by 100
    #    1  0x00000002  0 = Floating-point value 1 = Signed integer value
    # 31-2  0xFFFFFFFC  Encoded value
    cent = 0
    int = 2
    higher = value * 100
    if higher.is_a?(Float) && higher < 0xfffffffc
      cent = 1
      if higher == higher.to_i
        value = higher.to_i
      else
        value = higher
      end
    end
    if value.is_a?(Integer)
      ## although not documented as signed, 'V' appears to correctly pack
      #  negative numbers.
      value <<= 2
    else
      # FIXME: precision of small numbers
      int = 0
      value, = [value].pack(EIGHT_BYTE_DOUBLE).unpack('x4V')
      value &= 0xfffffffc
    end
    value | cent | int
  end