#community-help

Discussion on Capacity to Represent BigInt

TLDR ilia inquired about adding unsigned int64 for BigInt representation. Kishore Nallan suggested no immediate plans, but highlighted a workaround and also warned about misusing float for large values.

Powered by Struct AI
Aug 04, 2023 (4 months ago)
ilia
Photo of md5-c06627e5ffc62c0358b053cdc09b2ad0
ilia
02:15 PM
Any plans adding unsigned int64? Faced issue representing BigInt, and using string is suboptimal.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:39 PM
No plans at the moment, can you please create an issue on Github for us to track? We pick up tasks based on feedback from the community.
02:40
Kishore Nallan
02:40 PM
One really hacky way (as workaround) to represent uint64 is via two int64 fields. But you have to unpack and pack the variables on both read and write.
ilia
Photo of md5-c06627e5ffc62c0358b053cdc09b2ad0
ilia
03:46 PM
Thanks! I actually realised unsigned int64 doesn't cut for me. So f64 ( I think it's used in Typesense for float ) works fine for me, as I need to represent js BigInts.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:48 PM
float is 32 bits. If you try to store large values it will truncate.
ilia
Photo of md5-c06627e5ffc62c0358b053cdc09b2ad0
ilia
04:03 PM
Thanks, good to know. Luckily precision is not critical in my current use case.