Results 1 to 6 of 6

Thread: [RESOLVED] Large Numbers

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2009
    Location
    Clive, IA in America!!!!
    Posts
    204

    Resolved [RESOLVED] Large Numbers

    Is there any container that would hold a number that is 10,000 characters in length? would I have to create one? If so how would I go about doing something like that?

    VBNetDude - Thinking Programmatically
    By Silver Seal Software

    Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most!

  2. #2
    Frenzied Member ntg's Avatar
    Join Date
    Sep 2004
    Posts
    1,449

    Re: Large Numbers

    You'll have to make one. In order to do that, you'll have to think in terms of how two bytes are combined together to form an integer (and from there extrapolate for an n-byte number). When you add to a 2-byte number you start by adding to the least significant byte - if you get a carry, you add that to the most significant byte.

    It works exactly like elementary arithmetic. I imagine you can code something that works in base-10 arithmetic or something that would work with base-2 arithmetic (bytes). Coding for base-10 would be intuitive and simple while coding for base-2 arithmetic would be faster.
    "Feel the force...read the source..."
    Utilities: POPFileDebugViewProcess ExplorerWiresharkKeePassUltraVNCPic2Ascii
    .Net tools & open source: DotNetNukelog4NetCLRProfiler
    My open source projects: Thales SimulatorEFT CalculatorSystem Info ReporterVSS2SVNIBAN Functions
    Customer quote: "If the server has a RAID array, why should we bother with backups?"
    Programmer quote: "I never comment my code. Something that is hard to write should be impossible to comprehend."
    Ignorant quote: "I have no respect for universities, as they teach not practicle stuff, and charge money for"

  3. #3
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Large Numbers

    Quote Originally Posted by VBNetDude View Post
    Is there any container that would hold a number that is 10,000 characters in length? would I have to create one? If so how would I go about doing something like that?
    If you don't need it for calculation purposes, store it as string.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  4. #4
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Large Numbers

    What kind of number is that big... I can't imagine if I never need to use one
    Anyway, what's you're looking for is "Big Integer" type. If you're targeting .Net 4.0 then it's the System.Numerics.BigInteger structure. If you're targeting .Net 3.5 and lower, you have to create your own.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2009
    Location
    Clive, IA in America!!!!
    Posts
    204

    Re: Large Numbers

    Um, I am working with a number that is 10,000 Digits in length. It must be prime. I made a prime number finder that went through the selected starting and ending points, and listed all the prime ones. Now I want to expand that and see how large I can make the number. (Can you tell I have nothing to do? )

    Is there any way to import .Net 4.0 into VB 2008? I don't care what framework it targets because it is really just something to abide time until I have something better to do!

    VBNetDude - Thinking Programmatically
    By Silver Seal Software

    Don't forget to mark your thread as "Resolved" using the Thread Tools menu on top. And don't forget to rate the answers that help you the most!

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Large Numbers

    Quote Originally Posted by VBNetDude View Post
    Is there any way to import .Net 4.0 into VB 2008? I don't care what framework it targets because it is really just something to abide time until I have something better to do!
    No, you would have to download and install VS 2010 Beta 2. If you do so, I would recommend installing on a virtaul machine if you possibly can. You should avoid installing any beta software on a system that you can't happily reformat.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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