Function writeInt

  • Write a number that is sure to be an integer to the stream. If no mt is given writes major type POS_INT or NEG_INT as appropriate. Otherwise uses the given mt a the major type, and the value must be non-negative. Numbers with fractions are silently truncated to integer. Numbers outside the safe range silently lose precision. -0 is silently changed to 0.

    Parameters

    • val: number

      Number that is an integer that satisfies MIN_SAFE_INTEGER <= val <= MAX_SAFE_INTEGER.

    • w: Writer

      Writer.

    • Optionalmt: number

      Major type, if desired. Obj will be real integer > 0.

    Returns void

    On invalid combinations.