Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > factorial and exponent

Reply
Thread Tools

factorial and exponent

 
 
Johan Bengtsson
Guest
Posts: n/a
 
      06-17-2007
Richard Heathfield wrote:
> Army1987 said:
>> "Richard Heathfield" <(E-Mail Removed)> ha scritto nel messaggio
>> news:(E-Mail Removed)...
>>> BiGYaN said:

> <snip>
>>>> Use GMP library found in http://gmplib.org/
>>>> It will enable you to do "Arithmetic without Limitations" !!
>>> Nonsense.
>>>
>>> Consider an integer greater than or equal to 2. Call it A. Consider
>>> another integer greater than or equal to 2. Call it B.
>>>
>>> Raise A to the power B, storing the result in A. Now raise B to the
>>> power A, storing the result in B. If you repeat this often enough,
>>> you *will* hit a limit, no matter what numerical library you use.

>> But it is a limit of your computer, not of the library itself.

>
> Nevertheless, it is a limit, and therefore the library *cannot* 'enable
> you to do "Arithmetic without Limitations"', and therefore BiGYaN's
> statement is nonsense.
>
> Incidentally, you've just emerged from a 30-day spell in my sin bin. I
> hope I won't have to chuck you back in there.
>

Of course there are limits, but I don't agree that they necessarily have
to be in the library. size_t is one limit, but if run on for example a
windows box it will not be *the* limit. A win32 application is not
allowed to allocate more than 2Gbytes of memory (and that's typically
half of what size_t allows for), unless you buy a more expensive version
of windows where that limit is raised to 3Gbytes.
It would also be possible for the mathematics library to internally use
something else than a standard C pointer and internally use paging
towards the system's hard disk or some internet based server or whatever
(magnetic tape?) allowing for a *much* higher limit. Oh well the limit
will still be there somewhere, but the calculation time will probably be
the limiting factor instead...

No, I don't seriously suggest using magnetic tape as a paging media...
but it would be possible!


 
Reply With Quote
 
 
 
 
Johan Bengtsson
Guest
Posts: n/a
 
      06-17-2007
Richard Heathfield wrote:
> Army1987 said:
>> "Richard Heathfield" <(E-Mail Removed)> ha scritto nel messaggio
>> news:(E-Mail Removed)...
>>> BiGYaN said:

> <snip>
>>>> Use GMP library found in http://gmplib.org/
>>>> It will enable you to do "Arithmetic without Limitations" !!
>>> Nonsense.
>>>
>>> Consider an integer greater than or equal to 2. Call it A. Consider
>>> another integer greater than or equal to 2. Call it B.
>>>
>>> Raise A to the power B, storing the result in A. Now raise B to the
>>> power A, storing the result in B. If you repeat this often enough,
>>> you *will* hit a limit, no matter what numerical library you use.

>> But it is a limit of your computer, not of the library itself.

>
> Nevertheless, it is a limit, and therefore the library *cannot* 'enable
> you to do "Arithmetic without Limitations"', and therefore BiGYaN's
> statement is nonsense.


Of course there are limits, but I don't agree that they necessarily have
to be in the library. size_t is one limit, but if run on for example a
windows box it will not be *the* limit. A win32 application is not
allowed to allocate more than 2Gbytes of memory (and that's typically
half of what size_t allows for), unless you buy a more expensive version
of windows where that limit is raised to 3Gbytes.
It would also be possible for the mathematics library to internally use
something else than a standard C pointer and internally use paging
towards the system's hard disk or some internet based server or whatever
(magnetic tape?) allowing for a *much* higher limit. Oh well the limit
will still be there somewhere, but the calculation time will probably be
the limiting factor instead...

No, I don't seriously suggest using magnetic tape as a paging media...
but it would be possible!
 
Reply With Quote
 
 
 
 
Richard Heathfield
Guest
Posts: n/a
 
      06-18-2007
BiGYaN said:

> On Jun 17, 12:50 pm, Richard Heathfield <(E-Mail Removed)> wrote:
>> BiGYaN said:

<snip>
>> > Use GMP library found inhttp://gmplib.org/
>> > It will enable you to do "Arithmetic without Limitations" !!

