12.07.2015 Views

CAD in Civil Engineering - Baustatik-Info-Server

CAD in Civil Engineering - Baustatik-Info-Server

CAD in Civil Engineering - Baustatik-Info-Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Page 22 Computer Languages for Eng<strong>in</strong>eer<strong>in</strong>g - SS 13Because there are de facto so many special data types <strong>in</strong> FORTRAN 90 a new concept was <strong>in</strong>troducedto setup the desired byte length of a data type with the so called KIND number. The KIND number isdepended of the implementation of the FORTRAN 90, that means that the byte length is not generallyknown, if the KIND number is given. The KIND number of a given value can be evaluated by the functionKIND.The follow<strong>in</strong>g FORTRAN 90 code evaluates the KIND number of 0.0 and 0.0d0, i.e. of s<strong>in</strong>gle and doubleprecision for the gfortran compiler on 32 bit W<strong>in</strong>dows XP. 4List<strong>in</strong>g 2.4: Evaluat<strong>in</strong>g the K<strong>in</strong>d Number 901 ! Program to evaluate the k<strong>in</strong>d number of2 ! - s<strong>in</strong>gle precision (REAL)3 ! - double precision (DOUBLE PRECISION)4 program k<strong>in</strong>ds5 write( * ,’(" K<strong>in</strong>d of s<strong>in</strong>gle precision:",i2)’) k<strong>in</strong>d(0.0) ! it’s s<strong>in</strong>gle6 write( * ,’(" K<strong>in</strong>d of double precision:",i2)’) k<strong>in</strong>d(0.0d0) ! it’s double7 end programFigure 2.1 shows the compile and execution step of the K<strong>in</strong>d application. And you can see from theoutput, that s<strong>in</strong>gle precision gives a KIND number of 4, double precision a KIND number of 8 like real*4aund real*8 <strong>in</strong> the case FORTRAN 77 standard extension (see above).Figure 2.1: Evaluat<strong>in</strong>g the K<strong>in</strong>d Numbers2.5.3 Data RangesIf you select a data type for an implementation, then you should know the available data range of thatdata type. The data range can be depended of the <strong>in</strong>stalled operat<strong>in</strong>g system and from the processorhimself. So an <strong>in</strong>teger of the W<strong>in</strong>dows3 has half the range as the <strong>in</strong>teger from W<strong>in</strong>dowsXP, if the rangeis not explicit set us<strong>in</strong>g the * version of the data type. If a not properly data type is selected, then thecode will be <strong>in</strong>efficient if the data range is larger than needed. If the data range is smaller then needed,the code will not run properly because the data will go out of range, which will result an overflow withall it’s unpredictable consequences 5 .The follow<strong>in</strong>g table shows the ranges of the FORTRAN 77 data types.4 You see, that <strong>in</strong> FORTRAN 90 a program starts with the key word program and ends with end program.5 If you will implement a complex calculation algorithm with a lot of operations like the triangulation of a matrix, then youshould use the double precision data types, to avoid a losses of <strong>in</strong>formation.)E. Baeck

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!