Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!dali.cs.montana.edu!milton!seymour From: seymour@milton.u.washington.edu (Richard Seymour) Newsgroups: comp.lang.fortran Subject: Re: How do compilers handle dimensions? Message-ID: <5190@milton.u.washington.edu> Date: 17 Jul 90 20:27:26 GMT References: <90198.114258FC138001@ysub.ysu.edu> Organization: University of Washington, Seattle Lines: 41 In article <90198.114258FC138001@ysub.ysu.edu> FC138001@ysub.ysu.edu (Phil Munro) writes: > All of my Fortran has been with mainframes and for the past year or >so I am using the VS2 compiler. Probably my questions are simple, but >perhaps they will be of interest to others also. > >1. The normal dimension byte size on the mainframe machine (which I >presume is a 64-bit machine) is *4. i think you're misusing the word "dimension" -- what you appear to be asking is the size of a data item (or variable). Four bytes (32 bits) is what many systems have settled on because: IBM did first (before 1967, at least) 16-bit and 32-bit computers handle it easily. Many pre-1978 systems (Data General for one) did not support integers greater than 16-bits. > Does this size, and the resulting >size of numbers, have anything to do with the bit size of a machine? i think you mean "word size" instead of "bit size" and the answer to that is "yes". CDC (for example) has some 60-bit machines, and all of their items were 60 bits (or controllable subsets thereof) long. Hence you could have BIG integers, and lots of REAL precision. >For example, a PC would have 8, 16, or 32 for the bit size depending >upon whether it is an XT-type, AT-type, or 386-type machine, as I >understand it. If I transport a program from a 64-bit mainframe, will >the numerical precision for REAL numbers, and the maximum size for >INTEGERS, be less? Would it be necessary to change variables to >DOUBLE PRECISION, or something like that, to get the same precision? i think you'll find that most PC (all types) compilers use REAL*4 as their default. Whether you gain or lose a bit of precision depends up[on how the manufacturer chops the REAL data type into mantissa and exponent regions. > >2. Are the dimension statements REAL*8, etc., part of Fortran 77, 90 >or whatever, or are they just a VS extension? they are an extension (the ANSI standard doesn't show "*8") but many compiler suppiers support the syntax (again, IBM did it first, and everyone needed to be sort of compatible) > > Thanks for any discussion on these things. --Phil good luck --dick