Printing numbers
These functions let you print numbers. These functions are very similar to the functions described in the Low-level number conversion chapter with the only exception that the functions described here do not return numbers, they just print them instead.
Name of each function consists of three parts:
In case the reader data was retrieved using the byte reader, all of these functions perform big-endian or little-endian byte reordering in accordance to the current byte-reorder mode set by Intel() or Motorola() functions. No byte reordering is done for reader data retrieved using the bit reader.
If bitness of reader data passed to these functions is greater than the requested output bitness, an error is generated. All functions extensively check the input data so if the reader data was somehow tampered with, an error may be generated.
PrintI8(ReaderData) PrintUI8(ReaderData) PrintI16(ReaderData) PrintUI16(ReaderData) PrintI32(ReaderData) PrintUI32(ReaderData) PrintI64(ReaderData) PrintUI64(ReaderData) PrintR32(ReaderData) PrintR64(ReaderData) PrintR80(ReaderData)
PrintUI8(), PrintUI16(), PrintUI32() and PrintUI64() functions simply expand read data to the requested number of bits and do not do any sign expansion by setting the non-present upper bits to zero. Therefore, they always print positive numbers.
PrintI8(), PrintI16(), PrintI32() and PrintI64() functions along with bitness expansion perform propagation of the most significant bit of the reader data to the upper bits of the resulting number, thus printing signed numbers.
PrintR32(), PrintR64() and PrintR80() functions do not perform any bintess expansion or sign extension and expect the corresponding number of bits to be present in the reader data. However, they perform byte reordering as directed by Intel() or Motorola() functions. These functions are direct equivalents of float, double and long double C data types correspondingy.
PrintR80() function internally casts its output (C long double type) to C double type so if the number is really big and does not fit the double range, an erroneous data may be returned.
All "PrintI..." and "PrintUI...." functions print their results in accordance with the currently chosen Number Output Mode.
All "PrintR..." functions format their numbers in accordance with the default Lua number printing rules.