Results 1 to 2 of 2

Thread: Opencl arbitary precision and calculating factorial

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    10

    Opencl arbitary precision and calculating factorial

    Hi All!

    I have a problem calculating a "big" factorial. The big problem is, that I can't write into a ulong16 vector. Here you can download my code:
    http://grid.kfki.hu/afs/szaqaei/web/...fastfactorial/ .

    The algorithm is easy:
    Get the primes from 3 to n, then calculate their exponents using this equation:
    exponent(p)=floor(n,p)+floor(n,p^2)+...... while the parts of this sum greater than 1 and so on. (This algorithm is made by Crandall, you can find the algorhitm in his book) .

    The main problem is I couldn't write into n_factor ( named ulong16 Product in the kernel).
    I think the problem is not big, but I'm a bit tired and I can't find it.

    Thanks in advance,
    Adam

  2. #2
    Junior Member
    Join Date
    Nov 2011
    Posts
    10

    Re: Opencl arbitary precision and calculating factorial

    I figured it out. I had to cast the values of primes and shift the gid e.g.:
    sgid=(gid<<1);
    primes[sgid] -> (long long unsigned int) primes[sgid];

Similar Threads

  1. pow precision
    By yoavhacohen in forum OpenCL
    Replies: 2
    Last Post: 02-03-2012, 02:34 AM
  2. Camera - calculating direction, up and right vectors
    By Achilles4689 in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 4
    Last Post: 10-13-2011, 02:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •