1

{*representation-oriented
attributes (of a floating point subtype)*} The
following *representation-oriented attributes* are defined for every
subtype S of a floating point type *T*.

2

S'Machine_Radix

Yields the radix of the hardware representation of the type

3

{*canonical form*}
The values of other representation-oriented attributes
of a floating point subtype, and of the “primitive function”
attributes of a floating point subtype described later, are defined in
terms of a particular representation of nonzero values called the *canonical
form*. The canonical form (for the type *T*) is the form

±*mantissa*
· *T*'Machine_Radix^{exponent}

where

±

where

4

*mantissa*is a fraction in the number base*T*'Machine_Radix, the first digit of which is nonzero, and

5

*exponent*is an integer.

6

S'Machine_Mantissa

Yields the largest value of

6.a

7

S'Machine_Emin

Yields the smallest (most negative) value of

8

S'Machine_Emax

Yields the largest (most positive) value of

8.a

9

S'Denorm

Yields the value True if every
value expressible in the form

±*mantissa*
· *T*'Machine_Radix^{T'Machine_Emin}

where*mantissa* is a nonzero *T*'Machine_Mantissa-digit fraction
in the number base *T*'Machine_Radix, the first digit of which is
zero, is a machine number (see 3.5.7) of
the type *T*; yields the value False otherwise. The value of this
attribute is of the predefined type Boolean.

±

where

10

{*denormalized number*}
The values described by the formula in the definition
of S'Denorm are called *denormalized numbers*. {*normalized
number*} A nonzero machine number that
is not a denormalized number is a *normalized number*. {*represented
in canonical form*} {*canonical-form
representation*} A normalized number *x*
of a given type *T* is said to be *represented in canonical form*
when it is expressed in the canonical form (for the type *T*) with
a *mantissa* having *T*'Machine_Mantissa digits; the resulting
form is the *canonical-form representation* of *x*.

10.a

11

S'Machine_Rounds

Yields the value True if rounding is performed on inexact results of every predefined operation that yields a result of the type

11.a

11.b

- S'Model_Mantissa = S'Machine_Mantissa, so that operand preperturbation never occurs;

11.c

- when the exact mathematical result is not a machine number, the result of a predefined operation must be the nearer of the two adjacent machine numbers.

11.d

Technically, this attribute should yield False
when extended registers are used, since a few computed results will cross
over the half-way point as a result of double rounding, if and when a
value held in an extended register has to be reduced in precision to
that of the machine numbers. It does not seem desirable to preclude the
use of extended registers when S'Machine_Rounds could otherwise be True.

12

S'Machine_Overflows

Yields the value True if overflow and divide-by-zero are detected and reported by raising Constraint_Error for every predefined operation that yields a result of the type

13

S'Signed_Zeros

Yields the value True if the hardware representation for the type

14

{*normalized
exponent*} For every value *x*
of a floating point type *T*, the *normalized exponent* of
*x* is defined as follows:

15

- the normalized exponent of zero is (by convention) zero;

16

- for nonzero
*x*, the normalized exponent of*x*is the unique integer*k*such that*T*'Machine_Radix^{k–1}≤ |*x*| <*T*'Machine_Radix^{k}.

16.a

16.b

The normalized exponent of a denormalized number
is less than the value of *T*'Machine_Emin.

17

{*primitive
function*} The following *primitive function
attributes* are defined for any subtype S of a floating point type
*T*.

18

S'Exponent

19

20

The function yields the normalized exponent
of *X*.

21

S'Fraction

22

23

The function yields the value *X*
· *T*'Machine_Radix^{–k},
where *k* is the normalized exponent
of *X*. A zero result[, which can only occur when *X* is zero,]
has the sign of *X*.

23.a

23.b

23.c

24

S'Compose

25

26

{*Constraint_Error
(raised by failure of run-time check)*} Let
*v* be the value *Fraction*
· *T*'Machine_Radix^{Exponent–k},
where *k* is the normalized exponent
of *Fraction*. If *v* is a machine
number of the type *T*, or if |*v*|
≥ *T*'Model_Small,
the function yields *v*; otherwise, it
yields either one of the machine numbers of the type *T* adjacent
to *v*. {*Range_Check*
[partial]} {*check,
language-defined (Range_Check)*} Constraint_Error
is optionally raised if *v* is outside
the base range of S. A zero result has the sign of *Fraction* when
S'Signed_Zeros is True.

