ada Scalar Types


In Ada's hierarchy of types, elementary types have sets of logically indivisible values. Among these types are the access types (pointer types) and the scalar types. The scalar types can be categorised as enumeration, character, and numeric. These types form the subject of this topic. In addition to the sets of values, types have set of operations applicable to the respective scalars, such as successor, or "+".


  1. typeis


… (1)to receive the type's name
… (2)to receive the type's characteristics using keywords: delta, digits, range


All scalar type definitions except enumeration and modular integers may include a range constraint.

A range constraint specifies a lower bound and an upper bound of the set of values to include in the type. For fixed point types, specifying a range is mandatory: values of these types will be understood to be multiples of a small fraction of two, for example, of 1/25. The smaller these fractions become, the more precise the representation, at the cost of range that can be represented using the bits available.

Further aspects of type definitions may be given, such as a desired Size in bits and other representational items. Ada 2012 adds aspects of contract based programming like Static_Predicate.