[Ada Information Clearinghouse]
Ada '83 Rationale, Sec 5.5: Conclusion (to Ch 5: Numeric Types)

"Rationale for the Design of the
Ada® Programming Language"

[Ada '83 Rationale, HTML Version]

Copyright ©1986 owned by the United States Government. All rights reserved.
Direct inquiries to the Ada Information Clearinghouse at adainfo@sw-eng.falls-church.va.us.

CHAPTER 5: Numeric Types

5.5 Conclusion

The aim of the design is to provide the full range of numeric facilities within a secure system of types. This has been achieved by a combination of two techniques.

Firstly, use is made of the ability in the language to define new types derived from an existing type, from which the new types inherit properties. The convenience of the derived type mechanism in Ada is that it provides a simple method of ensuring a high degree of portability. If the user declares a new type (therefore derived from a machine type), this type is distinct from other types in the program. This distinction ensures that type conversions are explicit and that a quite different representation could be used on other machines.

Secondly, the precision of numerical representation and the bounds on results of computation are strictly controlled: With the model developed by Brown, it is possible to define an axiomatic system which gives the minimal properties of approximate computation. These minimal accuracy properties could be exploited by a diagnostic or program analysis system to ensure that the algorithm being used is appropriate. The axiomatic system is realistic in the sense that it can (and must) be applied to existing floating point implementations.

The numeric types available to the programmer are derived from those defined in the implementation. This guarantees that the efficiency of the resulting code is directly related to that of the implementation, which, in the case of floating point, could be hardware, firmware, or software. Fixed point types are not predefined in the standard environment, but acquire their properties on declaration. However, in terms of code generation these properties involve little more than what is required for the integers and hence the performance should be high.

Portability cannot be entirely guaranteed by the language because it is not possible for a program to be completely isolated from dependence on the underlying hardware. However, such dependence is limited to the attributes of the predefined numeric types, and properties of the implemented real types that cannot be derived from the axiomatic system - such as the radix of the underlying floating point representation.

To conclude, the numeric types in Ada provide facilities clearly needed by the envisaged applications. A rigorous axiomatic system is available to handle approximate computation. Most importantly, a good balance between portability and efficiency has been achieved.

Address any questions or comments to adainfo@sw-eng.falls-church.va.us.