I'm not saying their is no faster way to do anything. I know very well that there are several places to could be optimized. But, first everything has to work correctly -and with numbers longer than 19-digits. mul consists of triple-nested while loops -which are difficult to get right, at best. Are you sure your speedup are staying accurate everywhere.
I'm anxious to see what you've come up with -you mentioned fpow, so show what you are doing there that works without modified mul. Meanwhile, I've been writing a complete front-end execution block should catch everything you have been throwing at iq, like div bla / bla. It will also stop you from doing dangerous things. I've been quite distracted by you with the nonsense inputs. I hoped to get it ready for release, by getting to the bottom of every possible operation to flush out obscure, hard to replicate/understand calculation errors. The syntax is simple -and most be people can understand that if you throw BS at a program, strange, wonderful, or terrible things will happen.
If you want to contribute, your help is welcome -but which project, which is 98% ready, is gonna start messing with the deep internals by trying a lot of stuff at that point? It is still is not all about speed -as we have seen we can often compete head-to-head -and sometimes do what the others don't. I think you may be ignoring the subtleties needed for achieving correct results over a broad range of inputs. If you can create drop-in replacements for any function, they are welcome and could be included in the next release. I'm looking for iq_2.0 which 'just works'. iq_3.0 is a great place for changes to the methods which work better in anyway and that work under our targeted shells.
Maybe the best thing for you to do is write a complete system from scratch. iq is a complete re-write of an earlier, where I had to work out the basics of turning everything into an integer problem, finding the features/methods which would work apart from bash. That first write was deadly slow -and could do no series calculations like iq's add and mul do. I worked out the chunking method by writing a binary calculator and dec-bin-dec convertor. The point is that it took a complete re-write to improve the speed, range and re-design the workflow to allow series calculations.
From the start, it seemed more like you were making fun of me or my project. You would not respect the usage and made incomplete, untested suggestions. And, you admitted that you didn't understand why a division would involve subtraction, and that you thought that pow 'might' be calling mul. But then, when someone who understands math says iq is 'amazing', you suddenly change from a prankster to a ... what? Any shell script is a delicate thing -one single changed character can spoil the whole thing. Do you understand why ipow/epow need log, and the enormous task that nrt_solv has to calculate a given root? Even with a much faster mul/fpow, solving a fractional-exponent is still gonna be the Achilles-heel of pow -because that means solving roots.
The methods I am using now are not the first way I have found or tried. And they certainly are not the only possible ways. I've always worked out first, a way to do an honest calculation without using approximations -which are usually range-limited and usually only achieve accuracy by doing many iterations at large scales. The details about special cases and where best to handle them have implications in the function's structure and procedures -sometimes the flow has to be changed just because of them. For some ops, they can be handled without doing that and that's where optimizations of a method can be done easily, without causing 'ripples' through the other functions. And that's where completely new methods can be tried.
I really don't want to argue or explain anymore. Every time something comes up, I have to tried to address it, fix it as suggested, test the _users_ code, or explain why it won't easily work -and put lots of comments in the code about it all, change any documents/help which are affected. So that the user can follow the flow, learn how it fits together, and if they know about math, suggest workable changes to the mathematical methods. There are quite a few big reasons that, seemingly, no one has been able to get this far with a calculator written in shell. Can you solve e^(-x), with non-integer 'x', using code which you wrote from scratch and not relying on someone else's examples. I just wanted to play with some ai stuff in shell-only. I looked a lot for an existing calculator written in shell -and to this day have found or been shown anything that approaches iq. There are a couple which will 4-ops for numbers that fit the shell-math limits, hundreds which call bc/awk/other for any heavy work. Show us your code.