proposals

Formal proposals for changes to the code, new libraries, etc.

View the Project on GitHub

stdnum

A library that provides commonly used numerical representations. All of these are derived from number so they are all serializable and are all stringifiable in the same way.

Provides pre-sized types similar to those from stdint.h:

varint

Aliases: varnum, vlq

Represents variably sized quantities such as:

Keys

Note that sign, inherited from number, effectively does nothing in this struct. TODO: It may not be available or it may reflect the existence of a sign bit in format.

Pre-defined forms

varint leb128 {
    format: cnnnnnnn
    endian: little
    transform: signed
}

varint uleb128 {
    format: cnnnnnnn
    endian: little
}

Other examples

varint UnrealSignedVLQ {
    format {
        first: csnnnnnn
        other: cnnnnnnn
    }
    endian: big
}

varint GoogleProtobuf {
    format: cnnnnnnn
    endian: little
    transform: zigzag
}

varint GitVLQ {
    format: cnnnnnnn
    # TODO: endian
    transform: math("n + (1 << (k - 7))")
}

fraction

Represents a lossless floating point number by storing the numerator and denominator as separate bigints.

The basic value is the float value, which may be lossy depending on implementation.

Keys

ieee754

Alias: iec559

Represents IEEE 754 standard floating point numbers.

The basic value is the floating point value, ideally represented in memory in the same level of precision as requested.

Keys

Special note that sign does not refer to the IEEE 754 sign bit. Rather, it is always signed. Additionally, the sign bit is always a size of 1.

Pre-defined forms

TODO: binary16, binary32, binary64, binary128, binary256, decimal32, decimal64, decimal128

vector

TODO: what is this/is it actually useful