mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Software (https://www.mersenneforum.org/forumdisplay.php?f=10)
-   -   How Does It Work? (https://www.mersenneforum.org/showthread.php?t=12332)

storm5510 2009-08-22 18:30

How Does It Work?
 
How does P95, or any other numeric application, work with numbers which are made up of millions of digits?

I've been a programmer for over 20 years and I do not know of any data type in any programming platform that can do this.

:huh:

Mini-Geek 2009-08-22 18:38

[url]http://www.mersenneforum.org/showthread.php?t=7128[/url]

cheesehead 2009-08-23 01:45

[quote=storm5510;187036]I've been a programmer for over 20 years and I do not know of any data type in any programming platform that can do this.[/quote]It's time for you to acquire, and start studying, [I]The Art of Computer Programming[/I] (TAOCP) by Donald E. Knuth. This work should be in the personal library of every serious practitioner of computer science. It's on many lists of best technical literature of our time. (See [URL]http://en.wikipedia.org/wiki/The_Art_of_Computer_Programming[/URL])

Chapter 4.3 in TAOCP Volume 2 is about multiple-precision arithmetic. It explains the basics of:

a) representing integers that are too large to fit within a single computer word (or other data type element),

b) performing arithmetic on such multiple-precision integers,

c) modular arithmetic on multiple-precision integers, and

d) fast multiplication of multiple-precision integers.

lfm 2009-08-23 14:23

[QUOTE=storm5510;187036]How does P95, or any other numeric application, work with numbers which are made up of millions of digits?

I've been a programmer for over 20 years and I do not know of any data type in any programming platform that can do this.

:huh:[/QUOTE]

Simply put (it gets much more complex when you start optimizing) use an array of numbers for each number. similar to when you do arithmetic by hand you can treat a number as an array of digits and operate on one "digit" at a time.


All times are UTC. The time now is 22:57.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.