| ▲ | throwaway81523 5 hours ago | |||||||
GCC alread has this for x64, I thought. https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html RISC-V has no carry bit and this whole thing becomes awkward. I am under the impression that boost::multiprecision has specialized templates for 128 and 256 bit math, but maybe I'm wrong. In practice when I've wanted extended precision, I've just used GMP or a language with bignums. I would expect the best x86 machine code for many 128 bit operations would use XMM instructions, no? But I haven't investigated. | ||||||||
| ▲ | stackghost 2 hours ago | parent [-] | |||||||
>GMP When I was a teenager I downloaded some pirated games and reverse-engineered the installer/unpacker and discovered it used UHARC, which seemed to be almost magic in how well it could compress data compared to winzip. Knowing absolutely nothing about compression algorithms or information theory, I decided I'd write my own compression algorithm, as one does. I reasoned that since any computer value can be represented as a binary number, you could store the exponents to which you'd raise 2 and then just write those exponents to a file. Voila, lossless compression, can't believe nobody thought of this before. I used GMP so that I could "compress" arbitrarily large files (which would require handling arbitrarily large exponents). Except of course binary bits are already optimal for dense data, so my "compression" algorithm made things orders of magnitude larger, not smaller. But it was fast! All that to say GMP is a great library. Performant, and even an absolute moron like me could figure out how to use it in the days before ChatGPT. | ||||||||
| ||||||||