Results 1 to 5 of 5

Thread: Anyone want to try and break this?

  1. #1

    Thread Starter
    Fanatic Member Comintern's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln, NE
    Posts
    826

    Cool Anyone want to try and break this?

    About a week ago, I tried to find a good VB class for handling large numbers. The only thing I could find was a .dll written in C, so I thought I'd try to cook up one written in VB to get a little coding practice. Attached is what I came up with. It handles signed, floating point numbers up to roughly the length of the max value of an Integer. It can perform all simple math functions (add, subtract, multiply, divide, integer divide, modulus), raise numbers to positive and negative integer powers, and can evaluate greater than and less than. For good measure, I also put in functions to convert to and from any base from 2 to 35, a reciprocal function, a crude formatter, and 6 bitwise operations.

    Everything works as far as I can tell, but I was wondering if anyone could test it a little bit before I put it in the code bank.
    Attached Files Attached Files
    Last edited by Comintern; Dec 22nd, 2005 at 07:04 PM. Reason: Update attachment.

  2. #2
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Anyone want to try and break this?

    Seems nice! I still don't create an instance of this class, I've been looking around properties and methods. I saw you used "." many times to find decimal places,
    In some countries like mine, people use "," as decimal symbol.
    If you want you could get it like this:

    VB Code:
    1. Private mDecSymbol as String
    2. mDecSymbol = Format$(0, ".")
    This way mDecSymbol will be the decimal symbol used in that computer, like it is in Regional Settings.
    Then you could replace all your "." by mDecSymbol.
    (Just an idea)

  3. #3
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: Anyone want to try and break this?

    Good point.
    Regards,

    Mark

    Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."


  4. #4

    Thread Starter
    Fanatic Member Comintern's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln, NE
    Posts
    826

    Re: Anyone want to try and break this?

    Quote Originally Posted by jcis
    Seems nice! I still don't create an instance of this class, I've been looking around properties and methods. I saw you used "." many times to find decimal places,
    In some countries like mine, people use "," as decimal symbol.
    If you want you could get it like this:
    Thanks, this is just the type of thing I was looking for. I'll update it later tonight and re-attach the fixed version. If you want to play around with it before then, a work-around would be to pass all of the arguments explicitly as strings.

  5. #5

    Thread Starter
    Fanatic Member Comintern's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln, NE
    Posts
    826

    Re: Anyone want to try and break this?

    OK, I added the decimal point fix and also added code to get a regionally correct thousands separator. Finally, I fixed some typos in the docs and made .Number the default property.

Posting Permissions

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



Click Here to Expand Forum to Full Width