Scratch that!

(I shouldn't be up so late at night...)

My previous version of maxint wasn't returning a reliable integer, but
sometimes floating point.

Revised experiment:

   JVERSION
Engine: j701/2011-01-10/11:25 build: Feb  6 2011 16:16:29
Library: 7.01.043
Platform: Darwin 64
Installer: j701a_mac64.dmg

InstallPath: /Applications/j64-701

   maxint
3 : 0
z=. <. 2^(y-1)
<. z+(z-1)
)
   (aa-1)=aa=:  maxint 44
0
   (aa-1)=aa=:  maxint 45
0
   (aa-1)=aa=:  maxint 63
0
   (aa-1)=aa=:  maxint 64
1

   _1 + 2^63x
9223372036854775807
   maxint 63
9223372036854775807
   datatype maxint 63
integer
   datatype _1+maxint 63
integer
   datatype 1+maxint 63
floating
...the tipping-point.

which is no surprise at all with 64 bit integers.

Verb: factors -still can't factorize (maxint 63).
But if I integerize the intermediates, it doesn't hang, now. And it
can actually factorize (maxint 60):

   (a=z);(a=: */ff);z;(ff=: factors z=: maxint 60)
┌─┬───────────────────┬───────────────────┬─────────────────────────────────────┐
│1│1152921504606846975│1152921504606846975│3 3 5 5 7 11 13 31 41 61
151 331 1321│
└─┴───────────────────┴───────────────────┴─────────────────────────────────────┘

But it gets it wrong sporadically starting with maxint 53 ...
   (a=z);(a=: */ff);z;ff=: factors z=: maxint 53
┌─┬────────────────┬────────────────┬────────────────┐
│0│9007199254740992│9007199254740991│9007199254740992│
└─┴────────────────┴────────────────┴────────────────┘

What seems to be happening is that the computation of intermediate y
overflows, and becomes imprecise.

Haven't isolated what's causing j64 to hang. But I suspect Line 5 of:
factors, when it gets a floating y.



>   JVERSION
> Engine: j701/2011-01-10/11:25 build: Feb  6 2011 16:16:29
> Library: 7.01.043
> Platform: Darwin 64
> Installer: j701a_mac64.dmg
>
> InstallPath: /Applications/j64-701
>   (z-1) = z=: maxint 44
> 0
>   (z-1) = z=: maxint 45
> 1
>
> ...no different.
> (Why should I be surprised at that?)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to