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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Page 34 Computer Languages for Eng<strong>in</strong>eer<strong>in</strong>g - SS 13Figure 2.2: Factorial us<strong>in</strong>g INTEGER with 4 BytesFor larger numbers the choice of a real data type is recommended. With<strong>in</strong> a real data type only theexponent can overflow. The mantissa can not overflow, because it’s <strong>in</strong>dependent of the number’s size. Ifwe use the largest available data type double precision 10 , we will get the situation of figure 2.3.We see, that with the 8 byte real the factorial reaches 170!. The next result is <strong>in</strong>dicated as Inf<strong>in</strong>ity. Thishappens, if the memory for the exponent overflows. A 4 byte real has an exponent range of −38 · · · + 38,a 8 byte real has an exponent range of −308 · · · + 308. We see, that the largest occurr<strong>in</strong>g exponent is+306.2.9 Branch<strong>in</strong>gBranch<strong>in</strong>g and decisions can be implemented <strong>in</strong> Fortran like <strong>in</strong> the most languages with an if -statement.The application of if constructs will be discussed us<strong>in</strong>g the implementation of the general form of aquadratic equation. With<strong>in</strong> a first approach the implementation <strong>in</strong> a Fortran66 like program is shown.2.9.1 if Statement, Fortran 66 likeWith<strong>in</strong> the first standardized Fortran version, which will be compiled from modern Fortran compilerstoo, the if statement is very rough. It’s like a branch <strong>in</strong> assembler language, that is, the if statement onlyis able to process one statement. Note the two statements <strong>in</strong> the macro assembler code of section 1.2.1resumed below. With<strong>in</strong> a first step, a registers data is compared. In a second step a conditional jump isperformed.1 ...2 cmp edx, 2 < compar<strong>in</strong>g the content of the edx with 23 ja @f < jump, if equal4 ...10 The data type double precision with FORTRAN 90 is obsolete, see also section 2.5.2, but can be used, if you want.E. Baeck

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

Saved successfully!

Ooh no, something went wrong!