This appendix, adapted from the Ada 95 Reference
Manual, Sections A.5.1 and
A.5.2, give the specifications for the packages Ada.Numerics
,
Ada.Numerics.Elementary_Functions
, and
Ada.Numerics.Float_Random
, and the generic package
Ada.Numerics.Discrete_Random
,.
PACKAGE Ada.Numerics IS Argument_Error : EXCEPTION; Pi : CONSTANT := 3.14159_26535_89793_23846_26433_83279_50288_41971_69399_37511; e : CONSTANT := 2.71828_18284_59045_23536_02874_71352_66249_77572_47093_69996; END Ada.Numerics; PACKAGE Ada.Numerics.Elementary_Functions IS FUNCTION Sqrt ( X : Float) RETURN Float; FUNCTION Log ( X : Float) RETURN Float; FUNCTION Log ( X, Base : Float) RETURN Float; FUNCTION Exp ( X : Float) RETURN Float; FUNCTION "**" ( Left, Right : Float) RETURN Float; FUNCTION Sin ( X : Float) RETURN Float; FUNCTION Sin ( X, Cycle : Float) RETURN Float; FUNCTION Cos ( X : Float) RETURN Float; FUNCTION Cos ( X, Cycle : Float) RETURN Float; FUNCTION Tan ( X : Float) RETURN Float; FUNCTION Tan ( X, Cycle : Float) RETURN Float; FUNCTION Cot ( X : Float) RETURN Float; FUNCTION Cot ( X, Cycle : Float) RETURN Float; FUNCTION Arcsin ( X : Float) RETURN Float; FUNCTION Arcsin ( X, Cycle : Float) RETURN Float; FUNCTION Arccos ( X : Float) RETURN Float; FUNCTION Arccos ( X, Cycle : Float) RETURN Float; FUNCTION Arctan ( Y : Float; X : Float := . ) RETURN Float; FUNCTION Arctan ( Y : Float; X : Float := . ; Cycle : Float) RETURN Float; FUNCTION Arccot ( X : Float; Y : Float := . ) RETURN Float; FUNCTION Arccot ( X : Float; Y : Float := . ; Cycle : Float) RETURN Float; FUNCTION Sinh ( X : Float) RETURN Float; FUNCTION Cosh ( X : Float) RETURN Float; FUNCTION Tanh ( X : Float) RETURN Float; FUNCTION Coth ( X : Float) RETURN Float; FUNCTION Arcsinh ( X : Float) RETURN Float; FUNCTION Arccosh ( X : Float) RETURN Float; FUNCTION Arctanh ( X : Float) RETURN Float; FUNCTION Arccoth ( X : Float) RETURN Float; END Ada.Numerics.Elementary_Functions; PACKAGE Ada.Numerics.Float_Random IS -- Basic facilities TYPE Generator IS limited private; SUBTYPE Uniformly_Distributed IS Float RANGE 0.0 .. 1.0; FUNCTION Random ( Gen : Generator) RETURN Uniformly_Distributed; PROCEDURE Reset ( Gen : IN Generator; Initiator : IN Integer); PROCEDURE Reset ( Gen : IN Generator); -- Advanced facilities TYPE State IS private; PROCEDURE Save ( Gen : IN Generator; To_State : OUT State); PROCEDURE Reset ( Gen : IN Generator; From_State : IN State); Max_Image_Width : constant := implementation-defined integer value; FUNCTION Image ( Of_State : State) RETURN String; FUNCTION Value ( Coded_State : String) RETURN State; PRIVATE ... -- not specified by the language END Ada.Numerics.Float_Random; GENERIC TYPE Result_SubTYPE IS (<>); PACKAGE Ada.Numerics.Discrete_Random IS -- Basic facilities TYPE Generator IS limited private; FUNCTION Random ( Gen : Generator) RETURN Result_SubTYPE; PROCEDURE Reset ( Gen : IN Generator; Initiator : IN Integer); PROCEDURE Reset ( Gen : IN Generator); -- Advanced facilities TYPE State IS private; PROCEDURE Save ( Gen : IN Generator; To_State : OUT State); PROCEDURE Reset ( Gen : IN Generator; From_State : IN State); Max_Image_Width : constant := implementation-defined integer value; FUNCTION Image ( Of_State : State) RETURN String; FUNCTION Value ( Coded_State : String) RETURN State; PRIVATE ... -- not specified by the language END Ada.Numerics.Discrete_Random;
Copyright © 1996 by Addison-Wesley Publishing Company, Inc.