# Conum

# WORK IN PROGRESS

*The best numbers on Earth.*

tl;dr: This is probably the ultimate way to represent all traditional numbers, be it signed or unsigned integers, fixed of floating point. This is all super work in progress.

*CN(B,E,F,S)*

For example *CN(B,0,0,2)* represents two's complement integers, *CN(B,0,2,1)* represents one's complement fixed point numbers with 2 fractional bits, *CN(B,3,3,0)* represents a certain kind of unsigned floating point numbers etc.

- *N*, the total number of bits, equal to *B + E*
- *B*, number of "base" bits (non-negative integer)
- *E*, number of "exponent" bits (non-negative integer)
- *b*, unsigned integer value stored in base bits
- *e*, unsigned integer value stored in exponent bits
- *F*, number of fractional bits (non-negative integer)
- *S*, the sign method
- *x*, the represented number

The represented number is:

```
x = ((2^B + b) * 2^e - 2^B) / 2^F
```



### Sign

- *0* (unsigned): The number is unsigned, only expresses non-negative values
- *1* (one's complement): The highest bit tells the sign as with *s*, to obtain positive number from negative just invert all bits. Negative zero can be treated as with *s*.
- *2* (two's complement): The highest bit tells the sign as with *s*, to obtain positive number from negative invert all bits and add 1.
- *3* (sign bit): The highest bits is reserved for sign (1 means negative, 0 non-negative), the rest of bits encodes the number. Negative zero can be treated as a special value (infinity, Nan, ...)