Ada Programming/Attributes/'Fixed Value

Description

edit

For every fixed-point type S, S'Fixed_Value denotes a function with the following specification:

function S'Fixed_Value (Arg : <Universal_Integer>) return S;

The value returned is the fixed-point value V such that:

V = Arg * S'Small

The effect is thus similar to first converting the argument to the integer type used to represent S, and then doing an unchecked conversion to the fixed-point type. The difference is that there are full range checks, to ensure that the result is in range. This attribute is primarily intended for use in implementation of the input-output functions for fixed-point values.