![]() If the answer is not really an integer, Fortran makes it one by discarding the decimal point and all digits thereafter. One idiosyncrasy of Fortran is that when it performs arithmetic on integers, it insists on giving an answer that is likewise an integer. and 4.0 as real numbers.Īn integer N in GNU Fortran must lie within the range Examples of numbers not considered integers by Fortran areīecause of the decimal points, Fortran will regard 3. Examples of numbers considered integers by Fortran areįor positive integers the plus sign is optional, but negative integers must be preceded by a minus sign. In this lesson we look more closely at some of the rules and conventions that must be observed.Īn integer in Fortran is a whole number it cannot contain commas or a decimal point. Whereas Basic is more lenient, allowing some flexibility in mixing variables and numbers of different types, Fortran is less forgiving and will make you pay for oversights. To avoid mistakes in Fortran arithmetic you must pay close attention to rules regarding working with numbers of the various types. In Fortran Lesson 1 we briefly looked at the types of variables in Fortran.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |