Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Big Integer Math include file

  1. #11
    Member Johannes's Avatar
    Join Date
    Nov 2010
    Location
    Wuustwezel, Belgium
    Age
    56
    Posts
    95
    Rep Power
    25
    Quote Originally Posted by Petr Schreiber View Post
    I was confused at first, but then I realised I cannot use passed strings directly, but need to use the BigInt_FromString and BigInt_ToString.
    Correct. I thought about making all functions "auto-recognise" but I found it just too much trouble. Also, for a true auto-recognise I would want it to work with numerical variables as well and I just couldn't get the Variant bit to work. So I stuck with the internal representation.

    You can get strange results if you try to print (to Console) internal BigInt strings directly, without using BigInt_ToString. Look out for that.

    That would also be a problem because if conversion from ASCII to internal is automatic, you'd expect the reverse to be true as well: automatic conversion from internal to ASCII when printing. But for that I would have to make this a proper thinBasic module and if I understand it correctly I would have to use an SDK, and there isn't one for thinBasic, only for PowerBasic and FreeBasic.

    I am thinking of doing the low-level functions (BII_add, _sub, _mul, _mli, _div, _dvi) in assembler. That should speed things up enormously. If I'm going to do that I'll make some test cases first to check the speed in pure Basic so I can compare it with the assembler version. I'm not guaranteeing anything because I am very busy with work right now and I'm also thinking about writing high-precision (128-bit) floating-point functions.
    Boole and Turing, help me!

    Primary programming: 200 MHz ARM StrongARM, RISC OS 4.02, BASIC V, ARM assembler.
    Secondary programming: 3.16 GHz Intel Core 2 Duo E8500, Vista Home Premium SP2, thinBasic, x86 assembler.

  2. #12
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    67
    Posts
    3,869
    Rep Power
    404
    Quote Originally Posted by Johannes View Post
    Otherwise some poor soul will have to go through the code line by line. Here is a proper hint and it should lead you directly to the Easter Egg.

    all your base IS belong to us

    And that's all I'm going to say about it.
    That clue is a play on a very famous line from the video game Zero Wing. The line in the game is "All your base belong to us", this was broken English translation from the original in Japanese.

    I hope perhaps this trivia will help someone spot the Easter Egg. I'll keep looking myself.

  3. #13
    Member Johannes's Avatar
    Join Date
    Nov 2010
    Location
    Wuustwezel, Belgium
    Age
    56
    Posts
    95
    Rep Power
    25
    Quote Originally Posted by kryton9 View Post
    The line in the game is "All your base belong to us", this was broken English translation from the original in Japanese.
    The line from the video game is not quite as you quoted it here.
    Boole and Turing, help me!

    Primary programming: 200 MHz ARM StrongARM, RISC OS 4.02, BASIC V, ARM assembler.
    Secondary programming: 3.16 GHz Intel Core 2 Duo E8500, Vista Home Premium SP2, thinBasic, x86 assembler.

  4. #14
    Member Johannes's Avatar
    Join Date
    Nov 2010
    Location
    Wuustwezel, Belgium
    Age
    56
    Posts
    95
    Rep Power
    25

    Bug report!

    BigInt_Nrt may give incorrect results if the power is larger than or equal to &h80000000 (two billion and a bit). I have a fix for this so this is temporary.

    BigInt_Nrt2 may give incorrect results if the power is 34. I will change the check within the function.

    BigInt_Fac, BigInt_Prm and BigInt_Cmb may give incorrect results if N is larger than or equal to &h80000000.

    All problems arise from the fact that I do not have a native unsigned 64-bit integer data type in thinBasic. If (if!) I change the internal functions to assembler (in this case I'm talking about BII_mli) this problem will be solved. As stated, I can correct BigInt_Nrt without having to go to assembler, but the three billionth Fibonacci number is off-limits for the time being...
    Boole and Turing, help me!

    Primary programming: 200 MHz ARM StrongARM, RISC OS 4.02, BASIC V, ARM assembler.
    Secondary programming: 3.16 GHz Intel Core 2 Duo E8500, Vista Home Premium SP2, thinBasic, x86 assembler.

  5. #15
    Member Johannes's Avatar
    Join Date
    Nov 2010
    Location
    Wuustwezel, Belgium
    Age
    56
    Posts
    95
    Rep Power
    25
    Corrected the bugs in BigInt_Nrt and BigInt_Nrt2 as mentioned above, and two other minor bugs (in the string-to-BigInteger conversion). See attached file.

    I'm stopping further development on BigInt in thinBasic. I've begun converting these functions to a thinBasic module in PowerBASIC and right now I'm at the point that I'll have to start porting the internal (BII_) functions. It's half past midnight and I have to go to work in less than eight hours...

    As soon as I have something that's testable I'll make a posting over in the new module section.
    Attached Files Attached Files
    Boole and Turing, help me!

    Primary programming: 200 MHz ARM StrongARM, RISC OS 4.02, BASIC V, ARM assembler.
    Secondary programming: 3.16 GHz Intel Core 2 Duo E8500, Vista Home Premium SP2, thinBasic, x86 assembler.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Include file for GDI/GPI+?
    By Michael Hartlef in forum General
    Replies: 4
    Last Post: 20-03-2010, 11:57
  2. 3D Vector Math include file.
    By D.J.Peters in forum Math scripts
    Replies: 5
    Last Post: 11-03-2010, 08:02

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
  •