Floating-point types in VHDL are used to represent real numbers. Mathematically speaking,
there is an infinite number of real numbers within any interval, so it is not possible
to represent real numbers exactly on a computer. Hence floating-point types are only an
approximation to real numbers. The term “floating point” refers to the fact that they are
represented using a mantissa part and an exponent part. This is similar to the way in which
we represent numbers in scientific notation.
Floating-point types in VHDL conform to IEEE Standard 754 or 854 for floating-point
computation and are represented using at least 64 bits. This gives approximately 15 decimal
digits of precision, and a range of approximately –1.8E+308 to +1.8E+308. An implementation
may choose to use a larger representation, providing correspondingly greater
precision or range. There is a predefined floating-point type called real, which includes
the greatest range allowed by the implementation’s floating-point representation. In most
implementations, this will be the range of the IEEE 64-bit double-precision representation.
We define a new floating-point type using a range-constraint type definition. The simplified
syntax rule for a floating-point type definition is