Ada Conformity Assessment Authority      Home Conformity Assessment   Test Suite ARGAda Standard
 
Ada Reference Manual (Ada 2022 with Amendment 1)Legal Information
Contents   Index   References   Search   Previous   Next 

A.5.4 Attributes of Fixed Point Types

Static Semantics

1
The following representation-oriented attributes are defined for every subtype S of a fixed point type T.
2
S'Machine_Radix

Yields the radix of the hardware representation of the type T. The value of this attribute is of the type universal_integer.
3
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 T; yields the value False otherwise. The value of this attribute is of the predefined type Boolean.
4
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 T; yields the value False otherwise. The value of this attribute is of the predefined type Boolean. 
5/6
A fixed point type has integral values if its Small value is an integer or the reciprocal of an integer. A generic formal type is defined to have integral values.
6/6
The following primitive function attributes are defined for every subtype S of a fixed point type T that has integral values. 
7/6
S'Ceiling
S'Ceiling denotes a function with the following specification: 
7.1/6
function S'Ceiling (X : T)
   return T
7.2/6
The function yields the value Ceiling(X), that is, the smallest (most negative) integral value greater than or equal to X.
8/6
S'Floor
S'Floor denotes a function with the following specification: 
8.1/6
function S'Floor (X : T)
   return T
8.2/6
The function yields the value Floor(X), that is, the largest (most positive) integral value less than or equal to X.
9/6
S'Rounding
S'Rounding denotes a function with the following specification: 
9.1/6
function S'Rounding (X : T)
   return T
9.2/6
The function yields the integral value nearest to X, rounding away from zero if X lies exactly halfway between two integers.
10/6
S'Unbiased_Rounding

S'Unbiased_Rounding denotes a function with the following specification: 
10.1/6
function S'Unbiased_Rounding (X : T)
   return T
10.2/6
The function yields the integral value nearest to X, rounding toward the even integer if X lies exactly halfway between two integers.
11/6
S'Machine_Rounding

S'Machine_Rounding denotes a function with the following specification: 
11.1/6
function S'Machine_Rounding (X : T)
   return T
11.2/6
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. This function provides access to the rounding behavior which is most efficient on the target processor.
12/6
S'Truncation
S'Truncation denotes a function with the following specification: 
12.1/6
function S'Truncation (X : T)
   return T
12.2/6
The function yields the value Ceiling(X) when X is negative, and Floor(X) otherwise.
13/6
For all of these attributes, if T is a generic formal type, Program_Error is raised if the actual subtype does not have integral values.

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe