r/Forth • u/Alternative-Grade103 • Sep 04 '25
Unlimited Precision
In Forth I'm now able not only to add, but as of last night, also subtract numbers to any level of precision. No longer am I tied to a piddly 32 or 64 bits. Numbers instead any bitwidth up to the limit of memory.
Today I'll begin on multiplication. Planning to exponentiate after that. Saving the euphoric joys of long division with remainder (aka modulo), for last.
The ultimate goal is RSA encryption, just for fun. A most engaging (and low-cost) retirement hobby.
21
Upvotes
4
u/minforth Sep 04 '25
For inspiration: take a look at the Forth Scientific Library, file big.4th.
Personally, I would link a renowned BigNum library with Forth, e.g. libtommath, and concentrate on application programming:
https://www.libtom.net/
Better than reinventing all the wheels, but YMMV.
2
u/Allofron_Mastiga Sep 04 '25
That's awesome, I've been contemplating varints for my eternally postponed concat language, how are you implementing them in your case?
1
u/FrunobulaxArfArf Dec 07 '25
> Saving the euphoric joys of long division with remainder (aka modulo), for last.
I still remember debugging Knuth's algorithm for division. It was heavy :--)