>>
>> Nonsense.
>>
>> Consider an integer greater than or equal to 2. Call it A. Consider
>> another integer greater than or equal to 2. Call it B.
>>
>> Raise A to the power B, storing the result in A. Now raise B to the
>> power A, storing the result in B. If you repeat this often enough,
>> you *will* hit a limit, no matter what numerical library you use.

>
> "Arithmetic without Limitations" is sort of a slogan for GMP (http://
> gmplib.org/). That's why I just put it in quotes.


It's still false, within quotes or without them.

> The case that you are talking about does not show the limitation of
> the numerical library. It's a limit of your computer.


It's still a limit.

> Besides, for all
> *practical purposes* you won't hit this limit in a modern computer.


It's still a limit.

> Like I'm quite sure that nobody will actually need all the digits of
> 126^126 for any *practical* job.


Cryptography springs to mind as a practical application which requires
exactness to the very last digit for calculations involving numbers of
that size and indeed greater.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      06-18-2007
Johan Bengtsson said:

<snip>

> Of course there are limits, but I don't agree that they necessarily
> have to be in the library.


I'm not saying they are, but that's not the issue. The claim was that
the library allows you to do arithmetic without limitations, and all
I'm saying is that that claim is false.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
 
Reply With Quote
 
BiGYaN
Guest
Posts: n/a
 
      06-18-2007
On Jun 18, 8:44 am, Richard Heathfield <(E-Mail Removed)> wrote:
> Cryptography springs to mind as a practical application which requires
> exactness to the very last digit for calculations involving numbers of
> that size and indeed greater.


Thanks for informing .... I really had no idea. I take back my comment.

 
Reply With Quote
 
Army1987
Guest
Posts: n/a
 
      06-24-2007

"Richard Heathfield" <(E-Mail Removed)> ha scritto nel messaggio news:(E-Mail Removed)...
> Army1987 said:
>> "Richard Heathfield" <(E-Mail Removed)> ha scritto nel messaggio
>> news:(E-Mail Removed)...
>>> BiGYaN said:

> <snip>
>>>>
>>>> Use GMP library found in http://gmplib.org/
>>>> It will enable you to do "Arithmetic without Limitations" !!
>>>
>>> Nonsense.
>>>
>>> Consider an integer greater than or equal to 2. Call it A. Consider
>>> another integer greater than or equal to 2. Call it B.
>>>
>>> Raise A to the power B, storing the result in A. Now raise B to the
>>> power A, storing the result in B. If you repeat this often enough,
>>> you *will* hit a limit, no matter what numerical library you use.

>>
>> But it is a limit of your computer, not of the library itself.

>
> Nevertheless, it is a limit, and therefore the library *cannot* 'enable
> you to do "Arithmetic without Limitations"', and therefore BiGYaN's
> statement is nonsense.

If you cannot compute a number n with a computer, you can always
(at least in principle) use a computer with a larger size_t and
compute it.
Your statement is much like "You cannot use the long division
algorithm indefinitely because sooner or later you'll run out of
paper", or "There is a N such as you cannot draw a regular
(2^N * 3 * 5 * 17 * 257 * 65537)-gon with straightedge and compass,
because even if the polygon were as large as the universe, each
side would need to be shorter than a Planck length".
The library does enable Arithmetic without Limitations. It is the
implementation (and the universe) which put the limits.


 
Reply With Quote
 
JT
Guest
Posts: n/a
 
      06-24-2007
On Jun 24, 11:17 am, "Army1987" <(E-Mail Removed)> wrote:
> If you cannot compute a number n with a computer, you can always
> (at least in principle) use a computer with a larger size_t and
> compute it.
> Your statement is much like "You cannot use the long division
> algorithm indefinitely because sooner or later you'll run out of
> paper", or "There is a N such as you cannot draw a regular
> (2^N * 3 * 5 * 17 * 257 * 65537)-gon with straightedge and compass,
> because even if the polygon were as large as the universe, each
> side would need to be shorter than a Planck length".


> The library does enable Arithmetic without Limitations. It is the
> implementation (and the universe) which put the limits.


No. By your same argument, I can say this method
below "enables arithmetic without limitations":

int add(int a, int b) { return a+b; }
int sub(int a, int b) { return a-b; }

Because you can always build a C compiler that
provides a larger "int" size.

(For example, 32-bit C compilers use multiple
operations to simulate 64-bit integer operations.
The C compiler can double that up to simulate
128-bit, 256-bit, or in did even a much larger
bitwidth)

