Quote Originally Posted by Petr Schreiber View Post
I was confused at first, but then I realised I cannot use passed strings directly, but need to use the BigInt_FromString and BigInt_ToString.
Correct. I thought about making all functions "auto-recognise" but I found it just too much trouble. Also, for a true auto-recognise I would want it to work with numerical variables as well and I just couldn't get the Variant bit to work. So I stuck with the internal representation.

You can get strange results if you try to print (to Console) internal BigInt strings directly, without using BigInt_ToString. Look out for that.

That would also be a problem because if conversion from ASCII to internal is automatic, you'd expect the reverse to be true as well: automatic conversion from internal to ASCII when printing. But for that I would have to make this a proper thinBasic module and if I understand it correctly I would have to use an SDK, and there isn't one for thinBasic, only for PowerBasic and FreeBasic.

I am thinking of doing the low-level functions (BII_add, _sub, _mul, _mli, _div, _dvi) in assembler. That should speed things up enormously. If I'm going to do that I'll make some test cases first to check the speed in pure Basic so I can compare it with the assembler version. I'm not guaranteeing anything because I am very busy with work right now and I'm also thinking about writing high-precision (128-bit) floating-point functions.