-- This package contains the Leading and Trailing parts of -- numbers that can not be exactly represented on computers -- with a MACHINE_RADIX that is a power of 2. -- The leading part plus the trailing part represent the constant to -- at least five bits greater accuracy than can be represented by -- 128 bit floating point. The leading part can be represented -- exactly in about 5 bits. The trailing part has significant digits -- accurate to a model interval. generic type FLOAT_TYPE is digits <>; package TEST_MATH_LT_CONSTANTS is -- The enumeration literals are used to retrieve the Leading part, Trailing -- part and machine approximation. type TYPE_LT is ( ZERO_LT, PI_LT, PI2_LT, PI4_LT, E_LT); procedure FIND_LT( NAME_LT : TYPE_LT; LEAD : out FLOAT_TYPE; -- exact TRAIL : out FLOAT_TYPE; -- approximate + 5 bits MACHINE : out FLOAT_TYPE); -- approximate number end TEST_MATH_LT_CONSTANTS; package body TEST_MATH_LT_CONSTANTS is procedure FIND_LT( NAME_LT : TYPE_LT; LEAD : out FLOAT_TYPE; -- exact TRAIL : out FLOAT_TYPE; -- approximate + 5 bits MACHINE : out FLOAT_TYPE) is -- approximate number begin case NAME_LT is when ZERO_LT => LEAD := 0.0; TRAIL := 0.0; MACHINE := 0.0; when PI_LT => LEAD := 3.125; TRAIL := 0.01659_26535_89793_23846_26433_83279_50288_41971 ; MACHINE := 3.14159_26535_89793_23846_26433_83279_50288_41971 ; when PI2_LT => LEAD := 1.5625; TRAIL := 0.00829_63267_94896_61923_13216_91639_75144_209858; MACHINE := 1.57079_63267_94896_61923_13216_91639_75144_209858; when PI4_LT => LEAD := 0.78125; TRAIL := 0.00414_81633_97448_30961_56608_45819_87572_104929; MACHINE := 0.78539_81633_97448_30961_56608_45819_87572_104929; when E_LT => LEAD := 2.625; TRAIL := 0.09328_18284_59045_23536_02874_71352_66249_77572 ; MACHINE := 2.71828_18284_59045_23536_02874_71352_66249_77572 ; end case; end FIND_LT; end TEST_MATH_LT_CONSTANTS;