p. uses rationals if possible in order to produce good results on
"monsters".  For example:

   c=: p. 1;1+i.20  NB. coefficients of Wilkinson's polynomial
<https://en.wikipedia.org/wiki/Wilkinson%27s_polynomial>
   c
2432902008176640000 _8752948036761600000 13803759753640704000
_12870931245150988800 8037811822645051776 _3599979517947607200
1206647803780373360 _311333643161390640 63030812099294896
_10142299865511450 1307535010540395 _135585182899530 11310276995381 _7561...

   p. c             NB. roots thereof
┌─┬──────────────────────────────────────────────────┐
│1│20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1│
└─┴──────────────────────────────────────────────────┘

   _0.5+0.5+c       NB. the "same" coefficients as floats
2.4329e18 _8.75295e18 1.38038e19 _1.28709e19 8.03781e18 _3.59998e18
1.20665e18 _3.11334e17 6.30308e16 _1.01423e16 1.30754e15 _1.35585e14
1.13103e13 _7.56111e11 4.01718e10 _1.67228e9 5.33279e7 _1.25685e6 20615
_210 1
   p. _0.5+0.5+c
┌─┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│1│20 18.9999 18.002 16.9975 16.0068 14.9934 14.0014 12.9979 11.9978
11.0031 10.0007 8.99974 8.00001 6.99999 6 5 4 3 2 1│
└─┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

   p. p. 1;i.40     NB. a super monster
┌─┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│1│39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0│
└─┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

   d=: p. 1; 2x^-1+i.20  NB. Wilkinson's second example
   d
1r1645504557321206042154969182557350504982735865633579863348609024
_1048575r822752278660603021077484591278675252491367932816789931674304512
183251413675r205688069665150755269371147819668813122841983204197482918576128
_6862582190715075r257110087081438444086...
   p. d
┌─┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│1│1r2 1r4 1r8 1r16 1r32 1r64 1r128 1r256 1r512 1r1024 1r2048 1r4096 1r8192
1r16384 1r32768 1r65536 1r131072 1r262144 1r524288 1r1048576│
└─┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Of course, using rationals does not solve the general problem, but it does
provide jaw dropping examples in a food fight.😁



On Tue, Jun 23, 2020 at 11:40 PM 'Bo Jacoby' via Programming <
[email protected]> wrote:

>    {:>{:p. _0.8 0.2 1
>
> 4r5
>
>    {:>{:p. _4 1 5
> 0.8
>
> Thanks!
> Bo
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to