Announcement

Collapse
No announcement yet.

Big numbers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Gustavo Asplanatti
    replied
    The term "bignum" may not be known to everyone but, it is not particularly
    ambiguous.
    The term "bignum", that probably, comes from big number is translated
    literally to Spanish as "número grande", and that indeed has an ambiguous
    meaning. It is common that the technical terms (especially in computers),
    derive of English words (anglicisms) and that still there being
    translations to Spanish, these are used and habitually adopted by the
    the "Real Academia Española" as part of the Spanish language (Castellano);
    regrettably, I have not found translation to Spanish of the term "bignum",
    for that makes comprehensible my mistake.
    Anyway I am grateful of being able to enlarge my knowledge of
    Shakespeare's language.

    ------------------
    Gustavo Asplanatti
    [email protected]

    Leave a comment:


  • Tom Hanlin
    replied
    The term "bignum" may not be known to everyone but, it is not particularly
    ambiguous.

    http://dictionary.reference.com/search?q=bignum

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Michael Mattias
    replied
    >Mmmm, I believe that also my English that is not very good

    Your English is fine.

    The question ( "Does anyone know of any bignum libraries for pb?") was worded at best ambiguously.


    Leave a comment:


  • Gustavo Asplanatti
    replied
    David, please excuse me !! , my mind played me a joke.....
    Mmmm, I believe that also my English that is not very good..
    I hope that you can solve the problem quickly.



    ------------------
    Gustavo Asplanatti
    [email protected]

    Leave a comment:


  • David J Venable
    replied
    BigPrn.zip 21 Sep 1994
    5 Kb BIGPrint 1.0 displays characters on a text mode screen
    using a very large font. Supports capital letters, numbers, and
    a few symbols. Source code. Public Domain by E. F. Deel.
    Well, I appreciate the thought, Gustavo, but I'm looking for a
    library that will operate on large numbers, not one that
    will display large numbers .


    ------------------

    Leave a comment:


  • Gustavo Asplanatti
    replied
    David,

    Try this:
    http://www.powerbasic.com/files/pub/...ary/BigPrn.zip

    Best regards



    ------------------
    Gustavo Asplanatti
    [email protected]

    Leave a comment:


  • Ian Cairns
    replied
    greg, there is at least one big number routine available. i had posted a multiplication routine a while ago:
    big number multiplication
    it should be easily convertible to dos. but i have no other routines on hand.

    regards,

    ------------------
    ian[dot][email protected]

    Leave a comment:


  • Greg Turgeon
    replied
    I've come up empty after my nostalgic trip through lots of old files. I also checked catalog files I had downloaded, files listing the holdings of the PB BBS and CompuServe forum, and no listings appear for big number libraries or even routines. I'm surprised to have found nothing that seems at all relevant.

    Eddy Van Esch would be the right person to talk to about this subject, but I believe he's away on vacation right now.


    ------------------
    -- gturgeon at compuserve dot com --

    Leave a comment:


  • Greg Turgeon
    replied
    I'm using PB DOS...
    Sorry. I should have noted that. However, the source code for Eddy's package is available, and porting the code to PB/DOS should not be too difficult.

    I suspect that at this point, you might have trouble finding a ready-made solution for PB/DOS. Several code packages that I've been familiar with have disappeared (i.e., are no longer available). Later today I'll have a look through my collection of downloads from the old PB BBS and the PB CompuServe forum and see what's there.



    ------------------
    -- gturgeon at compuserve dot com --

    Leave a comment:


  • Don Schullian
    replied
    David,

    Seeings how you posted your query in the DOS forum I thought
    your question was clear as could be.

    ------------------
    C'ya
    Don
    [email protected]

    Leave a comment:


  • David J Venable
    replied
    Sorry for the lack of clarity, but I'm using PB DOS so,
    that I know of, I can't use dll's which are what both of
    these are. Anyone know of anything for DOS? Thanks!

    ------------------

    Leave a comment:


  • Greg Turgeon
    replied
    Check out Eddy Van Esch's huge integer library:
    http://www.devotechs.com/



    ------------------
    -- gturgeon at compuserve dot com --

    Leave a comment:


  • Johan Klassen
    replied
    you can use gmp in dll form, you can find precompiled static and dynamic (dll) libs http://www.cs.nyu.edu/exact/core/gmp/
    while i have not tried it with PowerBasic, i did a test using PureBasic.
    here's the PureBasic code that may give some hints on how to use gmp.

    Code:
    ;you can download gmp from http://www.cs.nyu.edu/exact/core/gmp/ 
    
    Structure mpz ; multiprecision integer
      mp_alloc.l
      mp_size.l
      mp_limb.l
    EndStructure
    
    Structure mpq ; multiprecision rational
      mp_num.mpz
      mp_den.mpz
    EndStructure
    
    Structure mpf ; multiprecision floating point
      mp_prec.l
      mp_size.l
      mp_expt.l
      mp_limb.l
    EndStructure
    
    i.mpz
    j.mpz
    k.mpz
    l.mpz
    
    n.mpq
    m.mpq
    q.mpq
    
    x.mpf
    y.mpf
    z.mpf
    
    OpenConsole() 
    
    ConsoleTitle ("GMP.DLL test") 
    
    If OpenLibrary(1, "GMP.DLL")
    
    ; integer -------------------------------------------------------------------------
    
      CallFunction(1,"__gmpz_init",i); initialize integer number i
      CallFunction(1,"__gmpz_init",j); initialize integer number j
      CallFunction(1,"__gmpz_init",k); initialize integer number k
      CallFunction(1,"__gmpz_init",l); initialize integer number k
      a$="33333333333333333333333333333333333333333333333333333333333333333333333333333"
      CallFunction(1,"__gmpz_set_str",i,a$,10)
      ; set i equals to 3333333333... number base 10
      CallFunction(1,"__gmpz_set_str",j,a$,10)
      ; set j equals to 3333333333... number base 10
      CallFunction(1,"__gmpz_mul",k,i,j); k= i*j  
      a$=Space(63000);allocate space
      CallFunction(1,"__gmp_sprintf",a$,"%Zd",k);convert integer to string in a$
      PrintN(a$); print integer number
      CallFunction(1,"__gmpz_fac_ui",k,10); k= !
      a$=Space(63000);allocate space
      al.l=CallFunction(1,"__gmp_sprintf",a$,"%Zd",k);convert integer to string in a$
      PrintN(a$); print integer number
        PrintN(Str(al));number of digits in factorial
    
    ; rational ------------------------------------------------------------------------
    
      CallFunction(1,"__gmpq_init",n); initialize rational number n
      CallFunction(1,"__gmpq_init",m); initialize rational number m
      CallFunction(1,"__gmpq_init",q); initialize rational number q
      CallFunction(1,"__gmpq_set_str",n,"4/12",10); set n equals to 4/12 number base 10 (1/3)
    ;The string can be an integer like "41" or a fraction like "41/152".
    ;The fraction must be in canonical form (see Chapter 6 [Rational Number Functions], page 42),
    ;or if not then mpq_canonicalize must be called.
      CallFunction(1,"__gmpq_canonicalize",n); set n equals to 1/3 number base 10
      CallFunction(1,"__gmpq_set_str",m,"1/5",10); set m equals to 1/5 number base 10
      CallFunction(1,"__gmpq_add",q,n,m);q=n+m
      CallFunction(1,"__gmpq_mul_2exp",q,q,128)
      PrintN("num -> "+Str(q\mp_num\mp_size))
      PrintN("den -> "+Str(q\mp_den\mp_size))
      ;PrintN(Str((((q\mp_num\mp_size)+(q\mp_den\mp_size))*9.633)+1))
      a$=Space(63000);allocate space
      al.l=CallFunction(1,"__gmp_sprintf",a$,"%Qd",q);convert rational to string in a$
      PrintN(Str(al))
      PrintN(a$); print rational number
    
    ; floating point ------------------------------------------------------------------
    
      CallFunction(1,"__gmpf_init2",x,65536); initialize float number x with 65536 bits precision
      CallFunction(1,"__gmpf_init2",y,65536); initialize float number y with 65536 bits precision
      CallFunction(1,"__gmpf_init2",z,65536); initialize float number z with 65536 bits precision
      CallFunction(1,"__gmpf_set_str",x,"2",10); set x equals to 2 number base 10
      CallFunction(1,"__gmpf_sqrt",y,x)        ; y = sqrt(x)
      a$=Space(63000)
      CallFunction(1,"__gmp_sprintf",a$,"%77.70Fe",y); convert floating point number y to string in a$ 
      PrintN(a$)                                     ; print float number y
      CallFunction(1,"__gmpf_pow_ui",z,y,2); z=y^2
      CallFunction(1,"__gmpf_neg",z,z); z=y^2
      a$=Space(63000)
      CallFunction(1,"__gmp_sprintf",a$,"%77.70Fe",z)
      PrintN(a$)
      Print(">> ")
      b$=Input()
      CallFunction(1,"__gmpz_clear",i); deallocate memory
      CallFunction(1,"__gmpz_clear",j)
      CallFunction(1,"__gmpz_clear",k)
      CallFunction(1,"__gmpz_clear",l)
      CallFunction(1,"__gmpq_clear",n)
      CallFunction(1,"__gmpq_clear",m)
      CallFunction(1,"__gmpq_clear",q)
      CallFunction(1,"__gmpf_clear",x)
      CallFunction(1,"__gmpf_clear",y)
      CallFunction(1,"__gmpf_clear",z)
      CloseLibrary(1)
    EndIf
    CloseConsole()
    <<Edit>>
    did not realize that this is for DOS, maybe this link will help http://www.rain.org/~mkummel/tbvault.html
    ------------------




    [This message has been edited by Johan Klassen (edited July 31, 2004).]

    Leave a comment:


  • David J Venable
    started a topic Big numbers

    Big numbers

    Does anyone know of any bignum libraries for pb?

    ------------------
Working...
X