Re: large number with interger



On Jan 25, 7:11 pm, Kith <kiths...@xxxxxxxxx> wrote:
I have a problem to deal with a large number with interger. The
problem is I have to deal with integers of about 20 digits. I am using
Fortran Professional version (2001). Currently, I am using
integer(8) command but it takes only 12 digits. I would appreciate if
someone could help me with this.

Some compilers might support INTEGER(16) (16 byte integers).

I actually thought that several compilers do so, but I just saw that
of my compiler seemingly only gfortran does so (on x86-64-linux; I
tried in total 6 compilers).

In any case with gfortran one can do "INTEGER(16) :: i", which allows
numbers up to
huge(1_16) = 170141183460469231731687303715884105727
which allows for selected_int_kind(38) and is thus enough for your 20
digit numbers.

This solution might be the easiest. Otherwise, one could use one of
the several multi precision libraries as proposed before.

GNU Fortran (gfortran) is available for almost all platforms, is Open
Source and thus free and can be downloaded, e.g., from
http://gcc.gnu.org/wiki/GFortranBinaries

Tobias
.



Relevant Pages

  • Re: Something strange with g77 ...
    ... (snip about precision, digits, and list directed output) ... > the Fortran standard. ... Nor is it the choice that all compilers make. ... > The choice of number of significant digits to print for list-directed ...
    (comp.lang.fortran)
  • Re: Two Questions
    ... Can someone help me with an issue about digits and vpa command? ... not exactly one plus the square root of five all divided by two. ... Mathematica, Maple, MathCAD or I must convert it to LaTeX each calc I ... The pretty command is ugly and is pure text. ...
    (comp.soft-sys.matlab)
  • 3B1 Y2K fixes
    ... Then, once to the command line, I discover that the command-line ... dateprogram also only accepts two digits for the year. ... and (since I've now replaced the battery) I ... its cue from that file for the upper digits of the year. ...
    (comp.sys.3b1)
  • Re: Format>Cells>Special>Zip Code
    ... The LEFT command works well - thank you. ... convert the entry to 5 digits. ... "David Biddulph" wrote: ... a simple 5 digit format, and I end up having to delete the hypen and ...
    (microsoft.public.excel.worksheet.functions)
  • Re: creating a an automatically incrementing, formatted reference number
    ... You don't need a command button to do this; ... In the table the form is based on, add a field named MyPrimaryKey and make ... use for the lab number is 00-0000 the first two digits being the last ... and the other 4 digits incrementing with the ...
    (microsoft.public.access.modulesdaovba)