9front - general discussion about 9front
 help / color / mirror / Atom feed
* Re: [9fans] dc(1) exponent limits
       [not found] <f4e540e1bbb930dc@orthanc.ca>
@ 2020-07-31  8:15 ` Romano
  2020-07-31 15:52   ` [9front] " ori
  0 siblings, 1 reply; 2+ messages in thread
From: Romano @ 2020-07-31  8:15 UTC (permalink / raw)
  To: 9front

9front dc has the same problem. Any objection to the patch below being applied?

On Mon, Dec 16, 2019, at 1:41 PM, Lyndon Nerenberg wrote:
> 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
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9front] Re: [9fans] dc(1) exponent limits
  2020-07-31  8:15 ` [9fans] dc(1) exponent limits Romano
@ 2020-07-31 15:52   ` ori
  0 siblings, 0 replies; 2+ messages in thread
From: ori @ 2020-07-31 15:52 UTC (permalink / raw)
  To: unobe, 9front

> 9front dc has the same problem. Any objection to the patch below being applied?

Sounds good to me. Just tested -- the results seem correct, or at least
match what python prints. I increased the maximum to 5, because bigger is
better.

For what it's worth, my cpu server runs that in 166 seconds, so about 18
times faster than lyndon's pi.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-31 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <f4e540e1bbb930dc@orthanc.ca>
2020-07-31  8:15 ` [9fans] dc(1) exponent limits Romano
2020-07-31 15:52   ` [9front] " ori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).