A class for operations with Large Integer Numbers
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: A class for operations with Large Integer Numbers

  1. #1
    Join Date
    Aug 2012
    Location
    Ukraine, Odessa
    Posts
    19

    A class for operations with Large Integer Numbers

    Hi. Help me, please! Why this class doesn't work for Subtraction, Division and Square Root. When I try to get results for Subtraction, it output right answer, but with any trash. And When I try to get answer for Division and Square Root, it just brakes and don't output anything. For Addition and Multiplication class work correctly. Thank U very mush, if you will help me.

    Its the link to this class
    http://www.codeproject.com/Articles/...nteger-Numbers

  2. #2
    Join Date
    Apr 1999
    Posts
    27,422

    Re: A class for operations with Large Integer Numbers

    Quote Originally Posted by Pahanuch View Post
    Hi. Help me, please! Why this class doesn't work for Subtraction, Division and Square Root. When I try to get results for Subtraction, it output right answer, but with any trash.
    Have you debugged the code yourself? You have the source code, so why don't you step through it with the debugger?

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    3,755

    Re: A class for operations with Large Integer Numbers

    this class seems to solve the large number problem by implementing the storage as a string. And then doing all the operations "like you did in elementary school with a sheet of paper".

    This is adequate for simple math problems or for problems where conversion to strings is happening often.
    It is going to be very very slow for "complex" or lengthy math operations on really big numbers. (lets say something like finding the greatest common denominator between 2 50 digit numbers).
    This may be what you need, or it may not.

    Search around you will find classes based around arrays of integers (i.e. binary storage). These will be slower at converting to/from a string representation. But they will be considerably faster at actual math operations.

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center