26.a

26.b

27

S'Scaling

28

29

{*Constraint_Error
(raised by failure of run-time check)*} Let
*v* be the value *X*
· *T*'Machine_Radix^{Adjustment}.
If *v* is a machine number of the type
*T*, or if |*v*| ≥ *T*'Model_Small,
the function yields *v*; otherwise, it
yields either one of the machine numbers of the type *T* adjacent
to *v*. {*Range_Check*
[partial]} {*check,
language-defined (Range_Check)*} Constraint_Error
is optionally raised if *v* is outside
the base range of S. A zero result has the sign of *X* when S'Signed_Zeros
is True.

29.a

29.b

30

S'Floor

31

32

The function yields the value *Floor*(*X*),
i.e., the largest (most positive) integral value less than or equal to
*X*. When *X* is zero, the result has the sign of *X*;
a zero result otherwise has a positive sign.

33

S'Ceiling

34

35

The function yields the value *Ceiling*(*X*),
i.e., the smallest (most negative) integral value greater than or equal
to *X*. When *X* is zero, the result has the sign of *X*;
a zero result otherwise has a negative sign when S'Signed_Zeros is True.

36

S'Rounding

37

38

The function yields the integral value nearest
to *X*, rounding away from zero if *X* lies exactly halfway
between two integers. A zero result has the sign of *X* when S'Signed_Zeros
is True.

39

S'Unbiased_Rounding

40

41

The function yields the integral value nearest
to *X*, rounding toward the even integer if *X* lies exactly
halfway between two integers. A zero result has the sign of *X*
when S'Signed_Zeros is True.

41.1/2

S'Machine_Rounding

41.2/2

41.3/2

The function yields the
integral value nearest to *X*. If *X* lies exactly halfway
between two integers, one of those integers is returned, but which of
them is returned is unspecified. A zero result has the sign of *X*
when S'Signed_Zeros is True. This function provides access to the rounding
behavior which is most efficient on the target processor.{*unspecified*
[partial]}

41.a.1/2

42

S'Truncation

43

44

The function yields the value *Ceiling*(*X*)
when *X* is negative, and *Floor*(*X*)
otherwise. A zero result has the sign of *X* when S'Signed_Zeros
is True.

45

S'Remainder

46

47

{*Constraint_Error
(raised by failure of run-time check)*} For
nonzero *Y*, let *v* be the value
*X* – *n*
· *Y*, where *n*
is the integer nearest to the exact value of *X*/*Y*;
if |*n* – *X*/*Y*|
= 1/2, then *n* is chosen to be even.
If *v* is a machine number of the type
*T*, the function yields *v*; otherwise,
it yields zero. {*Division_Check* [partial]}
{*check, language-defined
(Division_Check)*} Constraint_Error is
raised if *Y* is zero. A zero result has the sign of *X* when
S'Signed_Zeros is True.

47.a

47.b

48

S'Adjacent

49

50

{*Constraint_Error
(raised by failure of run-time check)*} If
*Towards* = *X*,
the function yields *X*; otherwise, it yields the machine number
of the type *T* adjacent to *X* in the direction of *Towards*,
if that machine number exists. {*Range_Check*
[partial]} {*check,
language-defined (Range_Check)*} If the
result would be outside the base range of S, Constraint_Error is raised.
When *T*'Signed_Zeros is True, a zero result has the sign of *X*.
When *Towards* is zero, its sign has no bearing on the result.

50.a

51

S'Copy_Sign

52

53

{*Constraint_Error
(raised by failure of run-time check)*} If
the value of *Value* is nonzero, the function yields a result whose
magnitude is that of *Value* and whose sign is that of *Sign*;
otherwise, it yields the value zero. {*Range_Check*
[partial]} {*check,
language-defined (Range_Check)*} Constraint_Error
is optionally raised if the result is outside the base range of S. A
zero result has the sign of *Sign* when S'Signed_Zeros is True.

53.a

54

S'Leading_Part

55

56

Let *v* be
the value *T*'Machine_Radix^{k–Radix_Digits},
where *k* is the normalized exponent
of *X*. The function yields the value

57

*Floor*(*X*/*v*) ·*v*, when*X*is nonnegative and*Radix_Digits*is positive;

58

*Ceiling*(*X*/*v*) ·*v*, when*X*is negative and*Radix_Digits*is positive.

