I am trying to figure out a way to do calculations with ridiculous numbers, just as Python would, such as 2**1000 for example. There isn't really a good reason why I want to do this, however I have seen code for this using the fmzm library, I think. I don't know how to do this as I am using code blocks Ide and it just comes up with the error of no such file or directory "fmzm.mod". How would I go about installing this/being able to do use FMZM
in Fortran 95 code.
Already tried using the integer(kind=64)
and then kind=128
... and so on to see if that was allowed. This is some code from another StackOverflow example, but I run into the error of code blocks not being able to open fmzm.mod
program cycle
use FMZM !<----- a module for handling big numbers
implicit none
character(200) :: str
integer :: n
type(IM) :: x1, result, x2, x3 !<----- IM = BigInt, FM = BigFloat
do n = 40, 500, 40
x1 = n
result = 1
x2 = 0
x3 = 1
do
if (x1 > 1) then
x2 = result
result = result + x3
x3 = x2
x1 = x1 - 1
else
exit
end if
end do
str = IM_format( 'i200', result ) !<----- convert BigInt to string
print *, n, trim( adjustl(str) ) !<----- print huge integers
end do
end program cycle
||=== Build: Debug in test1 (compiler: GNU Fortran Compiler) ===|
C:\Users\hh\Desktop\Fortran\test1\main.f95|5|Fatal Error: Can't open module file 'fmzm.mod' for reading at (1): No such file or directory|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|