While running some silly benchmarks I discovered dc's '^' operator
limits exponents to '9999'.  This seems arbitrary, perhaps a leftover
safety measure to keep things from eating all the CPU for days on
end on a slow machine?  I upped the limit to 99999 and the test
expression ran fine on a Pi4:

/n/dump/2019/1215.2/sys/src/cmd/dc.c:328,334 - dc.c:328,334
                                neg++;
                                chsign(arg1);
                        }
-                       if(length(arg1)>=3) {
+                       if(length(arg1)>=4) {
                                error("exp too big\n");
                        }
                        savk = sunputc(arg2);

If you're feeling bored and apply the above patch, consider running
this mini-bench and mailing the output directly to me:

echo -n `{cat /dev/cputype}^' ** ' ; echo 652342 52342 '^' 34232342 / p q | 
time dc >/dev/null

It will take a while to run (50 minutes on the Pi4).

--lyndon

------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Te871fd8fbfd16f42-M7982246eb4b86450cf74cc30
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to