Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 34

Thread: Introducing NUMS -- an Arbitrary Precision Math Library

  1. #21
    thinBasic MVPs danbaron's Avatar
    Join Date
    Jan 2010
    Location
    California
    Posts
    1,378
    Rep Power
    152
    I think you are right, Bob.

    In that case, I think it was not necessary to set the precision in the program.

    I re-tested the program with large precisions, and now it doesn't seem to affect the elapsed time.

    But, I don't understand why the first time I set the precision to 460000 and ran the program, it took 842 seconds.

    Dan

    'You can set the precision in digits:
    nu_SetPrecision(%nu_SetPrec_Digits, 460000) 'NUMS math precision in digits
    
    ================       N  U  M  S       ===================
    ===========================================================
    
    Arbitrary precision floating point and integer math library
                     Free for personal use.
                  Commercial use not allowed.
                  Please read 'NUMS_EULA.txt'
                      (C) 2011 DevOTechS
                       www.devotechs.com
    
    ===========================================================
    Last Modified = 09-02-2011 at 11:15:08
    
    Program = Factorial.tbasic
    
        Factorial (n)
    
     100000! = 456575 digits
    
        842,025.731 msecs.
    
    Done...
    
    Press any key to end program.
    
    "You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields

  2. #22
    Quote Originally Posted by zak View Post
    is this normal Jack or it is my system somehow was under a not normal situation ?, i have windows xp, cpu 3GHz dual core (old generation), 3GB memory.
    hanks Jack again.
    the compile time is high, but I noticed the compile time is almost instantanaous on the Mac compared to the time it takes on a PC with MinGW,
    perhaps a newer version of MinGW is in order?

  3. #23
    Member REDEBOLT's Avatar
    Join Date
    Dec 2006
    Location
    Pickerington, Ohio, USA
    Age
    87
    Posts
    62
    Rep Power
    24
    Dan,

    Read the help topic "Disk caching."

    With caching turned off, There is a noticable delay on program start-up.
    Although I don't believe it would take fourteen minutes. Unless windows was running something in the background.

    On my machine, it takes about 40 seconds to calculate 100000!

    Bob

  4. #24
    thinBasic MVPs danbaron's Avatar
    Join Date
    Jan 2010
    Location
    California
    Posts
    1,378
    Rep Power
    152
    I read it, it's good, Bob.

    I think Eddy Van Esch made something good.

    Concerning the code,

    nu_SetOption(%nu_Opt_DiskCache, -2)  'Enable disk caching: use Windows temp directory
    
    I think "-2" indicates the current directory.

    Dan

    "You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields

  5. #25
    Member REDEBOLT's Avatar
    Join Date
    Dec 2006
    Location
    Pickerington, Ohio, USA
    Age
    87
    Posts
    62
    Rep Power
    24
    Quote Originally Posted by danbaron View Post
    I read it, it's good, Bob.

    I think Eddy Van Esch made something good.

    Concerning the code,

    nu_SetOption(%nu_Opt_DiskCache, -2)  'Enable disk caching: use Windows temp directory
    
    I think "-2" indicates the current directory.

    Dan

    Yes, Dan, you are correct. I changed the value but not the comment.

    Bob

  6. #26
    thinBasic MVPs danbaron's Avatar
    Join Date
    Jan 2010
    Location
    California
    Posts
    1,378
    Rep Power
    152
    My experience is that Perl is slow compared to Python and Ruby.

    (But, to me, Perl is a lot of fun. It seems there is nothing that is theoretically impossible to do in it.)

    ' code ------------------------------------------------------------------------------------
    
    # fact.pl
    
    use bignum;
    
    sub fact
    {
    my ($n) = @_;
    my $fact = 1;
    my $i;
    for($i=2;$i<=$n;$i++) {$fact *= $i;}
    return $fact;
    }
    
    my $n = 20000;
    my ($user1, $system1) = times;
    my $f = fact($n);
    my ($user2, $system2) = times;
    my $user = $user2 - $user1;
    print $user;
    print "\n";
    
    'output -----------------------------------------------------------------------------------
    
    C:\Users\root\Desktop\Perl>perl -v
    
    This is perl, v5.10.1 (*) built for MSWin32-x86-multi-thread
    
    Copyright 1987-2009, Larry Wall
    
    Perl may be copied only under the terms of either the Artistic License or the
    GNU General Public License, which may be found in the Perl 5 source kit.
    
    Complete documentation for Perl, including FAQ lists, should be found on
    this system using "man perl" or "perldoc perl".  If you have access to the
    Internet, point your browser at http://www.perl.org/, the Perl Home Page.
    
    
    C:\Users\root\Desktop\Perl>perl fact.pl
    138.373
    
    C:\Users\root\Desktop\Perl>
    
    Last edited by danbaron; 06-09-2011 at 08:55.
    "You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields

  7. #27
    Member REDEBOLT's Avatar
    Join Date
    Dec 2006
    Location
    Pickerington, Ohio, USA
    Age
    87
    Posts
    62
    Rep Power
    24
    Aaaah, come on Dan

    Now I'll have to learn Perl!!!



    Bob

  8. #28
    thinBasic MVPs danbaron's Avatar
    Join Date
    Jan 2010
    Location
    California
    Posts
    1,378
    Rep Power
    152
    I think a person could spend a long time trying to master Perl.

    I think a lot of ignorant people try to sell it way way short.

    http://padre.perlide.org/

    http://www.perl.org/books/library.html


    "You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields

  9. #29
    Member REDEBOLT's Avatar
    Join Date
    Dec 2006
    Location
    Pickerington, Ohio, USA
    Age
    87
    Posts
    62
    Rep Power
    24
    Thanks, Dan, for the links.
    The online books look intriguing.

    Bob

  10. #30
    zak, I apologize for a totally inappropriate response, please forgive me.
    regarding the long compile time, apparently it's due to the version of make,
    go to http://sourceforge.net/projects/mingw/files/
    click on: MSYS -> make -> make-3.81-3 and download make-3.81-3-msys-1.0.13-bin.tar.lzma and extract to msys\1.0\bin folder.
    my compile time for gmp 5.0.2 after having run config was about 10 minutes, make check time was about 12 minutes

Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. GMP library: free library for arbitrary precision arithmetic
    By ErosOlmi in forum thinBasic vaporware
    Replies: 24
    Last Post: 03-01-2009, 01:01

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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