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

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

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

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

View Full Document
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
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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 08/08/2011 for the course PHZ 5156 taught by Professor Johnson,m during the Fall '08 term at University of Central Florida.

### 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
Ask a homework question - tutors are online