Big Integers (larger than long)

66 views
Skip to first unread message

sandy....@gmail.com

unread,
Apr 8, 2021, 6:58:59 AMApr 8
to Kdb+ Personal Developers
Anyone know how to handle numbers larger than long in kdb+?

I need to handle numbers with 20+ digits in kdb+. It seems there is no inbuilt data types for this, other than to store the number as a string or hex.

Does anyone know any KDB+ libraries to do hex math i.e. addition, multiplication on hex / binary numbers?

Alternatively, any C libraries to use?

Best,

Alexander

András Dőtsch

unread,
Apr 8, 2021, 7:35:06 AMApr 8
to personal...@googlegroups.com
Hi Alexander,

I think __int128 is available in GCC as an extension. I would store those 16byte ints as guids on the kdb side and develop the necessary functions in C.
This is interesting, I might come back to you with some prototype code today/tomorrow.

Regards,
Andras

--
You received this message because you are subscribed to the Google Groups "Kdb+ Personal Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to personal-kdbpl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/personal-kdbplus/729fef14-da80-4294-b039-52fff091f5d8n%40googlegroups.com.

Sandy Bradley

unread,
Apr 8, 2021, 8:01:19 AMApr 8
to personal...@googlegroups.com

Sandy Bradley

unread,
Apr 11, 2021, 10:46:39 AMApr 11
to personal...@googlegroups.com
To anyone looking for Big Integer arithmetic in future, I made a C library to integrate into kdb at:

https://github.com/manifoldfinance/qBigInt


András Dőtsch

unread,
Apr 11, 2021, 2:45:10 PMApr 11
to personal...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages