Floating point type provides an approximation of the real number value.
type type_name is real_number_left_bound downto real_number_right_bound;
type type_name is real_number_left_bound to real_number_right_bound;
A floating point type is a numeric type consisting of real numbers which values are constrained by a specified range.
There exists only one predefined floating point type: REAL. The range of the values for the type REAL are implementation-dependent, but it is required by the standard that it covers the values from -1.0E38 to +1.0E38.
A user-defined floating point type can be constructed on the basis of the predefined REAL type by constraining its range (example 1). The bounds of the range of a user-defined floating point type should be in the form of locally static expression. The expression is classified as a locally static if it is possible to determine its value without running the code. The value of an expression used as a range for a floating point type must also be of floating point type, not necessarily the same for both bounds (example 2). Negative bounds are allowed.
All floating point types (including user-defined) have the same set of arithmetic operators, namely: addition, subtraction, multiplication, division, absolute function and exponentiation.
type Voltage_Level is range -5.5 to +5.5;
type Int_64K is range - 65536.00 to 65535.00;
type APPROX_VALUES_DOWNTO is range (2.0**(N+1)) - 1.0 downto 0.0;
type APPROX_VALUES_TO is range 0.0 to (2.0**(N+1)) - 1.0;
· In order to add, subtract, multiply or divide integer object to/from a real object, type conversion of the integer object is needed. The only exception from this rule is multiplication and division of universal integer and universal real.
· The floating point types are not synthesizeable by any of the existing tools. Their use is thus very limited.