8.7 Summary
The following are some practical rules and guidelines:
-
Learn the rules for the evaluation of arithmetic expressions.
-
Break expressions down where necessary to ensure that the expressions are evaluated in the way you want.
-
Take care with truncation owing to integer division in an expression. Note that this will only be a problem where both parts of the division are INTEGER.
-
Take care with truncation owing to the assignment statement when there is an integer on the left-hand side of the statement, i.e., assigning a real into an integer variable.
-
When you want to set up constants which will remain unchanged throughout the program, use the PARAMETER statement.
-
Do not confuse precision and accuracy.
-
Learn what the default KINDs are for the numeric types you work with, what the maximum and minimum values and precision are for REAL data, and what the maximum and minimum are for INTEGER data.
-
You have been introduced to the use of the functions DIGITS, HUGE and PRECISION, and some of the concepts involved in their use. We will look at functions in much greater depth later on.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
8.9 Bibliography
Froberg C.E., Introduction to Numerical Analysis, Addison-Wesley, 1969.
IEEE, IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754–1985, Institute of Electrical and Electronic Engineers Inc.
Knuth D., Seminumerical Algorithms, Addison-Wesley, 1969.
Sun, Numerical Computation Guide, SunPro, 1993.
Wakerly J.F., Microcomputer Architecture and Programming, Wiley, 1981.
Rights and permissions
Copyright information
© 2006 Springer-Verlag London Limited
About this chapter
Cite this chapter
(2006). Arithmetic. In: Introduction to Programming with Fortran. Springer, London. https://doi.org/10.1007/1-84628-054-0_8
Download citation
DOI: https://doi.org/10.1007/1-84628-054-0_8
Publisher Name: Springer, London
Print ISBN: 978-1-84628-053-5
Online ISBN: 978-1-84628-054-2
eBook Packages: Computer ScienceComputer Science (R0)