My two objections:

(1) That library does not "enable" unlimited arithmetic.
The library itself does not "impose" additional limit.

(2) People are confused between infinite,
and finite bounded. People should read more math books.

- JT


 
Reply With Quote
 
JT
Guest
Posts: n/a
 
      06-24-2007
On Jun 24, 11:46 am, JT <(E-Mail Removed)> wrote:
> (2) People are confused between infinite,
> and finite bounded.


Sorry, of course, I meant "finite unbounded".

- JT


 
Reply With Quote
 
Army1987
Guest
Posts: n/a
 
      06-24-2007

"JT" <(E-Mail Removed)> ha scritto nel messaggio news:(E-Mail Removed) ups.com...
> On Jun 24, 11:17 am, "Army1987" <(E-Mail Removed)> wrote:
>> If you cannot compute a number n with a computer, you can always
>> (at least in principle) use a computer with a larger size_t and
>> compute it.
>> Your statement is much like "You cannot use the long division
>> algorithm indefinitely because sooner or later you'll run out of
>> paper", or "There is a N such as you cannot draw a regular
>> (2^N * 3 * 5 * 17 * 257 * 65537)-gon with straightedge and compass,
>> because even if the polygon were as large as the universe, each
>> side would need to be shorter than a Planck length".

>
>> The library does enable Arithmetic without Limitations. It is the
>> implementation (and the universe) which put the limits.

[snip]
> My two objections:
>
> (1) That library does not "enable" unlimited arithmetic.
> The library itself does not "impose" additional limit.
>
> (2) People are confused between infinite,
> and finite unbounded. People should read more math books.

[correction incorporated above]

Indeed, I'm not saying that "Arithmetic without Limitations" means
that the library allows arithmetic with transfinite cardinals, only
that it allows arithmetic with arbitrarily large natural (finite)
numbers.
If there are indeed limits, they are due to the implementation.
Wait for a computer with more memory, and you'll be able to compute
larger numbers.

By your argument, the long division algorithm does not "enable" you
to divide arbitrarily large numbers, it just doesn't "impose"
additional limit (to that dictated by the size of the paper sheet
you work on).


 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      06-24-2007
Army1987 said:
> "Richard Heathfield" ha scritto...
>> Army1987 said:
>>> "Richard Heathfield" ha scritto...


<snip>

>>>> Raise A to the power B, storing the result in A. Now raise B to the
>>>> power A, storing the result in B. If you repeat this often enough,
>>>> you *will* hit a limit, no matter what numerical library you use.
>>>
>>> But it is a limit of your computer, not of the library itself.

>>
>> Nevertheless, it is a limit, and therefore the library *cannot*
>> 'enable you to do "Arithmetic without Limitations"', and therefore
>> BiGYaN's statement is nonsense.

> If you cannot compute a number n with a computer, you can always
> (at least in principle) use a computer with a larger size_t and
> compute it.


No, in principle you'll run out of resources at some point.

> Your statement is much like "You cannot use the long division
> algorithm indefinitely because sooner or later you'll run out of
> paper",


Correct.

> or "There is a N such as you cannot draw a regular
> (2^N * 3 * 5 * 17 * 257 * 65537)-gon with straightedge and compass,
> because even if the polygon were as large as the universe, each
> side would need to be shorter than a Planck length".


Correct.

> The library does enable Arithmetic without Limitations.


No, it doesn't. To do so, it would have to remove all limitations on
arithmetic, and it simply can't.

> It is the
> implementation (and the universe) which put the limits.


And therefore the limits are there. If the library does not remove them,
it does not enable arithmetic without limits.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLT / XPATH 2.0 split float to exponent / mantissa and find nearestengineering format RolfK XML 1 01-20-2009 04:00 PM
some problem with the min exponent of float and double in <limits> header? Wayne Shu C++ 1 03-18-2007 02:16 PM
iostreams - removing leading zeros and controlling exponent field width Anjo Gasa C++ 0 01-30-2007 09:05 PM
How to find exponent and mantissa from a Q Format sankar C Programming 5 11-24-2005 03:34 PM
Is there any library which defines factorial and binomial coefficient? PengYu.UT@gmail.com C++ 2 05-08-2005 10:31 PM



Advertisments