Chris Nicholas @chrisnicholas.dev · May 12

What if Alice and Bob both pick the exact same fractional index, say `0.75`? It stops working. The fix: give every user a unique ID and append it to the index. Alice's `0.75` becomes `0.75-001`, Bob's becomes `0.75-002`. No two indices can ever collide.

1 likes 1 replies

?

Replies

Chris Nicholas · May 12

Decimals only work in theory. Floating point decimals runs out of precision after ~50 inserts at the end of the list, as you can see below. Storing indices as strings fixes that, but we've still got another problem—indices keep growing.