Annotated Ada Reference Manual (Ada 202y Draft 1)Legal Information
Contents   Index   References   Search   Previous   Next 

F.2 The Package Decimal

Static Semantics

1
The library package Decimal has the following declaration: 
2/5
{AI12-0414-1} package Ada.Decimal
   with Pure is
3
   Max_Scale : constant := implementation-defined;
   Min_Scale : constant := implementation-defined;
4
   Min_Delta : constant := 10.0**(-Max_Scale);
   Max_Delta : constant := 10.0**(-Min_Scale);
5
   Max_Decimal_Digits : constant := implementation-defined;
6/3
{AI05-0229-1}    generic
      type Dividend_Type  is delta <> digits <>;
      type Divisor_Type   is delta <> digits <>;
      type Quotient_Type  is delta <> digits <>;
      type Remainder_Type is delta <> digits <>;
   procedure Divide (Dividend  : in Dividend_Type;
                     Divisor   : in Divisor_Type;
                     Quotient  : out Quotient_Type;
                     Remainder : out Remainder_Type)
      with Convention => Intrinsic;
7
end Ada.Decimal;
7.a
Implementation defined: The values of named numbers in the package Decimal.
8
Max_Scale is the largest N such that 10.0**(–N) is allowed as a decimal type's delta. Its type is universal_integer.
9
Min_Scale is the smallest N such that 10.0**(–N) is allowed as a decimal type's delta. Its type is universal_integer.
10
Min_Delta is the smallest value allowed for delta in a decimal_fixed_point_definition. Its type is universal_real.
11
Max_Delta is the largest value allowed for delta in a decimal_fixed_point_definition. Its type is universal_real.
12
Max_Decimal_Digits is the largest value allowed for digits in a decimal_fixed_point_definition. Its type is universal_integer
12.a
Reason: The name is Max_Decimal_Digits versus Max_Digits, in order to avoid confusion with the named number System.Max_Digits relevant to floating point. 

Static Semantics

13
The effect of Divide is as follows. The value of Quotient is Quotient_Type(Dividend/Divisor). The value of Remainder is Remainder_Type(Intermediate), where Intermediate is the difference between Dividend and the product of Divisor and Quotient; this result is computed exactly. 

Implementation Requirements

14
Decimal.Max_Decimal_Digits shall be at least 18.
15
Decimal.Max_Scale shall be at least 18.
16
Decimal.Min_Scale shall be at most 0. 
17
NOTE   The effect of division yielding a quotient with control over rounding versus truncation is obtained by applying either the function attribute Quotient_Type'Round or the conversion Quotient_Type to the expression Dividend/Divisor. 

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