lecture6

lecture6 - Double precision, real and complex To make a...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Double precision, real and complex To make a single precision real number, we declare REAL :: X, Y, Z These are accurate to 7 significant digits, usually stored in 32 bits. Single precision is the default If we want double precision, REAL*8 :: X, Y, Z DOUBLE PRECISION :: A, B, C INTEGER, PARAMETER :: Prec14 = SELECTED_REAL_KIND(14) REAL(KIND = Prec14) :: D, E, F Each of these gives 14 digit precision in 64 bits
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Declaring values within equations For numbers in an equation, we use for single/double precision: 4.2d0 (4.2 to 14 digits of precision) 4.2e0 (4.2 to 7 digits of precision) Why does it matter? When mixing precisions, if something is defined as single precision, the undetermined digits can be filled with garbage numbers
Background image of page 2
Complex variables and arrays Again default is single precision COMPLEX :: psi Here, psi will be a complex number with the real and imaginary part precise to 7 digits (64 bits total!) Interestingly, COMPLEX*8 :: psi Also gives single precision
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

lecture6 - Double precision, real and complex To make a...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online