 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
christyleomin
Joined: 08 Apr 2011 Posts: 155
|
Posted: Wed Aug 15, 2012 2:37 pm Post subject: 8 byte integer |
|
|
I have declared as below:
Code: | integer*8 a,b
integer c
a = b+c |
I have declared a and b as 8 bytes because at times their amx value evaluates greater than 4,294,967,296 (because a 4 byte integer can have 8 * 4 = 32 bits, so your range is from 0 to 2^32 (4,294,967,296)
Is it also necessary to declate c as 8 byte inteegr in such a case? |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8211 Location: Salford, UK
|
Posted: Wed Aug 15, 2012 3:36 pm Post subject: |
|
|
c should be OK as INTEGER*4 but you can always run a test to make sure. |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Thu Aug 16, 2012 2:31 am Post subject: |
|
|
range is from 0 to 2^31 (2,147,483,648), due to sign bit. |
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Thu Aug 16, 2012 6:45 am Post subject: |
|
|
The maximum 32 bit integer is 0 to 2**31-1 (2,147,483,647).
The minimum 32 bit integer is -2,147,483,647 since, strictly speaking, Fortran uses a symmetric integer model, though most compilers use twos complement maths and let you go down to -2,147,483,648. _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|