Real Data Type

The data type real (also floating point or float) is an approximation of a real number. Real numbers include numbers such as and 2 that cannot be expressed as rationals, as well as numbers such as 0.1 that cannot be represented exactly as binary fractions. Since a real number is only approximated in the computer, such numbers are called inexact. Although floating-point numbers are inexact, they can be very accurate, with about 15 decimal digits of accuracy in a 64-bit floating point number.

Real constants are written with a decimal point and optionally with a power-of-ten exponent in scientific notation: 1.0, 0.3, 9.11E-31 = 9.11 10^-31.

Operations on reals include:

+ - * /
max min abs expt
sin cos tan sqrt
asin acos atan
exp log

atan can take one argument (in radians) or two:
(atan y x) computes tan^-1( y / x) .

Operations such as + can be performed on combinations of exact and inexact numbers, producing inexact results (``inexactness is contagious'').

Contents    Page-10    Prev    Next    Page+10    Index