Problem in integer declaration

  • Thread starter Sadjad
  • Start date
  • #1
2
0
Dear all,

I have a problem with Fortran 90. I want to declare an integer which is enable to support till numbers such as Avogadro number (6.022*10**23). I use "Microsoft Fortran PowerStation 4.0". Can anyone can help me please?

Regards,
 

Answers and Replies

  • #2
Redbelly98
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
12,133
160
I've never heard of any language that supports integer variables that high. You could probably write some routine where the digits are stored in many separate long-integer variable types.

But a question is, why not just work in terms of moles, so that you don't need such large numbers?
 
  • #3
Dale
Mentor
Insights Author
2020 Award
31,569
8,334
Wikipedia can help. Look at the http://en.wikipedia.org/wiki/Bignum" [Broken] page.
 
Last edited by a moderator:
  • #4
299
1
What is the point of storing Avagadro's number as an integer? We only know the first 8 digits accurately, so you will have fifteen zeros trailing after those digits.

Languages like java, php, C# have a biginteger class that supports such large numbers, but I don't know about Fortran. You could write your own biginteger functions which would be interesting and instructive though. :)
 
  • #5
I've never heard of any language that supports integer variables that high. You could probably write some routine where the digits are stored in many separate long-integer variable types.

But a question is, why not just work in terms of moles, so that you don't need such large numbers?

python handles large numbers natively.
 
  • #6
2
0
Thank you to all,

To Redbelly98: I have to work with molecules, since the model which I going to model is on the molecules.

To ceptimus: I am with you. It's better not to declare it as an integer because the reason you mentioned.
 
  • #7
24
0
I've never heard of any language that supports integer variables that high. You could probably write some routine where the digits are stored in many separate long-integer variable types.

For integers of that size, use IBM's PL/I, which caters for integers less than 10**32.
 

Related Threads on Problem in integer declaration

Replies
8
Views
328
Replies
11
Views
2K
Replies
3
Views
670
Replies
10
Views
7K
Replies
4
Views
3K
Replies
3
Views
10K
Replies
4
Views
12K
Replies
7
Views
2K
Replies
44
Views
605
  • Last Post
Replies
3
Views
2K
Top