m10a & variants work on extremely large numbers.
So does G if you use 5x instead of 5. e.g.
m10a=: [: +/ <[EMAIL PROTECTED]&5^:(>:@i.@>.@(5&^.)`])
m10a 10^100x
2499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999982
G 10^100x
2.5e99
Gx=: [: +/ ] <[EMAIL PROTECTED] >:@i.@<.&.(5x&^.)
Gx 10^100x
2499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999982
m10a 10^1000x
2499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...
t=: m10a 10^1000x
(":t) -: '24',(995$'9'),'785'
1
----- Original Message -----
From: Raul Miller <[EMAIL PROTECTED]>
Date: Sunday, August 26, 2007 2:15
Subject: Re: [Jprogramming] Trailing 0's
To: Programming forum <[email protected]>
> On 8/24/07, John Randall <[EMAIL PROTECTED]> wrote:
> > f=:[: +/ 5 = [: , [: q: [: >: i.
>
> Or:
> F=: [: +/ 3 {:@q: 1 + i.
>
> Though, of course, the other style is radically more efficient:
> G=: [: +/ ] <[EMAIL PROTECTED] >:@i.@<.&.(5&^.)
> G 5e9
> 1249999998
>
> That said, there's something inconsistent here:
> G"0 1+i.10
> |domain error: G
> | G"0 1+i.10
> G"0(1 2 3 4 5 6 7 8 9 10)
> 0 0 0 0 1 1 1 1 1 2
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm