Binary representation of floating-point numbers
github.com
github.com
Right after we finish rewriting everything in Rust, of course.
1. Closed operations without exceptions; 2. a total strict ordering.
Additionally, being able to represent positive and negative infinity is convenient and makes closing the operations easier without having to resort too much to the catch-all nan/undefined value.
So rather than a single point at positive/negative infinity in posits, which would once again introduce the mistake of a non-total or non-strict order and lack of exception-free math, I would much prefer this (for the 4-bit posit, listed in ascending order):
1001 -> -111 -> -inf
1010 -> -110 -> -4
1011 -> -101 -> -2
1100 -> -100 -> -1
1101 -> -011 -> -1/2
1110 -> -010 -> -1/4
1111 -> -001 -> -1/16
1000 -> -000 -> undefined
0000 -> +000 -> 0
0001 -> +001 -> 1/16
0010 -> +010 -> 1/4
0011 -> +011 -> 1/2
0100 -> +100 -> 1
0101 -> +101 -> 2
0110 -> +110 -> 4
0111 -> +111 -> inf
And yes, in this scheme 'undefined' would compare smaller than zero but bigger than any negative number. It is a bit arbitrary but much better than not having a total order. Any operation involving undefined would be undefined.EDIT: it seems that the original posit definition is also workable, where there is never any overflow and instead just rounding to the nearest number. The unfortunate thing is how the +/-inf value is labelled: it should just be called 'nan' or 'undefined' or 'indeterminate' or something similar. It can never be generated by overflowing operations. There should definitely be a total strict ordering however, so I do still recommend placing the undefined value right next to zero.
Incomplete view : https://softwareengineering.stackexchange.com/questions/2806...
> Additionally, being able to represent positive and negative infinity is convenient and makes closing the operations easier without having to resort too much to the catch-all nan/undefined value.
Which operations were you thinking about if not x/0?
1001 -> -111 -> -inf
1010 -> -110 -> -4
1011 -> -101 -> -2
1100 -> -100 -> -1
1101 -> -011 -> -1/2
1110 -> -010 -> -1/4
1111 -> -001 -> -1/inf
1000 -> -000 -> undefined
0000 -> +000 -> 0
0001 -> +001 -> 1/inf
0010 -> +010 -> 1/4
0011 -> +011 -> 1/2
0100 -> +100 -> 1
0101 -> +101 -> 2
0110 -> +110 -> 4
0111 -> +111 -> inf
Then 1/0 would still remain undefined but 1/(1/inf) would be inf. In particular the operations would be (in case of ambiguity first rule applies, s is a sign variable, x, y are arbitrary variables, i, j are
infinity or infinitesimal variables): undef + x = undef
undef * x = undef
undef / x = undef
x / undef = undef
x / 0 = undef
inf + -inf = undef
1/inf + -1/inf = undef
s*inf + x = s*inf
s*1/inf + x = x
i*i = i
i*j = undef
i*x = i
i/j = undef
i/x = i
x/(s*inf) = s*1/inf
x/(s*1/inf) = s*inf
Then finally the infinities would get introduced by overflow, and infinitesimals by underflow.>At the heavenly North of the circle, symbolizing the Alpha and Omega, Our Father to which we solemly pray, lies the glorious positive and negative infinity. At its opposite, the wicked, immoral South of the circle, lies nothing of value, the value 000. Meanwhile, on the earthly plane, God's children enjoy free will, where they choose between positive one at the East and negative one at the West.
Who thought it would be a good idea to throw weirds jokes into a description of a number system? I'll probably just file posits next to Tensors in my mental model of the world (Tensors are just matrices for people with egos).
What were you expecting from an author who titled the article "The Cult of Posits"?
> I'll probably just file posits next to Tensors in my mental model of the world (Tensors are just matrices for people with egos).
You forgot to add Rust to that list >:-)