LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-06-2005, 09:25 AM   #16
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111

Quote:
Originally Posted by TruongAn
It is because those library is already installed on FC4.
But when I compile the code, it report the undefined reference error.
It seem that all the function start with mpz is not defined.
Do I have to remove my already installed lib with those you give?
Just leave the installed lib as it is now.
The reason mpz.. functions are not defined is because the compiler cannot find the "gmp.h" header file.

Most likely you still need to install the gmp-devel-4.1.4-6.i386.rpm package.

Last edited by Hko; 12-06-2005 at 09:26 AM.
 
Old 12-08-2005, 09:49 AM   #17
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Original Poster
Rep: Reputation: 33
Quote:
The reason mpz.. functions are not defined is because the compiler cannot find the "gmp.h" header file.

Most likely you still need to install the gmp-devel-4.1.4-6.i386.rpm package.
The compiler didn't say that the gmp.h header is not found.
It only said that those mpz* functions are not defined.
The package gmp-devel-4.1.4-6.i386.rpm is already installed.
It is so trange, isn't it?
 
Old 12-08-2005, 12:56 PM   #18
primo
Member
 
Registered: Jun 2005
Posts: 542

Rep: Reputation: 34
Check /usr/local/include
In that case, use -I/usr/local/include in your CFLAGS or your compiler options
 
Old 12-09-2005, 03:29 AM   #19
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Original Poster
Rep: Reputation: 33
The gmp.h file was in /usr/include/
What do I have to do next?
 
Old 12-09-2005, 12:33 PM   #20
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
I just read a previous post from you. And it seems I didn't read it well enough. Here's the important part of your post again:
Quote:
Originally Posted by TruongAn
But when I compile the code, it report the undefined reference error.
It seem that all the function start with mpz is not defined.
The real problem is you did not read my post well enough .

I said in my first post:
Quote:
compile the program below with the "-lgmp" option:
Code:
gcc -Wall -lgmp -o bigfactorial bigfactorial.c
Please try again. I'm 99.9% sure it will work this time.
 
Old 12-10-2005, 06:24 AM   #21
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Original Poster
Rep: Reputation: 33
Thanks alot Hko,
Your code work, it was my fault to make it not working.
And by the way: The number digit is out range of my screen display.
It means some digit cannot be diplayed.
Can you answer that last questions please?
 
Old 12-10-2005, 06:36 AM   #22
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
That's correct. The number can get very large (HUGE actually), and don't fit on a screen. Calculate smaller numbers, or redirect the output to a file and look at it with an editor, change the program yourself to make it split the number into lines of 72 characters, or try one of the other solutions mentioned in this discussion to print something like "1.34587982E+7743", or whatever.

There no real "solution" here. There no real "problem" either. Your ask the computer to give you a very big number, and then you get it. It may not fit on the screen, but thats also the case with large bitmap-images, large texts don't fit on one page or one screen.
 
Old 12-10-2005, 08:00 AM   #23
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by Hko
That's correct. The number can get very large (HUGE actually), and don't fit on a screen. Calculate smaller numbers, or redirect the output to a file and look at it with an editor, change the program yourself to make it split the number into lines of 72 characters, or try one of the other solutions mentioned in this discussion to print something like "1.34587982E+7743", or whatever.

There no real "solution" here. There no real "problem" either. Your ask the computer to give you a very big number, and then you get it. It may not fit on the screen, but thats also the case with large bitmap-images, large texts don't fit on one page or one screen.
I know, I know.
There is no problem.
What I want to ask is like this:
I remeber that there I can redirect the output to a special program, and that program will show the output page by page.
First It will display an amount number of digit which fit the screen.
Then, I have to press Enter key to go to next page.

But I have forget that software's name.
Would you mind showing me it name please.
Thanks anyway.
 
Old 12-10-2005, 08:48 AM   #24
exvor
Senior Member
 
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537

Rep: Reputation: 87
less or more can do this.
use a pipe like below.
Code:
user@computer# program | less
 
Old 12-11-2005, 01:06 AM   #25
TruongAn
Member
 
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Original Poster
Rep: Reputation: 33
Thank you verymuch everyone.
The problem was solve
 
Old 12-12-2005, 02:44 PM   #26
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
Quote:
He pointed out that even calc.exe, a small calculator software in windoze can calculate the factorial of 80,000 within a few seconds.
But this number is out of range in any linux calculator software.
I was so angry to hear that.
don't get mad, get even

I tried this with 120,000, calc couldn't, plus it's a bit more accurate!!
Code:
(defun fac(n)
  (let ((result 1))
    (dotimes (i n)
      (setq result (* result (+ i 1))))
   result))


(print "Number for factorial:")
(print (fac (print (read))))
Code:
$ time clisp fac > 1
120000

real    1m49.34s

Code:
$ more 1

"Number for factorial:" 
120000 
22406714655797362497993141608227937794745126522360269157176324077266000869524416
96464220700886713641449525104754506023560378296179044316346155136811811432217357
41955507780432562420857764113683442185114999824271813031473057741490222841643455
73022465517944363931741556674593664365451020925194218152905164901433493592952218
22896593728627965151535688281280200878000149352240502842359028527723078015271180
50458242652386480055392185427942264443111473352658235772337855837529324062196695
44961804635095255828795189487438038905479719573148957130771241566906232066944058
93734229095495782383936366268985526763061312511630137955895607801118555279301283
02582633839857393183474754162455367625917538950309047607860827401491584840354533
86890588445418570279640035957924446766558781129816064757023522109478122261799149
36319646597516057671738785692189052754644940134684589731255071881453775930037900
89698428173971970179835309458680797223238533828321293042435303142991457704988917
32163885160960190838520067879936369464778846634588631074297262004259753624715581
74407633514069010282425970048290440051632724760390237868586525757655509050460714
24391613450554566641947835353130527773248423107177154789748768608481271976175249
34007038490462733006644638449034912113693940612519109017526212035377703846304949
44382572686079512843944512798981895808077379963730288784501864113305123012455137
19839121349718128824900968034804336743888885250887589096635288356979185454179343
52085150298782028752230381723828095797255579365127860012002146438324835973423682
42554700556256639240953407684940093678111788722060125730322446644548933689614742
etc etc etc etc etc
3GHz P4 laptop 512MB RAM
(don't tel him you can get clisp for windows though )

Last edited by bigearsbilly; 12-12-2005 at 02:45 PM.
 
Old 12-12-2005, 03:08 PM   #27
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
Angry doh

maybe I should have read all the other posts first!
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
100,000,000 Firefox downloads! Eerath General 6 10-22-2005 11:20 PM
How to calculate Server power needs psychobyte Linux - Hardware 1 08-11-2005 02:59 AM
How do you calculate (manually) 2 to the power 3.5? davee General 11 11-05-2004 11:22 AM
1,000,000,000 PCs by 2010 masand Linux - News 4 11-01-2004 01:55 AM
LinuxQuestions.org Surpasses 1,000,000 Posts jeremy LQ Suggestions & Feedback 15 07-21-2004 12:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration