C++
  Home arrow C++ arrow Page 5 - Large Numbers
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C++

Large Numbers
By: Gabor Bernat
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 5
    2008-07-15

    Table of Contents:
  • Large Numbers
  • The User Interface
  • File Input Lesson
  • Addition and Subtraction
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Large Numbers - Conclusion


    (Page 5 of 5 )

    Now we are ready to start cranking. We have successfully completed some of the basic, though non-trivial tasks. These include representing the number in memory and also finishing the addition and subtraction. Now we can start up the program and test it. In the application linked just a few lines below I included a test method so feel free to play with the numbers. On my halfway decent system the results were the following. Here are the addition results for two 10MB (10* 1024 * 1024 digit numbers) files.

    And for two 1MB (1024 * 1024 digit number) files the result are here.

    We can remark on the speed of the procedure due to the chunk reading method. Of course better scores can be achieved with a good dual core CPU and proper memory and HDD read/write access times. For the two 10MB addition I managed to get a 450ms time on a dual core CPU. That's a significant difference. And don't forget, here's the source code for a more detailed view. Don't hesitate to download it, and may the muse of knowledge inspire you.

    This is all for today. Make sure you come back for the second part, in which I shall discuss a more interesting problem, namely multiplication. It's going to be published here so don't go far. Until then I wish you a fantastic day.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Learn, learn and than again learn. Finally learn from your mistakes and change your...
     

    C++ ARTICLES

    - More Tricks to Gain Speed in Programming Con...
    - Easy and Efficient Programming for Contests
    - Preparing For Programming Contests
    - Programming Contests: Why Bother?
    - Polymorphism in C++
    - Overview of Virtual Functions
    - Inheritance in C++
    - Extending the Basic Streams in C++
    - Using Stringstreams in C++
    - Custom Stream Manipulation in C++
    - General Stream Manipulation in C++
    - Serialize Your Class into Streams in C++
    - Advanced File Handling with Streams in C++
    - File Handling and Streams in C++
    - The STL String Class







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    Stay green...Green IT