59

{*Constraint_Error
(raised by failure of run-time check)*} {*Range_Check*
[partial]} {*check,
language-defined (Range_Check)*} Constraint_Error
is raised when *Radix_Digits* is zero or negative. A zero result[,
which can only occur when *X* is zero,] has the sign of *X*.

59.a

59.b

60

S'Machine

61

62

{*Constraint_Error
(raised by failure of run-time check)*} If
*X* is a machine number of the type *T*, the function yields
*X*; otherwise, it yields the value obtained by rounding or truncating
*X* to either one of the adjacent machine numbers of the type *T*.
{*Range_Check* [partial]} {*check,
language-defined (Range_Check)*} Constraint_Error
is raised if rounding or truncating *X* to the precision of the
machine numbers results in a value outside the base range of S. A zero
result has the sign of *X* when S'Signed_Zeros is True.

62.a

62.b

63

{*model-oriented
attributes (of a floating point subtype)*} The
following *model-oriented attributes* are defined for any subtype
S of a floating point type *T*.

64

S'Model_Mantissa

If the Numerics Annex is not supported, this attribute yields an implementation defined value that is greater than or equal to

65

S'Model_Emin

If the Numerics Annex is not
supported, this attribute yields an implementation defined value that
is greater than or equal to the value of *T*'Machine_Emin. See G.2.2
for further requirements that apply to implementations supporting the
Numerics Annex. The value of this attribute is of the type *universal_integer*.

66

S'Model_Epsilon

Yields the value

66.a

67

S'Model_Small

Yields the value

67.a

68

S'Model

69

70

If the Numerics Annex is not supported, the
meaning of this attribute is implementation defined; see G.2.2
for the definition that applies to implementations supporting the Numerics
Annex.

71

S'Safe_First

Yields the lower bound of the
safe range (see 3.5.7) of the type *T*.
If the Numerics Annex is not supported, the value of this attribute is
implementation defined; see G.2.2 for the
definition that applies to implementations supporting the Numerics Annex.
The value of this attribute is of the type *universal_real*.

72

S'Safe_Last

Yields the upper bound of the
safe range (see 3.5.7) of the type *T*.
If the Numerics Annex is not supported, the value of this attribute is
implementation defined; see G.2.2 for the
definition that applies to implementations supporting the Numerics Annex.
The value of this attribute is of the type *universal_real*.

72.a

72.b

72.c

72.d

{*incompatibilities with Ada 83*} The
Epsilon and Mantissa attributes of floating point types are removed from
the language and replaced by Model_Epsilon and Model_Mantissa, which
may have different values (as a result of changes in the definition of
model numbers); the replacement of one set of attributes by another is
intended to convert what would be an inconsistent change into an incompatible
change.

72.e

The Emax, Small, Large, Safe_Emax, Safe_Small,
and Safe_Large attributes of floating point types are removed from the
language. Small and Safe_Small are collectively replaced by Model_Small,
which is functionally equivalent to Safe_Small, though it may have a
slightly different value. The others are collectively replaced by Safe_First
and Safe_Last. Safe_Last is functionally equivalent to Safe_Large, though
it may have a different value; Safe_First is comparable to the negation
of Safe_Large but may differ slightly from it as well as from the negation
of Safe_Last. Emax and Safe_Emax had relatively few uses in Ada 83; T'Safe_Emax
can be computed in the revised language as Integer'Min(T'Exponent(T'Safe_First),
T'Exponent(T'Safe_Last)).

72.f

Implementations are encouraged to eliminate
the incompatibilities discussed here by retaining the old attributes,
during a transition period, in the form of implementation-defined attributes
with their former values.

72.g

{*extensions to Ada 83*} The
Model_Emin attribute is new. It is conceptually similar to the negation
of Safe_Emax attribute of Ada 83, adjusted for the fact that the model
numbers now have the hardware radix. It is a fundamental determinant,
along with Model_Mantissa, of the set of model numbers of a type (see
G.2.1).

72.h

The Denorm and Signed_Zeros attributes are new,
as are all of the primitive function attributes.

72.i/2

{*AI95-00388-01*}
{*extensions to Ada 95*} The
Machine_Rounding attribute is new.

Sponsored by **Ada-Europe**