Quantcast Problem in integer declaration Text - Physics Forums Library

PDA

View Full Version : Problem in integer declaration


Sadjad
Aug9-08, 05:10 AM
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,

Redbelly98
Aug9-08, 09:35 AM
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?

DaleSpam
Aug9-08, 12:01 PM
Wikipedia can help. Look at the arbitrary-precision arithmetic (http://en.wikipedia.org/wiki/Bignum) page.

ceptimus
Aug9-08, 08:07 PM
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. :)

Tacomablack
Aug9-08, 10:03 PM
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.

Sadjad
Aug10-08, 02:31 AM
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.