I'm not sure that execution time is a significant bottleneck here. If it is, though, I don't think you can get much faster than: 10000 timespacex '9223372036854775807' 7.18584e_7 1408
That said, Henry's approach is about the same speed: 10000 timespacex '33 b.~_1' 7.46583e_7 1920 And if what you want is platform specific (different on 32 bit J from 64 bit J), Henry's approach would probably be the right way. That said, I still like this: 10000 timespacex '#.63#1' 7.71728e_7 1664 Maybe I'm just a sucker for polynomial representations? Thanks, -- Raul On Mon, May 26, 2014 at 3:07 PM, 'Pascal Jasmin' via Programming < [email protected]> wrote: > The 2 fastest versions I've found on my computer: > > 100 timespacex '( + <: ) */ +:@:*:^:2 ] 1024 16' > 3.4112e_6 4352 > > 100 timespacex '(+ <:) +:^:14 *:^:4 ] 8 ' > 5.5744e_6 3072 > > > The &. x: is obviously much more generic and practical for generating > "medium" sized numbers. > > 100 timespacex ' 2 <: &. x:@^ 63 ' > 8.064e_6 5632 > > > The importance of all this, btw, is that there is a significant size > penalty to storing extended integers, as well as a time/space compromise in > working with them. > > > > ----- Original Message ----- > From: 'Pascal Jasmin' via Programming <[email protected]> > To: "[email protected]" <[email protected]> > Cc: > Sent: Monday, May 26, 2014 2:35:14 PM > Subject: Re: [Jprogramming] 2^63 > > Might this be the fastest way of getting 2^63-1, without x: ? > > (<: + ] ) +:^:14 *:^:4 ] 8 > 9223372036854775807 > > worth noting: > > +:^:62 ] 2 > 9.22337e18 > +:^:61 ] 2 > 4611686018427387904 > > 2 <: &. x:@^ 63 > 9223372036854775807 > > > --- > actually this is probably best: > > 2 <: &. x:@^ 63 > 9223372036854775807 > 3!:0 ] 2 <: &. x:@^ 63 > 4 > > > > > ----- Original Message ----- > From: Raul Miller <[email protected]> > To: Programming forum <[email protected]> > Cc: > Sent: Monday, May 26, 2014 2:02:01 PM > Subject: Re: [Jprogramming] 2^63 > > Here's an interesting bug (I can't call this kind of issue a feature if > it's not documented in the dictionary, can I?): > > 9223372036854775809 > 9223372036854775807 > > (And that's probably more important than the "using ^" issue.) > > Thanks, > > -- > Raul > > > > > > > On Mon, May 26, 2014 at 1:55 PM, 'Pascal Jasmin' via Programming < > [email protected]> wrote: > > > is there a way to get ^ to make a 64bit number without it being extended > > precision? I guess an efficient alternative to ^ if that is not > possible: > > > > 2^63 > > 9.22337e18 > > 2^63x > > 9223372036854775808 > > 9223372036854775808 > > 9223372036854775807 > > > > Note that the last line is probably a problem. The answer is the largest > > non extended integer, but still unwelcome change from the input. > > > > 9223372036854775808-1 > > 9223372036854775806 > > 9223372036854775809-1 > > 9223372036854775806 > > > > I guess this works > > > > (<: + ] ) 4611686018427387904 > > NB. 2^62x > > 9223372036854775807 > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
