18.10.2014 Views

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

T'Digits The decimal precision. Universal Integer<br />

Appendix B 373<br />

T'Model_epsilon<br />

T'Safe_first<br />

T'Safe_last<br />

The absolute value of the<br />

difference between 1.0 and the<br />

next representable number above<br />

1.0.<br />

The lower bound of the safe<br />

range of T,<br />

The upper bound of the safe<br />

range of T,<br />

Universal real<br />

Of type T<br />

Of type T<br />

B.3 Literals <strong>in</strong> <strong>Ada</strong><br />

An <strong>in</strong>teger can be expressed <strong>in</strong> any base from 2 to 16 by prefix<strong>in</strong>g the number by its base. For example, the<br />

number 42 to base 10 can be written as:<br />

2#101010# 4#222# 8#52# 10#42# 16#2A#<br />

Note:<br />

The use of #’s to bracket the number.<br />

In a number the underscore character can be used to improve readability. Usually this will be used to separate a<br />

number <strong>in</strong>to groups of three digits.<br />

1_00 1_234.567_<br />

8<br />

The number 12.34 can be written as:<br />

0.123_4E2 1.234E1<br />

3.141_596<br />

1_000_000<br />

a numeric literal is of the type universal_<strong>in</strong>teger or universal_real, which allows the literal to be<br />

used freely with any appropriate type.<br />

B.4 Operators <strong>in</strong> <strong>Ada</strong> <strong>95</strong><br />

Operator Operand(s) Result<br />

and<br />

or<br />

xor<br />

Boolean<br />

1D Boolean array<br />

modular<br />

Boolean<br />

1D Boolean array<br />

modular<br />

and then Boolean Boolean<br />

or else<br />

< >= scalar<br />

1D discrete array<br />

Boolean<br />

Boolean<br />

= /= any non limited operands Boolean<br />

<strong>in</strong> scalar <strong>in</strong> range Boolean<br />

not <strong>in</strong> scalar not <strong>in</strong> range<br />

&<br />

1D array & 1D array<br />

1D array & element<br />

element & 1D array<br />

element & element<br />

1D array<br />

1D array<br />

1D array<br />

1D array<br />

© M A Smith - May not be reproduced without permission

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!