The speed of extended precision arithmetic depends on the speed of
multiplication.  The extended precision multiplication in J is not the
best, or even very good: O(n*2).  gmp is I believe O(n*^.n) and much
better.  This makes a difference when the number of digits is 1e5 or more.

It's easy to figure out the number of (decimal) digits of
9223372036854775807x^1000000 :

   1 + <. 1e6*10^.9223372036854775807
18964890



On Fri, Jan 24, 2014 at 10:57 AM, Raul Miller <[email protected]> wrote:

> This uses floating point:
>    9223372036854775807^1000000
>
> This uses arbitrary precision integers (and takes quite some time):
>    9223372036854775807x^1000000
>
> if you have the patience to try that calculation (I do not) you might
> want to stick the result in a variable so you can distinguish between
> computation time and display formatting time.
>
> For more detail on numeric representation issues, you might like
> http://www.jsoftware.com/help/dictionary/dictg.htm
>
> Thanks,
>
> --
> Raul
>
>
> On Fri, Jan 24, 2014 at 1:29 PM, Joe Bogner <[email protected]> wrote:
> > Fun question. I checked that too before sending the message.
> > typemax(BigInt) isn't implemented
> >
> >  BigInt(typemax(Int64)) ^ 1000000 gives me a big number
> >
> > According to wolfram alpha (since I didn't know how to easily count
> > the digits in Julia) ....
> >
> > The number has 1,8964,890 decimal digits
> >
> > BigInt wraps the GNU GMP library which apparently can be used to
> > calculate a billion digits of pi https://gmplib.org/pi-with-gmp.html
> >
> > J doesn't apparently like numbers that big or I need to do something
> > different to enable them
> >
> >  9223372036854775807^1000000
> > _
> >
> > Looks like it stops around to the 16th power
> >
> >    9223372036854775807^16
> > 2.74306e303
> >
> >    9223372036854775807^17
> > _
> >
> > On Fri, Jan 24, 2014 at 1:18 PM, Dan Bron <[email protected]> wrote:
> >>
> >>            4*{:$3!:3]2
> >>         64
> >>
> >> -Dan
> >>
> >> PS:  What is typemax(BigInt)  ?
> >>
> >>
> >> ----- Original Message ---------------
> >>
> >> Subject: Re: [Jchat] [Jprogramming] more fork examples
> >>    From: Joe Bogner <[email protected]>
> >>    Date: Fri, 24 Jan 2014 13:09:51 -0500
> >>      To: [email protected]
> >>
> >> julia> typemax(Int64)
> >> 9223372036854775807
> >>
> >>
> >>
> >> On Fri, Jan 24, 2014 at 1:08 PM, Joe Bogner <[email protected]>
> wrote:
> >>> Neat...
> >>>
> >>> julia> 9223372036854775807
> >>> 9223372036854775807
> >>>
> >>> julia> 9223372036854775807+1
> >>> -9223372036854775808
> >>>
> >>> Need to use BigInt
> >>>
> >>> julia> BigInt(9223372036854775807)+1
> >>> 9223372036854775808
> >>>
> >>>
> >>>
> >>> On Fri, Jan 24, 2014 at 12:56 PM, Dan Bron <[email protected]> wrote:
> >>>> What's the highest value a signed integer can represent on your
> platform
> >>>> (ie. 32 bit or 64 bit)?
> >>>>
> >>>>    |>:{.i:_j1
> >>>> 9223372036854775807
> >>>>
> >>>>    1 + |>:{.i:_j1   NB. Now floating-point
> >>>> 9.22337e18
> >>>>
> >>>> -Dan
> >>>>
> >>>>
> >>>> ----- Original Message ---------------
> >>>>
> >>>> Subject: Re: [Jchat] [Jprogramming] more fork examples
> >>>>    From: Devon McCormick <[email protected]>
> >>>>    Date: Fri, 24 Jan 2014 12:31:53 -0500
> >>>>      To: Chat forum <[email protected]>
> >>>>
> >>>> What's 2147483647+1 in Julia?
> >>>>
> >>>>
> >>>> On Fri, Jan 24, 2014 at 10:07 AM, Joe Bogner <[email protected]>
> wrote:
> >>>>
> >>>>> My experience with python is that it's difficult to set up an scipy
> >>>>> environment on windows. There are packaged solutions, like
> Anaconda[1]
> >>>>> that simplify it greatly, but it's still a 340MB download. I've
> >>>>> installed all the packages manually before and dealt with the
> >>>>> dependencies. It probably took about an hour of trial and error. My
> >>>>> install folder is 800MB
> >>>>>
> >>>>> It works well once it's up and running. I haven't had it break, but
> >>>>> I'm also afraid to update anything. Fortunately, it's a relatively
> >>>>> complete environment for what I'm using it for.
> >>>>>
> >>>>> I would not want to try and push it out to a team.
> >>>>>
> >>>>> R just works and it's package manager has never let me down. It's
> easy
> >>>>> to update packages and the dependencies are resolved. It's generally
> >>>>> fast enough for what I'm doing.
> >>>>>
> >>>>> I've played with Julia on and off over the past year and it's looking
> >>>>> more and more like a useful platform. There wasn't a pre-built 64-bit
> >>>>> binary as-of 6 months ago. It was released about 4 months ago. I read
> >>>>> this article yesterday that re-invigorated my interest.
> >>>>> http://www.evanmiller.org/why-im-betting-on-julia.html As a language
> >>>>> geek, it's neat to see what's really happening under the hood. It's
> >>>>> array handling is fairly clean
> >>>>> (http://docs.julialang.org/en/latest/manual/arrays/)
> >>>>>
> >>>>>
> >>>>> julia> [1 2 3] + 1
> >>>>> 1x3 Array{Int32,2}:
> >>>>>  2  3  4
> >>>>>
> >>>>> julia> [1 2 3] + [2 3 4]
> >>>>> 1x3 Array{Int32,2}:
> >>>>>  3  5  7
> >>>>>
> >>>>> This made me cringe... Probably a slightly nicer way to do it:
> >>>>>
> >>>>> julia> map(x->length(x) > 0 ? first(x) : -1, map((y) -> find((x) ->
> >>>>> x==y,[1,2,3]
> >>>>> ),[1,2,5,1]))
> >>>>>
> >>>>> 4-element Array{Int32,1}:
> >>>>>   1
> >>>>>   2
> >>>>>  -1
> >>>>>   1
> >>>>>
> >>>>> Compared to
> >>>>>
> >>>>>    (1 2 3) i. (1 2 5 1)
> >>>>> 0 1 3 0
> >>>>>
> >>>>> Sidenote: (Julia arrays are 1-based and I substituted -1 instead of
> >>>>> length for not found):
> >>>>>
> >>>>> That being said, it does have coroutines and worker processes,
> >>>>> http://docs.julialang.org/en/latest/manual/parallel-computing/
> >>>>>
> >>>>> [1] - http://continuum.io/downloads
> >>>>>
> ----------------------------------------------------------------------
> >>>>> For information about J forums see
> http://www.jsoftware.com/forums.htm
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> Devon McCormick, CFA
> >>>> ----------------------------------------------------------------------
> >>>> 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
> ----------------------------------------------------------------------
> 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