Section 17.5 - Other Ada Capabilities
Here are some other Ada capabilities that we haven't covered so far
but which you may be interested in:
- Ada 95 also provides a
"modular"
type, which is an integer that varies
from zero up to some integer modulus-1.
Unlike a normal integer, if you add or subtract a value and the result
doesn't fit, the result wraps around.
For example, a modulus 4 value can have the values 0, 1, 2, and 3.
If you added one to 3, you'd get 0 (due to wrapping around).
Modular types don't need to be powers of two, but if they are the
Ada compiler will select especially efficient operations to implement them.
Bit manipulation operations, such as and and or can
be used on modular types.
- Ada provides a
"fixed
point" type; these are basically integers that
the Ada compiler will automatically scale so that they can be used
as though they were floating point numbers.
This combines the exactness and speed of integers
(which on many machines are faster than Floats)
with the convenience of floating point numbers.
- Ada 95 has a number of predefined mathematical operations, including
a
random number generator,
trigonometric
and logarithmic operations, and
complex
numbers.
- Ada 95 has a number of predefined
Character
handling subprograms (to upper case, to lower case, etc) and
string
mapping subprograms (to create sets of characters for translation
and word edge detection).
- Ada 95 compilers that support the information systems annex (annex F)
also support
packed
decimal types, a type needed for many business
programming problems.
There is no quiz question for this section.
You may go to the next section.
You may also:
Go back to the previous section
Go up to the outline of lesson 17
David A. Wheeler (wheeler@ida.org)