Shorter encoding for numbers (breaking change)
@PaulBlanche I realized that numbers are encoded with a huge amount of precision.
2 is encoded as FE500M2.00000000000000000000 ... that seems unnecessary to me?
I removed that, and noticed it failed on the close random number tests
so I tried just appending a number that we know is higher than 9, but only on negative numbers. This seems to work, tests pass.
cw.encode(-1)+'a' > cw.encode(-1.00000001)+'a'
I chose '_' as the end character, since it's higher than numbers, and makes the output more readable.
Yes indeed, numbers where encoded as "fixed length record". This was needed for the digit flipping trick to work on negative numbers.
Adding a char superior to 9 to the mantissa of a negative number should work, that's a nice idea !
Is there any desire to merge this compact change ?
I went ahead and publishes this breaking change by making a new package and naming it charwise-compact ( https://github.com/Raynos/charwise-compact ).
Oh I can't remember if there was something still wrong with this? Did all the tests pass etc? Possibly I just forgot about it?
On Wed, Mar 11, 2020, 04:20 Jake Verbaten [email protected] wrote:
I went ahead and publishes this breaking change by making a new package and naming it charwise-compact ( https://github.com/Raynos/charwise-compact ).
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dominictarr/charwise/pull/9?email_source=notifications&email_token=AAB7KLXWURQBLJ4NYXGGUODRGZLDNA5CNFSM4E7REMN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOL3JTI#issuecomment-597144781, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB7KLTHF4OJCV6OTWQT3WDRGZLDNANCNFSM4E7REMNQ .
From what i remember, everything was ok.
I suspect you either forgot about this or did not want to do any breaking changes or migrations of the key space in leveldb.
You have reviewed your own pull request. This is pretty meta.