Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Very Large Integers

JohnNichols
Valued Contributor III
1,665 Views

A few years ago we were talking about a package to handle large integers - say 200 long, I know it is here, but I cannot find it with a long search. 

Does someone remember the package?  

Thanks

0 Kudos
7 Replies
DavidWhite
Valued Contributor II
1,647 Views

I found this article, but no code:

rpb042.pdf (anu.edu.au)

0 Kudos
DavidWhite
Valued Contributor II
1,641 Views
0 Kudos
Arjen_Markus
Honored Contributor I
1,624 Views

The main page for that website contains links to the software - http://dmsmith.lmu.build/FMLIB.html

JohnNichols
Valued Contributor III
1,588 Views

Thank you.

The interesting challenge is that as soon as one starts working on math with integers you run out of large enough variables. 

@Arjen_Markus  do you have a program that access sql server from Fortran.  I thought I recognized your name on a web stie.  

I was looking to use SQL server to store and retrieve the prime number stuff, I spent two days trying to get an old FORDBC program to access any database.  The code is very painful and hidden in a library. 

It took 20 minutes last night in net. 

 

  

0 Kudos
JohnNichols
Valued Contributor III
1,577 Views

I was just playing with the largest integer I can use in Intel Fortran.  I was just checking it with this program.  

 

!  Primer5.f90 
!
!  FUNCTIONS:
!  Primer5 - Entry point of console application.
!

!****************************************************************************
!
!  PROGRAM: Primer5
!
!  PURPOSE:  Entry point for the console application.
!
!****************************************************************************

    program Primer5

    use iso_fortran_env
    implicit none
    character*10 filename
    
    integer nprimemax
    integer(kind=selected_int_kind(15)):: i 
    integer sr 
    integer(kind=selected_int_kind(15)):: j15, j16
    sr = 15
    nprimemax = 2147483647
   ! nprimemax = 100000000
    
    filename = "Data.Txt"
    
    open(sr, file = filename, status = "UNKNOWN")
    
    j16 = huge(j15)
    do i = 1, j16
    
    if(mod(i,1000000000) == 0) then 
    write(*,*)i
    write(sr,*)i
    end if
    
    
    end do
     print *,'Selected Integer Kind 15:'
    print *, huge(j15)

    end program Primer5

it takes a few minutes to run on core i7 with an SSD. 

The huge int is the same as  taking a one metre step towards the moon and the largest Mersenne prime is 10% of the way to the moon - today. 

0 Kudos
Arjen_Markus
Honored Contributor I
1,532 Views

Yes, that is me My main website Fortran-wise was for a long time http://flibs.sf.net, but recently I have become more active on Github. I wrote an ODBC interface that you might be able to use to connect to SQL Server. As I do not have access to it myself, I have no experience to share on that, but ODBC ought to be a useful method, once you have figured out the right connection string.

0 Kudos
JohnNichols
Valued Contributor III
1,517 Views

I have FORDBC connected with the right string, the program retrieves all the table characteristics but it will not get the data.  

The connection string works and I get the data using .NET.  The jolly interesting thing is in mysql and net you just use a simple package and it works.  

My only problem is an intense lifelong dislike of C and so I will have to brush up on getting the C interface to work.  That is the problem with being taught Fortran and LISP as your first languages - after that the rest are just crappy to work with.  

I will give your code a try, thanks. 

Note: I watched the last Die hard movie last night, the computer stuff and the computer people were jolly fun, if you have not seen it, it is worth a look. 

0 Kudos
Reply