I'm using silverfrost 95 to coding fortran. I want to calculate large numbers for example 5^5432854 but it errors "integer overflow", I tried kind 8 but it errors "error 600 - The KIND number should be 1, 2, 3, 4, or 7" and also it's not working with kind 7. What can I do?
Asked
Active
Viewed 131 times
0
-
1The links above should clear your confusion about kind numbers. You should NOT specify any kind number like 1, 4, 8 or anything else. These numbers are NOT portable. If you copy other people's code where they use `kind(8)`, this will NOT work in your Silverfrost. – Vladimir F Героям слава May 23 '21 at 18:16
-
2However, your number `5^5432854` is way too large for any integer kind in Fortran. You might be able to use external libraries. The first link https://stackoverflow.com/questions/38801846/how-do-i-do-big-integers-in-fortran will tell you more about that. – Vladimir F Героям слава May 23 '21 at 18:18
-
Just to illustrate the point Vladimir is making I calculated a very rough approximation of how much space would be required to store 5^5432854 - very rough as I'm using 5^3 about equals 10^2, and then 10^3 about equals 2^10. Through this I estimate it will take well over 1 MByte just to represent this one number as an integer. If you really have to do this you will require an external library to implement the operations. – Ian Bush May 23 '21 at 18:27