
November 27th, 2012, 05:59 PM
#1
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/...ntegerNumbers

November 28th, 2012, 04:24 AM
#2
Re: A class for operations with Large Integer Numbers
Originally Posted by Pahanuch
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

November 28th, 2012, 07:21 AM
#3
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

Forum Rules

Click Here to Expand Forum to Full Width
This a Codeguru.com survey!
