1"use strict";(self.webpackChunkada_lang_io=self.webpackChunkada_lang_io||[]).push([["5594"],{64449(e,n,i){i.r(n),i.d(n,{metadata:()=>s,default:()=>A,frontMatter:()=>c,contentTitle:()=>x,toc:()=>j,assets:()=>u});var s=JSON.parse('{"id":"arm/AA-A/AA-A.5","title":"A.5. The Numerics Packages","description":"This Reference Manual output has not been verified,","source":"@site/docs/arm/AA-A/AA-A.5.mdx","sourceDirName":"arm/AA-A","slug":"/arm/AA-A/AA-A.5","permalink":"/docs/arm/AA-A/AA-A.5","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":125,"frontMatter":{"sidebar_position":125},"sidebar":"referenceManualSidebar","previous":{"title":"A.4. String Handling","permalink":"/docs/arm/AA-A/AA-A.4"},"next":{"title":"A.6. Input-Output","permalink":"/docs/arm/AA-A/AA-A.6"}}'),r=i(74848),t=i(28453),a=i(98113),o=i(60271),l=i(9011),d=i(48554),h=i(94029);let c={sidebar_position:125},x="A.5. The Numerics Packages",u={},j=[{value:"Static Semantics",id:"static-semantics",level:4},{value:"Implementation Permissions",id:"implementation-permissions",level:4},{value:"Extensions to Ada 83",id:"extensions-to-ada-83",level:4},{value:"Extensions to Ada 95",id:"extensions-to-ada-95",level:4},{value:"A.5.1 Elementary Functions",id:"a51--elementary-functions",level:2},{value:"Static Semantics",id:"static-semantics-1",level:4},{value:"Dynamic Semantics",id:"dynamic-semantics",level:4},{value:"Implementation Requirements",id:"implementation-requirements",level:4},{value:"Implementation Permissions",id:"implementation-permissions-1",level:4},{value:"Wording Changes from Ada 83",id:"wording-changes-from-ada-83",level:4},{value:"Wording Changes from Ada 95",id:"wording-changes-from-ada-95",level:4},{value:"A.5.2 Random Number Generation",id:"a52--random-number-generation",level:2},{value:"Static Semantics",id:"static-semantics-2",level:4},{value:"Dynamic Semantics",id:"dynamic-semantics-1",level:4},{value:"Bounded (Run-Time) Errors",id:"bounded-run-time-errors",level:4},{value:"Implementation Requirements",id:"implementation-requirements-1",level:4},{value:"Documentation Requirements",id:"documentation-requirements",level:4},{value:"Implementation Advice",id:"implementation-advice",level:4},{value:"Examples",id:"examples",level:4},{value:"Incompatibilities With Ada 95",id:"incompatibilities-with-ada-95",level:4},{value:"Wording Changes from Ada 95",id:"wording-changes-from-ada-95-1",level:4},{value:"Wording Changes from Ada 2005",id:"wording-changes-from-ada-2005",level:4},{value:"Extensions to Ada 2012",id:"extensions-to-ada-2012",level:4},{value:"A.5.3 Attributes of Floating Point Types",id:"a53--attributes-of-floating-point-types",level:2},{value:"Static Semantics",id:"static-semantics-3",level:4},{value:"Incompatibilities With Ada 83",id:"incompatibilities-with-ada-83",level:4},{value:"Extensions to Ada 83",id:"extensions-to-ada-83-1",level:4},{value:"Extensions to Ada 95",id:"extensions-to-ada-95-1",level:4},{value:"A.5.4 Attributes of Fixed Point Types",id:"a54--attributes-of-fixed-point-types",level:2},{value:"Static Semantics",id:"static-semantics-4",level:4},{value:"Incompatibilities With Ada 83",id:"incompatibilities-with-ada-83-1",level:4},{value:"Extensions to Ada 83",id:"extensions-to-ada-83-2",level:4}
1,{value:"A.5.5 Big Numbers",id:"a55--big-numbers",level:2},{value:"Static Semantics",id:"static-semantics-5",level:4},{value:"Extensions to Ada 2012",id:"extensions-to-ada-2012-1",level:4},{value:"A.5.6 Big Integers",id:"a56--big-integers",level:2},{value:"Static Semantics",id:"static-semantics-6",level:4},{value:"Dynamic Semantics",id:"dynamic-semantics-2",level:4},{value:"Implementation Requirements",id:"implementation-requirements-2",level:4},{value:"Extensions to Ada 2012",id:"extensions-to-ada-2012-2",level:4},{value:"A.5.7 Big Reals",id:"a57--big-reals",level:2},{value:"Static Semantics",id:"static-semantics-7",level:4},{value:"Dynamic Semantics",id:"dynamic-semantics-3",level:4},{value:"Implementation Requirements",id:"implementation-requirements-3",level:4},{value:"Extensions to Ada 2012",id:"extensions-to-ada-2012-3",level:4}];function m(e){let n={a:"a",admonition:"admonition",h1:"h1",h2:"h2",h4:"h4",header:"header",p:"p",...(0,t.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"a5-the-numerics-packages",children:"A.5. The Numerics Packages"})}),"\n",(0,r.jsx)(n.admonition,{type:"danger",children:(0,r.jsxs)(n.p,{children:["This Reference Manual output has not been verified,\nand may contain omissions or errors.\nReport any problems on the ",(0,r.jsx)(n.a,{href:"https://github.com/ada-lang-io/ada-lang-io/issues/20",children:"tracking issue"})]})}),"\n","\n",(0,r.jsx)(d.A,{children:"1"}),"\n",(0,r.jsxs)("p",{children:["The library package Numerics is the parent of several child units that provide facilities for mathematical computation. One child, the generic package Generic","_","Elementary","_","Functions, is defined in ",(0,r.jsx)("a",{href:"/docs/arm/AA-A/AA-A.5#Subclause_A.5.1",children:"A.5.1"}),", together with nongeneric equivalents; two others, the package Float","_","Random and the generic package Discrete","_","Random, are defined in ",(0,r.jsx)("a",{href:"/docs/arm/AA-A/AA-A.5#Subclause_A.5.2",children:"A.5.2"}),". Additional (optional) children are defined in ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/",children:"Annex G"}),", \u201C",(0,r.jsx)("a",{href:"/docs/arm/AA-G/",children:"Numerics"}),"\u201D. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(n.h4,{id:"static-semantics",children:"Static Semantics"}),"\n",(0,r.jsx)(d.A,{children:"2/1"}),"\n",(0,r.jsxs)("p",{children:[(0,r.jsx)("i",{children:"This paragraph was deleted."}),(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"3/5"}),"\n",(0,r.jsx)(h.A,{items:["AI95-00388-01","AI12-0414-1"]}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["package Ada.Numerics","\n"," with Pure is","\n"," Argument","_","Error : exception;","\n"," Pi : constant :=","\n"," 3.14159","_","26535","_","89793","_","23846","_","26433","_","83279","_","50288","_","41971","_","69399","_","37511;","\n"," \u03C0 : constant := Pi;","\n"," e : constant :=","\n"," 2.71828","_","18284","_","59045","_","23536","_","02874","_","71352","_","66249","_","77572","_","47093","_","69996;","\n","end Ada.Numerics;","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"4"}),"\n",(0,r.jsxs)("p",{children:["The Argument","_","Error exception is raised by a subprogram in a child unit of Numerics to signal that one or more of the actual subprogram parameters are outside the domain of the corresponding mathematical function.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(n.h4,{id:"implementation-permissions",children:"Implementation Permissions"}),"\n",(0,r.jsx)(d.A,{children:"5"}),"\n",(0,r.jsxs)("p",{children:["The implementation may specify the values of Pi and e to a larger number of significant digits. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"5.a"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"reason",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"51 digits seem more than adequate for all present computers; converted to binary, the values given above are accurate to more than 160 bits. Nevertheless, the permission allows implementations to accommodate unforeseen hardware advances. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"extensions-to-ada-83",children:"Extensions to Ada 83"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"5.b"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["Numerics and its children were not predefined in Ada 83. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"extensions-to-ada-95",children:"Extensions to Ada 95"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"5.c/2"}),(0,r.jsx)(h.A,{items:["AI95-00388-01"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The alternative declaration of \u03C0 is new. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)("a",{id:"Subclause_A.5.1"}),"\n",(0,r.jsx)(n.h2,{id:"a51--elementary-functions",children:"A.5.1 Elementary Functions"}),"\n",(0,r.jsx)(d.A,{children:"1_A.5.1"}),"\n",(0,r.jsxs)("p",{children:["Implementation-defined approximations to the mathematical functions known as the \u201Celementary functions\u201D are provided by the subprograms in Numerics.Generic","_","Elementary","_","Functions. Nongeneric equivalents of this generic package for each of the predefined floating point types are also provided as children of Numerics. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"1.a_A.5.1"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-defined",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The accuracy actually achieved by the elementary functions.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(n.h4,{id:"static-semantics-1",children:"Static Semantics"}),"\n",(0,r.jsx)(d.A,{children:"2_A.5.1"}),"\n",(0,r.jsxs)("p",{children:["The generic library package Numerics.Generic","_","Elementary","_","Functions has the following declaration: ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"3/5_A.5.1"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0241-1"]}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["generic","\n"," type Float","_","Type is digits ","<",">",";","\n","\n","package Ada.Numerics.Generic","_","Elementary","_","Functions","\n"," with Pure, Nonblocking is","\n","\n",(0,r.jsx)(d.A,{children:"4_A.5.1"}),"\nfunction Sqrt (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Log (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Log (X, Base : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Exp (X : Float","_","Type'Base) return Float","_","Type'Base;","\n",' function "',"*","*",'" (Left, Right : Float',"_","Type'Base) return Float","_","Type'Base;","\n","\n",(0,r.jsx)(d.A,{children:"5_A.5.1"}),"\nfunction Sin (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Sin (X, Cycle : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Cos (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Cos (X, Cycle : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Tan (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Tan (X, Cycle : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Cot (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Cot (X, Cycle : Float","_","Type'Base) return Float","_","Type'Base;","\n","\n",(0,r.jsx)(d.A,{children:"6_A.5.1"}),"\nfunction Arcsin (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Arcsin (X, Cycle : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Arccos (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Arccos (X, Cycle : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Arctan (Y : Float","_","Type'Base;","\n"," X : Float","_","Type'Base := 1.0)","\n"," return Float","_","Type'Base;","\n"," function Arctan (Y : Float","_","Type'Base;","\n"," X : Float","_","Type'Base := 1.0;","\n"," Cycle : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Arccot (X : Float","_","Type'Base;","\n"," Y : Float","_","Type'Base := 1.0)","\n"," return Float","_","Type'Base;","\n"," function Arccot (X : Float","_","Type'Base;","\n"," Y : Float","_","Type'Base := 1.0;","\n"," Cycle : Float","_","Type'Base) return Float","_","Type'Base;","\n","\n",(0,r.jsx)(d.A,{children:"7_A.5.1"}),"\nfunction Sinh (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Cosh (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Tanh (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Coth (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Arcsinh (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Arccosh (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Arctanh (X : Float","_","Type'Base) return Float","_","Type'Base;","\n"," function Arccoth (X : Float","_","Type'Base) return Float","_","Type'Base;","\n","\n",(0,r.jsx)(d.A,{children:"8_A.5.1"}),"\nend Ada.Numerics.Generic","_","Elementary","_","Functions;","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"9/1_A.5.1"}),"\n",(0,r.jsx)(h.A,{items:["AI95-00126-01"]}),"\n",(0,r.jsxs)("p",{children:["{",(0,r.jsx)("i",{children:"8652/0020"}),"}"," The library package Numerics.Elementary","_","Functions is declared pure and defines the same subprograms as Numerics.Generic","_","Elementary","_","Functions, except that the predefined type Float is systematically substituted for Float","_","Type'Base throughout. Nongeneric equivalents of Numerics.Generic","_","Elementary","_","Functions for each of the other predefined floating point types are defined similarly, with the names Numerics.Short","_","Elementary","_","Functions, Numerics.Long","_","Elementary","_","Functions, etc. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"9.a_A.5.1"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"reason",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The nongeneric equivalents are provided to allow the programmer to construct simple mathematical applications without being required to understand and use generics. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"10_A.5.1"}),"\n",(0,r.jsxs)("p",{children:["The functions have their usual mathematical meanings. When the Base parameter is specified, the Log function computes the logarithm to the given base;
1 otherwise, it computes the natural logarithm. When the Cycle parameter is specified, the parameter X of the forward trigonometric functions (Sin, Cos, Tan, and Cot) and the results of the inverse trigonometric functions (Arcsin, Arccos, Arctan, and Arccot) are measured in units such that a full cycle of revolution has the given value; otherwise, they are measured in radians.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"11_A.5.1"}),"\n",(0,r.jsxs)("p",{children:["The computed results of the mathematically multivalued functions are rendered single-valued by the following conventions, which are meant to imply the principal branch: ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"12_A.5.1"}),"\n",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["The results of the Sqrt and Arccosh functions and that of the exponentiation operator are nonnegative.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"13_A.5.1"}),(0,r.jsxs)("li",{children:["The result of the Arcsin function is in the quadrant containing the point (1.0, ",(0,r.jsx)("i",{children:"x"}),"), where ",(0,r.jsx)("i",{children:"x"})," is the value of the parameter X. This quadrant is I or IV; thus, the range of the Arcsin function is approximately \u2013\u03C0/2.0 to \u03C0/2.0 (\u2013Cycle/4.0 to Cycle/4.0, if the parameter Cycle is specified).",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"14_A.5.1"}),(0,r.jsxs)("li",{children:["The result of the Arccos function is in the quadrant containing the point (",(0,r.jsx)("i",{children:"x"}),", 1.0), where ",(0,r.jsx)("i",{children:"x"})," is the value of the parameter X. This quadrant is I or II; thus, the Arccos function ranges from 0.0 to approximately \u03C0 (Cycle/2.0, if the parameter Cycle is specified).",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"15_A.5.1"}),(0,r.jsxs)("li",{children:["The results of the Arctan and Arccot functions are in the quadrant containing the point (",(0,r.jsx)("i",{children:"x"}),", ",(0,r.jsx)("i",{children:"y"}),"), where ",(0,r.jsx)("i",{children:"x"})," and ",(0,r.jsx)("i",{children:"y"})," are the values of the parameters X and Y, respectively. This may be any quadrant (I through IV) when the parameter X (resp., Y) of Arctan (resp., Arccot) is specified, but it is restricted to quadrants I and IV (resp., I and II) when that parameter is omitted. Thus, the range when that parameter is specified is approximately \u2013\u03C0 to \u03C0 (\u2013Cycle/2.0 to Cycle/2.0, if the parameter Cycle is specified); when omitted, the range of Arctan (resp., Arccot) is that of Arcsin (resp., Arccos), as given above. When the point (",(0,r.jsx)("i",{children:"x"}),", ",(0,r.jsx)("i",{children:"y"}),") lies on the negative x-axis, the result approximates ",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"16_A.5.1"}),(0,r.jsxs)("li",{children:["\u03C0 (resp., \u2013\u03C0) when the sign of the parameter Y is positive (resp., negative), if Float","_","Type'Signed","_","Zeros is True;",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"17_A.5.1"}),(0,r.jsxs)("li",{children:["\u03C0, if Float","_","Type'Signed","_","Zeros is False. ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(d.A,{children:"18_A.5.1"}),"\n",(0,r.jsxs)("p",{children:["(In the case of the inverse trigonometric functions, in which a result lying on or near one of the axes may not be exactly representable, the approximation inherent in computing the result may place it in an adjacent quadrant, close to but on the wrong side of the axis.) ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(n.h4,{id:"dynamic-semantics",children:"Dynamic Semantics"}),"\n",(0,r.jsx)(d.A,{children:"19_A.5.1"}),"\n",(0,r.jsxs)("p",{children:["The exception Numerics.Argument","_","Error is raised, signaling a parameter value outside the domain of the corresponding mathematical function, in the following cases: ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"20_A.5.1"}),"\n",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["by any forward or inverse trigonometric function with specified cycle, when the value of the parameter Cycle is zero or negative;",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"21_A.5.1"}),(0,r.jsxs)("li",{children:["by the Log function with specified base, when the value of the parameter Base is zero, one, or negative;",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"22_A.5.1"}),(0,r.jsxs)("li",{children:["by the Sqrt and Log functions, when the value of the parameter X is negative;",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"23_A.5.1"}),(0,r.jsxs)("li",{children:["by the exponentiation operator, when the value of the left operand is negative or when both operands have the value zero;",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"24_A.5.1"}),(0,r.jsxs)("li",{children:["by the Arcsin, Arccos, and Arctanh functions, when the absolute value of the parameter X exceeds one;",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"25_A.5.1"}),(0,r.jsxs)("li",{children:["by the Arctan and Arccot functions, when the parameters X and Y both have the value zero;",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"26_A.5.1"}),(0,r.jsxs)("li",{children:["by the Arccosh function, when the value of the parameter X is less than one; and",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"27_A.5.1"}),(0,r.jsxs)("li",{children:["by the Arccoth function, when the absolute value of the parameter X is less than one. ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(d.A,{children:"28_A.5.1"}),"\n",(0,r.jsxs)("p",{children:["The exception Constraint","_","Error is raised, signaling a pole of the mathematical function (analogous to dividing by zero), in the following cases, provided that Float","_","Type'Machine","_","Overflows is True: ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"29_A.5.1"}),"\n",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["by the Log, Cot, and Coth functions, when the value of the parameter X is zero;",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"30_A.5.1"}),(0,r.jsxs)("li",{children:["by the exponentiation operator, when the value of the left operand is zero and the value of the exponent is negative;",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"31_A.5.1"}),(0,r.jsxs)("li",{children:["by the Tan function with specified cycle, when the value of the parameter X is an odd multiple of the quarter cycle;",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"32_A.5.1"}
1),(0,r.jsxs)("li",{children:["by the Cot function with specified cycle, when the value of the parameter X is zero or a multiple of the half cycle; and",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"33_A.5.1"}),(0,r.jsxs)("li",{children:["by the Arctanh and Arccoth functions, when the absolute value of the parameter X is one. ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(d.A,{children:"34_A.5.1"}),"\n",(0,r.jsxs)("p",{children:["[Constraint","_","Error can also be raised when a finite result overflows (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.2#Subclause_G.2.4",children:"G.2.4"}),"); this may occur for parameter values sufficiently ",(0,r.jsx)("i",{children:"near"})," poles, and, in the case of some of the functions, for parameter values with sufficiently large magnitudes.] When Float","_","Type'Machine","_","Overflows is False, the result at poles is unspecified. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"34.a_A.5.1"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"reason",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The purpose of raising Constraint","_","Error (rather than Numerics.Argument","_","Error) at the poles of a function, when Float","_","Type'Machine","_","Overflows is True, is to provide continuous behavior as the actual parameters of the function approach the pole and finally reach it. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"34.b_A.5.1"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"It is anticipated that an Ada binding to IEC 559:1989 will be developed in the future. As part of such a binding, the Machine","_","Overflows attribute of a conformant floating point type will be specified to yield False, which will permit both the predefined arithmetic operations and implementations of the elementary functions to deliver signed infinities (and set the overflow flag defined by the binding) instead of raising Constraint","_","Error in overflow situations, when traps are disabled. Similarly, it is appropriate for the elementary functions to deliver signed infinities (and set the zero-divide flag defined by the binding) instead of raising Constraint","_","Error at poles, when traps are disabled. Finally, such a binding should also specify the behavior of the elementary functions, when sensible, given parameters with infinite values. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"35/5_A.5.1"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0453-1"]}),"\n",(0,r.jsxs)("p",{children:["When one parameter of a function with multiple parameters represents a pole and another is outside the function's domain, the latter takes precedence and Numerics.Argument","_","Error is raised. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(n.h4,{id:"implementation-requirements",children:"Implementation Requirements"}),"\n",(0,r.jsx)(d.A,{children:"36_A.5.1"}),"\n",(0,r.jsxs)("p",{children:["In the implementation of Numerics.Generic","_","Elementary","_","Functions, the range of intermediate values allowed during the calculation of a final result shall not be affected by any range constraint of the subtype Float","_","Type. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"36.a_A.5.1"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-note",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"Implementations of Numerics.Generic","_","Elementary","_","Functions written in Ada should therefore avoid declaring local variables of subtype Float","_","Type; the subtype Float","_","Type'Base should be used instead. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"37_A.5.1"}),"\n",(0,r.jsxs)("p",{children:["In the following cases, evaluation of an elementary function shall yield the ",(0,r.jsx)("i",{children:"prescribed result"}),", provided that the preceding rules do not call for an exception to be raised: ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"38_A.5.1"}),"\n",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["When the parameter X has the value zero, the Sqrt, Sin, Arcsin, Tan, Sinh, Arcsinh, Tanh, and Arctanh functions yield a result of zero, and the Exp, Cos, and Cosh functions yield a result of one.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"39_A.5.1"}),(0,r.jsxs)("li",{children:["When the parameter X has the value one, the Sqrt function yields a result of one, and the Log, Arccos, and Arccosh functions yield a result of zero.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"40_A.5.1"}),(0,r.jsxs)("li",{children:["When the parameter Y has the value zero and the parameter X has a positive value, the Arctan and Arccot functions yield a result of zero.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"41_A.5.1"}),(0,r.jsxs)("li",{children:["The results of the Sin, Cos, Tan, and Cot functions with specified cycle are exact when the mathematical result is zero; those of the first two are also exact when the mathematical result is \xb1 1.0.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"42_A.5.1"}),(0,r.jsxs)("li",{children:["Exponentiation by a zero exponent yields the value one. Exponentiation by a unit exponent yields the value of the left operand. Exponentiation of the value one yields the value one. Exponentiation of the value zero yields the value zero. ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(d.A,{children:"43_A.5.1"}),"\n",(0,r.jsxs)("p",{children:["Other accuracy requirements for the elementary functions, which apply only in implementations conforming to the Numerics Annex, and then only in the \u201Cstrict\u201D mode defined there (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.2",children:"G.2"}),"), are given in ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.2#Subclause_G.2.4",children:"G.2.4"}),".",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"44_A.5.1"}),"\n",(0,r.jsxs)("p",{children:["When Float","_","Type'Signed","_","Zeros is True, the sign of a zero result shall be as follows: ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"45_A.5.1"}),"\n",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["A prescribed zero result delivered ",(0,r.jsx)("i",{children:"at the origin"})," by one of the odd functions (Sin, Arcsin, Sinh, Arcsinh, Tan, Arctan or Arccot as a function of Y when X is fixed and positive, Tanh, and Arctanh) has the sign of the parameter X (Y, in the case of Arctan or Arccot).",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"46_A.5.1"}),(0,r.jsxs)("li",{children:["A prescribed zero result delivered by one of the odd functions ",(0,r.jsx)("i",{children:"away from the origin"}),", or by some other elementary function, has an implementation-defined sign. ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"46.a_A.5.1"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-defined",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The sign of a zero result from some of the operators or functions in Numerics.Generic","_","Elementary","_","Functions, when Float","_","Type'Signed","_","Zeros is True.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"47/5_A.5.1"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0453-1"]}),"\n",(0,r.jsx)("ul",{children:(0,r.jsxs)("li",{children:["[A zero result that is not a prescribed result (that is, one that results from rounding or underflow) has the correct mathematical sign.] ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"47.a_A.5.1"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"reason",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"This is a consequence of the rules specified in IEC 559:1989 as they apply to underflow situations with traps disabled. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(n.h4,{id:"implementation-permissions-1",children:"Implementation Permissions"}),"\n",(0,r.jsx)(d.A,{children:"48/5_A.5.1"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0444-1"]}),"\n",(0,r.jsxs)("p",{children:["The nongeneric equivalent packages can be actual instantiations of the generic package for the appropriate predefined type, though that is not required. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"wording-changes-from-ada-83",children:"Wording Changes from Ada 83"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"48.a_A.5.1"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The semantics of Numerics.Generic","_","Elementary","_","Functions differs from Generic","_","Elementary","_","Functions as defined in ISO/IEC DIS 11430 (for Ada 83) in the following ways: ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"48.b_A.5.1"}),(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["The generic package is a child unit of the package defining the Argument","_","Error exception.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"48.c_A.5.1"}),(0,r.jsxs)("li",{children:["DIS 11430 specified names for the nongeneric equivalents, if provided. Here, those nongeneric equivalents are required.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"48.d_A.5.1"}),(0,r.jsxs)("li",{children:["Implementations are not allowed to impose an optional restriction that the generic actual parameter associated with Float","_","Type be unconstrained. (In view of the ability to declare variables of subtype Float","_","Type'Base in implementations of Numerics.Generic","_","Elementary","_","Functions, this flexibility is no longer needed.)",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"48.e_A.5.1"}),(0,r.jsxs)("li",{children:["The sign of a prescribed zero result at the origin of the odd functions is specified, when Float","_","Type'Signed","_","Zeros is True. This conforms with recommendations of Kahan and other numerical analysts.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"48.f_A.5.1"}),(0,r.jsxs)("li",{children:["The dependence of Arctan and Arccot on the sign of a parameter value of zero is tied to the value of Float","_","Type'Signed","_","Zeros.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"48.g_A.5.1"}),(0,r.jsxs)("li",{children:["Sqrt is prescribed to yield a result of one when its parameter has the value one. This guarantee makes it easier to achieve certain prescribed results of the complex elementary functions (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.1#Subclause_G.1.2",children:"G.1.2"}),", \u201C",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.1#Subclause_G.1.2",children:"Complex Elementary Functions"}),"\u201D).",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"48.h_A.5.1"}),(0,r.jsxs)("li",{children:["Conformance to accuracy requirements is conditional. ",(0,r.jsx)("br",{})]})]})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"wording-changes-from-ada-95",children:"Wording Changes from Ada 95"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"48.i/2_A.5.1"}),(0,r.jsx)(h.A,{items:["AI95-00126-01"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["{",(0,r.jsx)("i",{children:"8652/0020"}),"}"," ",(0,r.jsx)("b",{children:"Corrigendum:"})," Explicitly stated that the nongeneric equivalents of Generic","_","Elementary","_","Functions are pure. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)("a",{id:"Subclause_A.5.2"}),"\n",(0,r.jsx)(n.h2,{id:"a52--random-number-generation",children:"A.5.2 Random Number Generation"}),"\n",(0,r.jsx)(d.A,{children:"1_A.5.2"}),"\n",(0,r.jsxs)("p",{children:["[Facilities for the generation of pseudo-random floating point numbers are provided in the package Numerics.Float","_","Random; the generic package Numerics.Discrete","_","Random provides similar facilities for the generation of pseudo-random integers and pseudo-random values of enumeration types. For brevity, pseudo-random values of any of these types are called ",(0,r.jsx)("i",{children:"random numbers"}),".",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"2_A.5.2"}),"\n",(0,r.jsxs)("p",{children:["Some of the facilities provided are basic to all applications of random numbers. These include a limited private type each of whose objects serves as the generator of a (possibly distinct) sequence of random numbers; a function to obtain the \u201Cnext\u201D random number from a given sequence of random numbers (that is, from its generator); and subprograms to initialize or reinitialize a given generator to a time-dependent state or a state denoted by a single integer.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"3_A.5.2"}),"\n",(0,r.jsxs)("p",{children:["Other facilities are provided specifically for advanced applications. These include subprograms to
1save and restore the state of a given generator; a private type whose objects can be used to hold the saved state of a generator; and subprograms to obtain a string representation of a given generator state, or, given such a string representation, the corresponding state.] ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"3.a_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"These facilities support a variety of requirements ranging from repeatable sequences (for debugging) to unique sequences in each execution of a program. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(n.h4,{id:"static-semantics-2",children:"Static Semantics"}),"\n",(0,r.jsx)(d.A,{children:"4_A.5.2"}),"\n",(0,r.jsxs)("p",{children:["The library package Numerics.Float","_","Random has the following declaration: ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"5/5_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0302-1"]}),"\n",(0,r.jsxs)(l.A,{language:"ada",children:[(0,r.jsxs)(n.p,{children:["package Ada.Numerics.Float","_","Random","\n"," with Global =",">"," in out synchronized is","\n","\n",(0,r.jsx)(d.A,{children:"6_A.5.2"}),"\n-- Basic facilities","\n","\n",(0,r.jsx)(d.A,{children:"7_A.5.2"}),"\ntype Generator is limited private;","\n","\n",(0,r.jsx)(d.A,{children:"8/5_A.5.2"})]}),(0,r.jsx)(h.A,{items:["AI12-0302-1"]}),(0,r.jsxs)(n.p,{children:["subtype Uniformly","_","Distributed is Float range 0.0 .. 1.0;","\n"," function Random (Gen : Generator) return Uniformly","_","Distributed","\n"," with Global =",">"," overriding in out Gen;","\n","\n",(0,r.jsx)(d.A,{children:"9/5_A.5.2"})]}),(0,r.jsx)(h.A,{items:["AI12-0302-1"]}),(0,r.jsxs)(n.p,{children:["procedure Reset (Gen : in Generator;","\n"," Initiator : in Integer)","\n"," with Global =",">"," overriding in out Gen;","\n"," procedure Reset (Gen : in Generator)","\n"," with Global =",">"," overriding in out Gen;","\n","\n",(0,r.jsx)(d.A,{children:"10_A.5.2"}),"\n-- Advanced facilities","\n","\n",(0,r.jsx)(d.A,{children:"11_A.5.2"}),"\ntype State is private;","\n","\n",(0,r.jsx)(d.A,{children:"12/5_A.5.2"})]}),(0,r.jsx)(h.A,{items:["AI12-0302-1"]}),(0,r.jsxs)(n.p,{children:["procedure Save (Gen : in Generator;","\n"," To","_","State : out State);","\n"," procedure Reset (Gen : in Generator;","\n"," From","_","State : in State)","\n"," with Global =",">"," overriding in out Gen;","\n","\n",(0,r.jsx)(d.A,{children:"13_A.5.2"}),"\nMax","_","Image","_","Width : constant := implementation-defined integer value;","\n","\n",(0,r.jsx)(d.A,{children:"14_A.5.2"}),"\nfunction Image (Of","_","State : State) return String;","\n"," function Value (Coded","_","State : String) return State;","\n","\n",(0,r.jsx)(d.A,{children:"15_A.5.2"}),"\nprivate","\n"," ... -- not specified by the language","\n","end Ada.Numerics.Float","_","Random;","\n"]})]}),"\n",(0,r.jsx)(d.A,{children:"15.1/2_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI95-00360-01"]}),"\n",(0,r.jsxs)("p",{children:["The type Generator needs finalization (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-7/AA-7.6",children:"7.6"}),").",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"16_A.5.2"}),"\n",(0,r.jsxs)("p",{children:["The generic library package Numerics.Discrete","_","Random has the following declaration: ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"17/5_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0302-1"]}),"\n",(0,r.jsxs)(l.A,{language:"ada",children:[(0,r.jsxs)(n.p,{children:["generic","\n"," type Result","_","Subtype is (","<",">",");","\n","package Ada.Numerics.Discrete","_","Random","\n"," with Global =",">"," in out synchronized is","\n","\n",(0,r.jsx)(d.A,{children:"18_A.5.2"}),"\n-- Basic facilities","\n","\n",(0,r.jsx)(d.A,{children:"19_A.5.2"}),"\ntype Generator is limited private;","\n","\n",(0,r.jsx)(d.A,{children:"20/5_A.5.2"})]}),(0,r.jsx)(h.A,{items:["AI12-0302-1"]}),(0,r.jsxs)(n.p,{children:["function Random (Gen : Generator) return Result","_","Subtype","\n"," with Global =",">"," overriding in out Gen;","\n","\n",(0,r.jsx)(d.A,{children:"20.1/5_A.5.2"})]}),(0,r.jsx)(h.A,{items:["AI12-0144-1","AI12-0302-1"]}),(0,r.jsxs)(n.p,{children:["function Random (Gen : Generator;","\n"," First : Result","_","Subtype;","\n"," Last : Result","_","Subtype) return Result","_","Subtype","\n"," with Post =",">"," Random'Result in First .. Last,","\n"," Global =",">"," overriding in out Gen;","\n","\n",(0,r.jsx)(d.A,{children:"21/5_A.5.2"})]}),(0,r.jsx)(h.A,{items:["AI12-0302-1"]}),(0,r.jsxs)(n.p,{children:["procedure Reset (Gen : in Generator;","\n"," Initiator : in Integer)","\n"," with Global =",">"," overriding in out Gen;","\n"," procedure Reset (Gen : in Generator)","\n"," with Global =",">"," overriding in out Gen;","\n","\n",(0,r.jsx)(d.A,{children:"22_A.5.2"}),"\n-- Advanced facilities","\n","\n",(0,r.jsx)(d.A,{children:"23_A.5.2"}),"\ntype State is private;","\n","\n",(0,r.jsx)(d.A,{children:"24/5_A.5.2"})]}),(0,r.jsx)(h.A,{items:["AI12-0302-1"]}),(0,r.jsxs)(n.p,{children:["procedure Save (Gen : in Generator;","\n"," To","_","State : out State);","\n"," procedure Reset (Gen : in Generator;","\n"," From","_","State : in State)","\n"," with Global =",">"," overriding in out Gen;","\n","\n",(0,r.jsx)(d.A,{children:"25_A.5.2"}),"\nMax","_","Image","_","Width : constant := implementation-defined integer value;","\n","\n",(0,r.jsx)(d.A,{children:"26_A.5.2"}),"\nfunction Image (Of","_","State : State) return String;","\n"," function Value (Coded","_","State : String) return State;","\n","\n",(0,r.jsx)(d.A,{children:"27_A.5.2"}),"\nprivate","\n"," ... -- not specified by the language","\n","end Ada.Numerics.Discrete","_","Random;","\n"]})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"27.a_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-defined",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The value of Numerics.Float","_","Random.Max","_","Image","_","Width.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"27.b_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-defined",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The value of Numerics.Discrete","_","Random.Max","_","Image","_","Width.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"27.c/1_A.5.2"}),(0,r.jsx)(h.A,{items:["AI95-00115-01"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-note",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"{",(0,r.jsx)("i",{children:"8652/0097"}),"}"," The following is a possible implementation of the private part of Numerics.Float","_","Random (assuming the presence of \u201C",(0,r.jsx)("b",{children:"with"})," Ada.Finalization;\u201D as a context clause): ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"27.d_A.5.2"}),(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["type State is ...;","\n","type Access","_","State is access State;","\n","type Generator is new Finalization.Limited","_","Controlled with","\n"," record","\n"," S : Access","_","State := new State'(...);","\n"," end record;","\n","procedure Finalize (G : in out Generator);","\n"]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"27.d.1/2_A.5.2"}),(0,r.jsx)(h.A,{items:["AI95-00115-01","AI95-00344-01"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["{",(0,r.jsx)("i",{children:"8652/0097"}),"}"," Numerics.Discrete","_","Random.Generator also can be implemented this way.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"27.e_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["Clearly some level of indirection is required in the implementation of a Generator, since the parameter mode is ",(0,r.jsx)("b",{children:"in"})," for all operations on a Generator. For this reason, Numerics.Float","_","Random and Numerics.Discrete","_","Random cannot be declared pure. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"27.1/2_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI95-00360-01"]}),"\n",(0,r.jsxs)("p",{children:["The type Generator needs finalization (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-7/AA-7.6",children:"7.6"}),") in every instantiation of Numerics.Discrete","_","Random.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"28_A.5.2"}),"\n",(0,r.jsxs)("p",{children:["An object of the limited private type Generator is associated with a sequence of random numbers. Each generator has a hidden (internal) state, which the operations on generators use to determine the position in the associated sequence. All generators are implicitly initialized to an unspecified state that does not vary from one program execution to another; they may also be explicitly initialized, or reinitialized, to a time-dependent state, to a previously saved state, or to a state uniquely denoted by an integer value. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"28.a_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The repeatability provided by the implicit initialization may be exploited for testing or debugging purposes. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"29/5_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI05-0280-1","AI12-0445-1"]}),"\n",(0,r.jsxs)("p",{children:["An object of the private type State can be used to hold the internal state of a generator. Such objects are only necessary if the application is designed to save and restore generator states or to examine or manufacture them. The implicit initial value of type State corresponds to the implicit initial value of all generators.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"29.a/3_A.5.2"}),(0,r.jsx)(h.A,{items:["AI05-0280-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"All generators are implicitly initialized to the same unchanging value, and using Reset on a default initialized object of type State will produce a generator with that same value. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"30_A.5.2"}),"\n",(0,r.jsxs)("p",{children:["The operations on generators affect the state and therefore the future values of the associated sequence. The semantics of the operations on generators and states are defined below. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"31_A.5.2"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function Random (Gen : Generator) return Uniformly","_","Distributed;","\n","function Random (Gen : Generator) return Result","_","Subtype;","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"32/5_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0144-1"]}),"\n",(0,r.jsxs)("p",{class:"Indented4",children:["Obtains the \u201Cnext\u201D random number from the given generator, relative to its current state, according to an implementation-defined algorithm. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"32.a/2_A.5.2"}),(0,r.jsxs)(a.A,{type:"aarm",aarm:"note",children:[(0,r.jsx)("i",{children:"This paragraph was deleted."}),(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"32.a.1/2_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The algorithm is the subject of a Documentation Requirement, so we don't separately summarize this implementation-defined item. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"32.b_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"reason",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The requirement for a level of indirection in accessing the internal state of a generator arises from the desire to make Random a function, rather than a procedure. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"32.1/5_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0144-1"]}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function Random (Gen : Generator;","\n"," First : Result","_","Subtype;","\n"," Last : Result","_","Subtype) return Result","_","Subtype","\n"," with Post =",">"," Random'Result in First .. Last;","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"32.2/5_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0144-1"]}),"\n",(0,r.jsxs)("p",{class:"Indented4",children:["Obtains the \u201Cnext\u201D random number from the given generator, relative to its current state, according to an implementation-defined algorithm. If the range First .. Last is a null range, Constraint","_","Error is raised.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"33_A.5.2"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["procedure Reset (Gen : in Generator;","\n"," Initiator : in Integer);","\n","procedure Reset (Gen : in Generator);","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"34_A.5.2"}),"\n",(0,r.jsxs)("p",{class:"Indented4",children:["Sets the state of the specified generator to one that is an unspecified function of the value of the parameter Initiator (or to a time-dependent state, if only a generator parameter is specified). The latter form of the procedure is known as the ",(0,r.jsx)("i",{children:"time-dependent Reset procedure"}),". ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"34.a_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-note",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The time-dependent Reset procedure can be implemented by mapping the current time and date as determined by the system clock into a state, but other implementations are possible. For example, a white-noise generator or a radioactive source can be used to generate time-dependent states. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"35_A.5.2"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["procedure Save (Gen : in Generator;","\n"," To","_","State : out State);","\n","procedure Reset (Gen : in Generator;","\n"," From","_","State : in State);","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"36_A.5.2"}),"\n",(0,r.jsxs)("p",{class:"Indented4",children:["Save obtains the current state of a generator. Reset gives a generator the specified state. A generator that is reset to a state previously obtained by invoking Save is restored to the state it had when Save was invoked.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"37_A.5.2"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function Image (Of","_","State : State) return String;","\n","function Value (Coded","_","State : String) return State;","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"38_A.5.2"}),"\n",(0,r.jsxs)("p",{class:"Indented4",children:["Image provides a representation of a state coded (in an implementation-defined way) as a string whose length is bounded by the value of Max","_","Image","_","Width. Value is the inverse of Image: Value(Image(S)) = S for each state S that can be obtained from a generator by invoking Save. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"38.a_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-defined",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The string representation of a random number generator's state.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(n.h4,{id:"dynamic-semantics-1",children:"Dynamic Semantics"}),"\n",(0,r.jsx)(d.A,{children:"39_A.5.2"}),"\n",(0,r.jsxs)("p",{children:["Instantiation of Numerics.Discrete","_","Random with a subtype having a null range raises Constraint","_","Error.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"40/1_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI95-00089"]}),"\n",(0,r.jsxs)("p",{children:[(0,r.jsx)("i",{children:"This paragraph was deleted."}),"{",(0,r.jsx)("i",{children:"8652/0050"}),"}"," ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(n.h4,{id:"bounded-run-time-errors
1",children:"Bounded (Run-Time) Errors"}),"\n",(0,r.jsx)(d.A,{children:"40.1/5_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI95-00089","AI12-0445-1"]}),"\n",(0,r.jsxs)("p",{children:["{",(0,r.jsx)("i",{children:"8652/0050"}),"}"," It is a bounded error to invoke Value with a string that is not the image of any generator state. If the error is detected, Constraint","_","Error or Program","_","Error is raised. Otherwise, a call to Reset with the resulting state will produce a generator such that calls to Random with this generator will produce a sequence of values of the appropriate subtype, but which are not necessarily random in character. That is, the sequence of values do not necessarily fulfill the implementation requirements of this subclause. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(n.h4,{id:"implementation-requirements-1",children:"Implementation Requirements"}),"\n",(0,r.jsx)(d.A,{children:"40.2/5_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0144-1"]}),"\n",(0,r.jsxs)("p",{children:["Each call of a Random function has a ",(0,r.jsx)("i",{children:"result range"}),"; this is the range First .. Last for the version of Random with First and Last parameters and the range of the result subtype of the function otherwise.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"41/5_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0144-1"]}),"\n",(0,r.jsxs)("p",{children:["A sufficiently long sequence of random numbers obtained by consecutive calls to Random that have the same generator and result range is approximately uniformly distributed over the result range.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"41.a/5_A.5.2"}),(0,r.jsx)(h.A,{items:["AI12-0005-1","AI12-0144-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"In this rule, \u201Cconsecutive\u201D means at least that there are no intervening explicit calls involving the same generator. This restricts the rule to only applying to cases where just the Random function changes the generator. We don't mean to impose a requirement if there are intervening calls to Reset, to Random with the same generator but a different result range, or any other case that would affect the sequence of values returned. Operations that use the resulting random values (for instance, to store them somewhere) are not considered in determining if calls are consecutive. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"42/5_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0144-1"]}),"\n",(0,r.jsxs)("p",{children:["A Random function in an instantiation of Numerics.Discrete","_","Random is guaranteed to yield each value in its result range in a finite number of calls, provided that the number of such values does not exceed 215.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"43_A.5.2"}),"\n",(0,r.jsxs)("p",{children:["Other performance requirements for the random number generator, which apply only in implementations conforming to the Numerics Annex, and then only in the \u201Cstrict\u201D mode defined there (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.2",children:"G.2"}),"), are given in ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.2#Subclause_G.2.5",children:"G.2.5"}),". ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(n.h4,{id:"documentation-requirements",children:"Documentation Requirements"}),"\n",(0,r.jsx)(d.A,{children:"44_A.5.2"}),"\n",(0,r.jsxs)("p",{children:["No one algorithm for random number generation is best for all applications. To enable the user to determine the suitability of the random number generators for the intended application, the implementation shall describe the algorithm used and shall give its period, if known exactly, or a lower bound on the period, if the exact period is unknown. Periods that are so long that the periodicity is unobservable in practice can be described in such terms, without giving a numerical bound. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"44.a/2_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{children:"Documentation Requirement: "}),"The algorithm used for random number generation, including a description of its period.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"45_A.5.2"}),"\n",(0,r.jsxs)("p",{children:["The implementation also shall document the minimum time interval between calls to the time-dependent Reset procedure that are guaranteed to initiate different sequences, and it shall document the nature of the strings that Value will accept without raising Constraint","_","Error. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"45.a/2_A.5.2"}),(0,r.jsxs)(a.A,{type:"aarm",aarm:"note",children:[(0,r.jsx)("i",{children:"This paragraph was deleted."}),(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"45.b/2_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{children:"Documentation Requirement: "}),"The minimum time interval between calls to the time-dependent Reset procedure that is guaranteed to initiate different random number sequences.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(n.h4,{id:"implementation-advice",children:"Implementation Advice"}),"\n",(0,r.jsx)(d.A,{children:"46_A.5.2"}),"\n",(0,r.jsxs)("p",{children:["Any storage associated with an object of type Generator should be reclaimed on exit from the scope of the object. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"46.a.1/2_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-advice",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"Any storage associated with an object of type Generator of the random number packages should be reclaimed on exit from the scope of the object.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"46.a_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"ramification",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"A level of indirection is implicit in the semantics of the operations, given that they all take parameters of mode ",(0,r.jsx)("b",{children:"in"}),". This implies that the full type of Generator probably should be a controlled type, with appropriate finalization to reclaim any heap-allocated storage. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"47_A.5.2"}),"\n",(0,r.jsxs)("p",{children:["If the generator period is sufficiently long in relation to the number of distinct initiator values, then each possible value of Initiator passed to Reset should initiate a sequence of random numbers that does not, in a practical sense, overlap the sequence initiated by any other value. If this is not possible, then the mapping between initiator values and generator states should be a rapidly varying function of the initiator value. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"47.a/2_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-advice",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"Each value of Initiator passed to Reset for the random number packages should initiate a distinct sequence of random numbers, or, if that is not possible, be at least a rapidly varying function of the initiator value.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"48_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["NOTE 1 If two or more tasks are to share the same generator, then the tasks have to synchronize their access to the generator as for any shared variable (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-9/AA-9.10",children:"9.10"}),").",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"49_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["NOTE 2 Within a given implementation, a repeatable random number sequence can be obtained by relying on the implicit initialization of generators or by explicitly initializing a generator with a repeatable initiator value. Different sequences of random numbers can be obtained from a given generator in different program executions by explicitly initializing the generator to a time-dependent state.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"50/5_A.5.2"}),(0,r.jsx)(h.A,{items:["AI12-0442-1","AI12-0447-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["NOTE 3 A given implementation of the Random function in Numerics.Float","_","Random is not guaranteed to be capable of delivering the values 0.0 or 1.0. Applications will be more portable if they assume that these values, or values sufficiently close to them to behave indistinguishably from them, can occur. If a sequence of random integers from some range is necessary, the application should use one of the Random functions in an appropriate instantiation of Numerics.Discrete","_","Random, rather than transforming the result of the Random function in Numerics.Float","_","Random. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"51/5_A.5.2"}),(0,r.jsx)(h.A,{items:["AI12-0442-1"]}),(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["This paragraph was deleted.","\n"]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"51.a/5_A.5.2"}),(0,r.jsx)(h.A,{items:["AI12-0144-1","AI12-0442-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"reason",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"One might think that a simple transformation of the result of the floating point Random function such as Integer(Float(M) ","*"," Random(G)) ",(0,r.jsx)("b",{children:"mod"})," M would give a uniform distribution. But this is only true if the peri
1od of the underlying generator is a multiple of M. (This usually requires that M be a power of two.) In other cases, the ",(0,r.jsx)("b",{children:"mod"})," operation maps slightly more random values to some result values than others. It is easy to see this: consider a 4-bit random integer (with a range of 0 .. 15). If one ",(0,r.jsx)("b",{children:"mod"}),"s this by 6 to get a value in 0 .. 5 (to which one would add 1 to get the value of a die roll), 3 values would be mapped to each value 0 .. 3, but only 2 values would be mapped to 4 and 5. Even when the input is uniformly distributed, the output clearly is not. A similar effect occurs regardless of the number of bits in the random integer. Since it takes care to get this right, users should use the provided functions (which presumably do this correctly \u2013 contains a correct algorithm) and resist the urge to \u201Croll-their-own\u201D. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"52/5_A.5.2"}),(0,r.jsx)(h.A,{items:["AI12-0442-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["NOTE 4 Exponentially distributed (floating point) random numbers with mean and standard deviation 1.0 can be obtained by the transformation ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"53/2_A.5.2"}),(0,r.jsx)(h.A,{items:["AI95-00434-01"]}),(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["-Log(Random(G) + Float'Model","_","Small)","\n"]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"54_A.5.2"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["where Log comes from Numerics.Elementary","_","Functions (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-A/AA-A.5#Subclause_A.5.1",children:"A.5.1"}),"); in this expression, the addition of Float'Model","_","Small avoids the exception that would be raised were Log to be given the value zero, without affecting the result (in most implementations) when Random returns a nonzero value. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(n.h4,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(d.A,{children:"55_A.5.2"}),"\n",(0,r.jsxs)("p",{children:[(0,r.jsx)("i",{children:"Example of a program that plays a simulated dice game:"})," ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"56_A.5.2"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["with Ada.Numerics.Discrete","_","Random;","\n","procedure Dice","_","Game is","\n"," subtype Die is Integer range 1 .. 6;","\n"," subtype Dice is Integer range 2","*","Die'First .. 2","*","Die'Last;","\n"," package Random","_","Die is new Ada.Numerics.Discrete","_","Random (Die);","\n"," use Random","_","Die;","\n"," G : Generator;","\n"," D : Dice;","\n","begin","\n"," Reset (G); -- Start the generator in a unique state in each run","\n"," loop","\n"," -- Roll a pair of dice; sum and process the results","\n"," D := Random(G) + Random(G);","\n"," ...","\n"," end loop;","\n","end Dice","_","Game;","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"57_A.5.2"}),"\n",(0,r.jsxs)("p",{children:[(0,r.jsx)("i",{children:"Example of a program that simulates coin tosses:"})," ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"58_A.5.2"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["with Ada.Numerics.Discrete","_","Random;","\n","procedure Flip","_","A","_","Coin is","\n"," type Coin is (Heads, Tails);","\n"," package Random","_","Coin is new Ada.Numerics.Discrete","_","Random (Coin);","\n"," use Random","_","Coin;","\n"," G : Generator;","\n","begin","\n"," Reset (G); -- Start the generator in a unique state in each run","\n"," loop","\n"," -- Toss a coin and process the result","\n"," case Random(G) is","\n"," when Heads =",">","\n"," ...","\n"," when Tails =",">","\n"," ...","\n"," end case;","\n"," ...","\n"," end loop;","\n","end Flip","_","A","_","Coin;","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"59_A.5.2"}),"\n",(0,r.jsxs)("p",{children:[(0,r.jsx)("i",{children:"Example of a parallel simulation of a physical system, with a separate generator of event probabilities in each task:"})," ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"60_A.5.2"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["with Ada.Numerics.Float","_","Random;","\n","procedure Parallel","_","Simulation is","\n"," use Ada.Numerics.Float","_","Random;","\n"," task type Worker is","\n"," entry Initialize","_","Generator (Initiator : in Integer);","\n"," ...","\n"," end Worker;","\n"," W : array (1 .. 10) of Worker;","\n"," task body Worker is","\n"," G : Generator;","\n"," Probability","_","Of","_","Event : Uniformly","_","Distributed;","\n"," begin","\n"," accept Initialize","_","Generator (Initiator : in Integer) do","\n"," Reset (G, Initiator);","\n"," end Initialize","_","Generator;","\n"," loop","\n"," ...","\n"," Probability","_","Of","_","Event := Random(G);","\n"," ...","\n"," end loop;","\n"," end Worker;","\n","begin","\n"," -- Initialize the generators in the Worker tasks to different states","\n"," for I in W'Range loop","\n"," W(I).Initialize","_","Generator (I);","\n"," end loop;","\n"," ... -- Wait for the Worker tasks to terminate","\n","end Parallel","_","Simulation;","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"61/5_A.5.2"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0452-1"]}),"\n",(0,r.jsxs)("p",{children:["Although each Worker task initializes its generator to a different state, those states will be the same in every execution of the program. The generator states can be initialized uniquely in each program execution by instantiating Ada.Numerics.Discrete","_","Random for the type Integer in the main procedure, resetting the generator obtained from that instance to a time-dependent state, and then using random integers obtained from that generator to initialize the generators in each Worker task.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"incompatibilities-with-ada-95",children:"Incompatibilities With Ada 95"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"62.a/2_A.5.2"}),(0,r.jsx)(h.A,{items:["AI95-00360-01"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"correction",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{children:"Amendment "})," Type Generator in Numerics.Float","_","Random and in an instance of Numerics.Discrete","_","Random is defined to need finalization. If the restriction No","_","Nested","_","Finalization (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-D/AA-D.7",children:"D.7"}),") applies to the partition, and Generator does not have a controlled part, it will not be allowed in local objects in Ada 2005 whereas it would be allowed in original Ada 95. Such code is not portable, as another Ada compiler may have a controlled part in Generator, and thus would be illegal. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"wording-changes-from-ada-95-1",children:"Wording Changes from Ada 95"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"62.b/3_A.5.2"}),(0,r.jsx)(h.A,{items:["AI95-00089-01","AI05-0005-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["{",(0,r.jsx)("i",{children:"8652/0050"}),"}"," ",(0,r.jsx)("b",{children:"Corrigendum:"})," Made the passing of an incorrect Image of a generator a bounded error, as it might not be practical to check for problems (if a generator consists of several related values). ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"wording-changes-from-ada-2005",children:"Wording Changes from Ada 2005"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"62.c/3_A.5.2"}),(0,r.jsx)(h.A,{items:["AI05-0280-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"correction",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{})," Specified the implicit initial value for (sub)type State. This was unspecified in Ada 95 and Ada 2005, so a program depending on some other initial value is very unlikely and certainly was not portable. An implementation can use default expressions, aspect Default","_","Value, or aspect Default","_","Component","_","Value to keep the representation of the type unchanged while meeting this new requirement. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"extensions-to-ada-2012",children:"Extensions to Ada 2012"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"62.d/5_A.5.2"}),(0,r.jsx)(h.A,{items:["AI12-0144-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The function Random with First and Last parameters is new. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)("a",{id:"Subclause_A.5.3"}),"\n",(0,r.jsx)(n.h2,{id:"a53--attributes-of-floating-point-types",children:"A.5.3 Attributes of Floating Point Types"}),"\n",(0,r.jsx)(n.h4,{id:"static-semantics-3",children:"Static Semantics"}),"\n",(0,r.jsx)(d.A,{children:"1_A.5.3"}),"\n",(0,r.jsxs)("p",{children:["The following ",(0,r.jsx)("i",{children:"representation-oriented attributes"})," are defined for every subtype S of a floating point type ",(0,r.jsx)("i",{children:"T"}),". ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"2_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Machine","_","Radix"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["Yields the radix of the hardware representation of the type ",(0,r.jsx)("i",{children:"T"}),". The value of this attribute is of the type ",(0,r.jsxs)("i",{children:["universal","_","integer"]}),". ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsx)(d.A,{children:"3_A.5.3"}),"\n",(0,r.jsxs)("p",{children:["The values of other representation-oriented attributes of a floating point subtype, and of the \u201Cprimitive function\u201D attributes of a floating point subtype described later, are defined in terms of a particular representation of nonzero values called the ",(0,r.jsx)("i",{children:"canonical form"}),". The canonical form (for the type ",(0,r.jsx)("i",{children:"T"}),") is the form",(0,r.jsx)("br",{})," \xb1 ",(0,r.jsx)("i",{children:"mantissa"})," \xb7 ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix",(0,r.jsx)("i",{children:"exponent"}),(0,r.jsx)("br",{}),"where ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"4_A.5.3"}),"\n",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:[(0,r.jsx)("i",{children:"mantissa"})," is a fraction in the number base ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix, the first digit of which is nonzero, and",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"5_A.5.3"}),(0,r.jsxs)("li",{children:[(0,r.jsx)("i",{children:"exponent"})," is an integer. ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(d.A,{children:"6_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Machine","_","Mantissa"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["Yields the largest value of ",(0,r.jsx)("i",{children:"p"})," such that every value expressible in the canonical form (for the type ",(0,r.jsx)("i",{children:"T"}),"), having a ",(0,r.jsx)("i",{children:"p"}),"-digit ",(0,r.jsx)("i",{children:"mantissa"})," and an ",(0,r.jsx)("i",{children:"exponent"})," between ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Emin and ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Emax, is a machine number (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-3/AA-3.5#Subclause_3.5.7",children:"3.5.7"}),") of the type ",(0,r.jsx)("i",{children:"T"}),". This attribute yields a value of the type ",(0,r.jsxs)("i",{children:["universal","_","integer"]}),". ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"6.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"ramification",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"Values of a type held in an extended register are, in general, not machine numbers of the type, since they cannot be expressed in the canonical form with a sufficiently short ",(0,r.jsx)("i",{children:"mantissa"}),". ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"7_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Machine","_","Emin"]}),"\n",(0,r.jsxs)("dl",{children:[(0,r.jsxs)("dd",{children:["Yields the smallest (most negative) value of ",(0,r.jsx)("i",{children:"exponent"})," such that every value expressible in the canonical form (for the type ",(0,r.jsx)("i",{children:"T"}),"), having a ",(0,r.jsx)("i",{children:"mantissa"})," of ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Mantissa digits, is a machine number (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-3/AA-3.5#Subclause_3.5.7",children:"3.5.7"}),") of the type ",(0,r.jsx)("i",{children:"T"}),". This attribute yields a value of the type ",(0,r.jsxs)("i",{children:["universal","_","integer"]}),".",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"8_A.5.3"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Machine","_","Emax"]}),(0,r.jsxs)("dd",{children:["Yields the largest (most positive) value of ",(0,r.jsx)("i",{children:"exponent"})," such that every value expressible in the canonical form (for the type ",(0,r.jsx)("i",{children:"T"}),"), having a ",(0,r.jsx)("i",{children:"mantissa"})," of ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Mantissa digits, is a machine number (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-3/AA-3.5#Subclause_3.5.7",children:"3.5.7"}),") of the type ",(0,r.jsx)("i",{children:"T"}),". This attribute yields a value of the type ",(0,r.jsxs)("i",{children:["universal","_","integer"]}),". ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"8.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"ramification",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"Note that the above definitions do not determine unique values for the representation-oriented attributes of floating point types. The implementation may choose any set of values that collectively satisfies the definitions.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"9_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Denorm"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["Yields the value True if every value expressible in the form",(0,r.jsx)("br",{})," \xb1 ",(0,r.jsx)("i",{children:"mantissa"})," \xb7 ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Emin",(0,r.jsx)("br",{}),"where ",(0,r.jsx)("i",{children:"mantissa"}
1)," is a nonzero ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Mantissa-digit fraction in the number base ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix, the first digit of which is zero, is a machine number (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-3/AA-3.5#Subclause_3.5.7",children:"3.5.7"}),") of the type ",(0,r.jsx)("i",{children:"T"}),"; yields the value False otherwise. The value of this attribute is of the predefined type Boolean. ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsx)(d.A,{children:"10_A.5.3"}),"\n",(0,r.jsxs)("p",{children:["The values described by the formula in the definition of S'Denorm are called ",(0,r.jsx)("i",{children:"denormalized numbers"}),". A nonzero machine number that is not a denormalized number is a ",(0,r.jsx)("i",{children:"normalized number"}),". A normalized number ",(0,r.jsx)("i",{children:"x"})," of a given type ",(0,r.jsx)("i",{children:"T"})," is said to be ",(0,r.jsx)("i",{children:"represented in canonical form"})," when it is expressed in the canonical form (for the type ",(0,r.jsx)("i",{children:"T"}),") with a ",(0,r.jsx)("i",{children:"mantissa"})," having ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Mantissa digits; the resulting form is the ",(0,r.jsx)("i",{children:"canonical-form representation"})," of ",(0,r.jsx)("i",{children:"x"}),". ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"10.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The intent is that S'Denorm be True when such denormalized numbers exist and are generated in the circumstances defined by IEC 559:1989, though the latter requirement is not formalized here. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"11_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Machine","_","Rounds"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["Yields the value True if rounding is performed on inexact results of every predefined operation that yields a result of the type ",(0,r.jsx)("i",{children:"T"}),"; yields the value False otherwise. The value of this attribute is of the predefined type Boolean. ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"11.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"It is difficult to be more precise about what it means to round the result of a predefined operation. If the implementation does not use extended registers, so that every arithmetic result is necessarily a machine number, then rounding seems to imply two things: ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"11.b_A.5.3"}),(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["S'Model","_","Mantissa = S'Machine","_","Mantissa, so that operand preperturbation never occurs;",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"11.c_A.5.3"}),(0,r.jsxs)("li",{children:["when the exact mathematical result is not a machine number, the result of a predefined operation must be the nearer of the two adjacent machine numbers. ",(0,r.jsx)("br",{})]})]})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"11.d_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["Technically, this attribute should yield False when extended registers are used, since a few computed results will cross over the half-way point as a result of double rounding, if and when a value held in an extended register has to be reduced in precision to that of the machine numbers. It does not seem desirable to preclude the use of extended registers when S'Machine","_","Rounds could otherwise be True. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"12_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Machine","_","Overflows"]}),"\n",(0,r.jsxs)("dl",{children:[(0,r.jsxs)("dd",{children:["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 ",(0,r.jsx)("i",{children:"T"}),"; yields the value False otherwise. The value of this attribute is of the predefined type Boolean.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"13_A.5.3"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Signed","_","Zeros"]}),(0,r.jsxs)("dd",{children:["Yields the value True if the hardware representation for the type ",(0,r.jsx)("i",{children:"T"})," has the capability of representing both positively and negatively signed zeros, these being generated and used by the predefined operations of the type ",(0,r.jsx)("i",{children:"T"})," as specified in IEC 559:1989; yields the value False otherwise. The value of this attribute is of the predefined type Boolean. ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(d.A,{children:"14_A.5.3"}),"\n",(0,r.jsxs)("p",{children:["For every value ",(0,r.jsx)("i",{children:"x"})," of a floating point type ",(0,r.jsx)("i",{children:"T"}),", the ",(0,r.jsx)("i",{children:"normalized exponent"})," of ",(0,r.jsx)("i",{children:"x"})," is defined as follows: ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"15_A.5.3"}),"\n",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["the normalized exponent of zero is (by convention) zero;",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"16_A.5.3"}),(0,r.jsxs)("li",{children:["for nonzero ",(0,r.jsx)("i",{children:"x"}),", the normalized exponent of ",(0,r.jsx)("i",{children:"x"})," is the unique integer ",(0,r.jsx)("i",{children:"k"})," such that ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix",(0,r.jsx)("i",{children:"k"}),"\u20131 \u2264 |",(0,r.jsx)("i",{children:"x"}),"| ","<"," ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix",(0,r.jsx)("i",{children:"k"}),". ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"16.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"ramification",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The normalized exponent of a normalized number ",(0,r.jsx)("i",{children:"x"})," is the value of ",(0,r.jsx)("i",{children:"exponent"})," in the canonical-form representation of ",(0,r.jsx)("i",{children:"x"}),".",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"16.b_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The normalized exponent of a denormalized number is less than the value of ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Emin. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"17_A.5.3"}),"\n",(0,r.jsxs)("p",{children:["The following ",(0,r.jsx)("i",{children:"primitive function attributes"})," are defined for any subtype S of a floating point type ",(0,r.jsx)("i",{children:"T"}),". ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"18_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Exponent"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["S'Exponent denotes a function with the following specification: ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsx)(d.A,{children:"19_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Exponent (X : T)","\n"," return universal","_","integer","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"20_A.5.3"}),"\n",(0,r.jsxs)("dl",{children:[(0,r.jsxs)("dd",{children:["The function yields the normalized exponent of ",(0,r.jsx)("i",{children:"X"}),".",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"21_A.5.3"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Fraction"]}),(0,r.jsxs)("dd",{children:["S'Fraction denotes a function with the following specification: ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(d.A,{children:"22_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Fraction (X : T)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"23_A.5.3"}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["The function yields the value ",(0,r.jsx)("i",{children:"X"})," \xb7 ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix\u2013",(0,r.jsx)("i",{children:"k"}),", where ",(0,r.jsx)("i",{children:"k"})," is the normalized exponent of ",(0,r.jsx)("i",{children:"X"}),". A zero result[, which can only occur when ",(0,r.jsx)("i",{children:"X"})," is zero,] has the sign of ",(0,r.jsx)("i",{children:"X"}),". ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"23.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"Informally, when ",(0,r.jsx)("i",{children:"X"}
1)," is a normalized number, the result is the value obtained by replacing the ",(0,r.jsx)("i",{children:"exponent"})," by zero in the canonical-form representation of ",(0,r.jsx)("i",{children:"X"}),". ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"23.b_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"ramification",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"Except when ",(0,r.jsx)("i",{children:"X"})," is zero, the magnitude of the result is greater than or equal to the reciprocal of ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix and less than one; consequently, the result is always a normalized number, even when ",(0,r.jsx)("i",{children:"X"})," is a denormalized number. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"23.c_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-note",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"When ",(0,r.jsx)("i",{children:"X"})," is a denormalized number, the result is the value obtained by replacing the ",(0,r.jsx)("i",{children:"exponent"})," by zero in the canonical-form representation of the result of scaling ",(0,r.jsx)("i",{children:"X"})," up sufficiently to normalize it. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"24_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Compose"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["S'Compose denotes a function with the following specification: ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsx)(d.A,{children:"25_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Compose (Fraction : T;","\n"," Exponent : universal","_","integer)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"26_A.5.3"}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["Let ",(0,r.jsx)("i",{children:"v"})," be the value ",(0,r.jsx)("i",{children:"Fraction"})," \xb7 ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix",(0,r.jsx)("i",{children:"Exponent"}),"\u2013",(0,r.jsx)("i",{children:"k"}),", where ",(0,r.jsx)("i",{children:"k"})," is the normalized exponent of ",(0,r.jsx)("i",{children:"Fraction"}),". If ",(0,r.jsx)("i",{children:"v"})," is a machine number of the type ",(0,r.jsx)("i",{children:"T"}),", or if |",(0,r.jsx)("i",{children:"v"}),"| \u2265 ",(0,r.jsx)("i",{children:"T"}),"'Model","_","Small, the function yields ",(0,r.jsx)("i",{children:"v"}),"; otherwise, it yields either one of the machine numbers of the type ",(0,r.jsx)("i",{children:"T"})," adjacent to ",(0,r.jsx)("i",{children:"v"}),". Constraint","_","Error is optionally raised if ",(0,r.jsx)("i",{children:"v"})," is outside the base range of S. A zero result has the sign of ",(0,r.jsx)("i",{children:"Fraction"})," when S'Signed","_","Zeros is True. ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"26.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"Informally, when ",(0,r.jsx)("i",{children:"Fraction"})," and ",(0,r.jsx)("i",{children:"v"})," are both normalized numbers, the result is the value obtained by replacing the ",(0,r.jsx)("i",{children:"exponent"})," by ",(0,r.jsx)("i",{children:"Exponent"})," in the canonical-form representation of ",(0,r.jsx)("i",{children:"Fraction"}),". ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"26.b_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"ramification",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"If ",(0,r.jsx)("i",{children:"Exponent"})," is less than ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Emin and ",(0,r.jsx)("i",{children:"Fraction"})," is nonzero, the result is either zero, ",(0,r.jsx)("i",{children:"T"}),"'Model","_","Small, or (if ",(0,r.jsx)("i",{children:"T"}),"'Denorm is True) a denormalized number. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"27_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Scaling"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["S'Scaling denotes a function with the following specification: ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsx)(d.A,{children:"28_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Scaling (X : T;","\n"," Adjustment : universal","_","integer)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"29_A.5.3"}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["Let ",(0,r.jsx)("i",{children:"v"})," be the value ",(0,r.jsx)("i",{children:"X"})," \xb7 ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix",(0,r.jsx)("i",{children:"Adjustment"}),". If ",(0,r.jsx)("i",{children:"v"})," is a machine number of the type ",(0,r.jsx)("i",{children:"T"}),", or if |",(0,r.jsx)("i",{children:"v"}),"| \u2265 ",(0,r.jsx)("i",{children:"T"}),"'Model","_","Small, the function yields ",(0,r.jsx)("i",{children:"v"}),"; otherwise, it yields either one of the machine numbers of the type ",(0,r.jsx)("i",{children:"T"})," adjacent to ",(0,r.jsx)("i",{children:"v"}),". Constraint","_","Error is optionally raised if ",(0,r.jsx)("i",{children:"v"})," is outside the base range of S. A zero result has the sign of ",(0,r.jsx)("i",{children:"X"})," when S'Signed","_","Zeros is True. ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"29.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"Informally, when ",(0,r.jsx)("i",{children:"X"})," and ",(0,r.jsx)("i",{children:"v"})," are both normalized numbers, the result is the value obtained by increasing the ",(0,r.jsx)("i",{children:"exponent"})," by ",(0,r.jsx)("i",{children:"Adjustment"})," in the canonical-form representation of ",(0,r.jsx)("i",{children:"X"}),". ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"29.b/5_A.5.3"}),(0,r.jsx)(h.A,{items:["AI12-0453-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"ramification",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"If ",(0,r.jsx)("i",{children:"Adjustment"})," is sufficiently small (that is, sufficiently negative), the result is either zero, ",(0,r.jsx)("i",{children:"T"}),"'Model","_","Small, or (if ",(0,r.jsx)("i",{children:"T"}),"'Denorm is True) a denormalized number. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"30_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Floor"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["S'Floor denotes a function with the following specification: ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsx)(d.A,{children:"31_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Floor (X : T)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"32/5_A.5.3"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0453-1"]}),"\n",(0,r.jsxs)("dl",{children:[(0,r.jsxs)("dd",{children:["The function yields the value \u230A",(0,r.jsx)("i",{children:"X"}),"\u230B, that is, the largest (most positive) integral value less than or equal to ",(0,r.jsx)("i",{children:"X"}),". When ",(0,r.jsx)("i",{children:"X"})," is zero, the result has the sign of ",(0,r.jsx)("i",{children:"X"}),"; a zero result otherwise has a positive sign.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"33_A.5.3"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Ceiling"]}),(0,r.jsxs)("dd",{children:["S'Ceiling denotes a function with the following specification: ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(d.A,{children:"34_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Ceiling (X : T)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"35/5_A.5.3"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0453-1"]}),"\n",(0,r.jsxs)("dl",{children:[(0,r.jsxs)("dd",{children:["The function yields the value \u2308",(0,r.jsx)("i",{children:"X"}),"\u2309, that is, the smallest (most negative) integral value greater than or equal to ",(0,r.jsx)("i",{children:"X"}),". When ",(0,r.jsx)("i",{children:"X"})," is zero, the result has the sign of ",(0,r.jsx)("i",{children:"X"}),"; a zero result otherwise has a negative sign when S'Signed","_","Zeros is True.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"36_A.5.3"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Rounding"]}),(0,r.jsxs)("dd",{children:["S'Rounding denotes a function with the following specification: ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(d.A,{children:"37_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Rounding (X : T)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"38_A.5.3"}),"\n",(0,r.jsxs)("dl",{children:[(0,r.jsxs)("dd",{children:["The function yields the integral value nearest to ",(0,r.jsx)("i",{children:"X"}),", rounding away from zero if ",(0,r.jsx)("i",{children:"X"})," lies exactly halfway between two integers. A zero result has the sign of ",(0,r.jsx)("i",{children:"X"})," when S'Signed","_","Zeros is True.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"39_A.5.3"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Unbiased","_","Rounding"]}),(0,r.jsxs)("dd",{children:["S'Unbiased","_","Rounding denotes a function with the following specification: ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(d.A,{children:"40_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Unbiased","_","Rounding (X : T)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"41_A.5.3"}),"\n",(0,r.jsxs)("dl",{children:[(0,r.jsxs)("dd",{children:["The function yields the integral value nearest to ",(0,r.jsx)("i",{children:"X"}),", rounding toward the even integer if ",(0,r.jsx)("i",{children:"X"})," lies exactly halfway between two integers. A zero result has the sign of ",(0,r.jsx)("i",{children:"X"})," when S'Signed","_","Zeros is True.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"41.1/2_A.5.3"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Machine","_","Rounding"]}),(0,r.jsx)(h.A,{items:["AI95-00267-01"]}),(0,r.jsxs)("dd",{children:["S'Machine","_","Rounding denotes a function with the following specification: ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(d.A,{children:"41.2/2_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Machine","_","Rounding (X : T)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"41.3/2_A.5.3"}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["The function yields the integral value nearest to ",(0,r.jsx)("i",{children:"X"}),". If ",(0,r.jsx)("i",{children:"X"})," lies exactly halfway between two integers, one of those integers is returned, but which of them is returned is unspecified. A zero result has the sign of ",(0,r.jsx)("i",{children:"X"})," when S'Signed","_","Zeros is True. This function provides access to the rounding behavior which is most efficient on the target processor.",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"41.a.1/2_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"We leave the rounding unspecified, so that users cannot depend on a particular rounding. This attribute is intended for use in cases where the particular rounding chosen is irrelevant. If there is a need to know which way values halfway between two integers are rounded, one of the other rounding attributes should be used. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"42_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Truncation"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["S'Truncation de
1notes a function with the following specification: ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsx)(d.A,{children:"43_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Truncation (X : T)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"44_A.5.3"}),"\n",(0,r.jsxs)("dl",{children:[(0,r.jsxs)("dd",{children:["The function yields the value \u2308",(0,r.jsx)("i",{children:"X"}),"\u2309 when ",(0,r.jsx)("i",{children:"X"})," is negative, and \u230A",(0,r.jsx)("i",{children:"X"}),"\u230B otherwise. A zero result has the sign of ",(0,r.jsx)("i",{children:"X"})," when S'Signed","_","Zeros is True.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"45_A.5.3"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Remainder"]}),(0,r.jsxs)("dd",{children:["S'Remainder denotes a function with the following specification: ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(d.A,{children:"46_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Remainder (X, Y : T)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"47_A.5.3"}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["For nonzero ",(0,r.jsx)("i",{children:"Y"}),", let ",(0,r.jsx)("i",{children:"v"})," be the value ",(0,r.jsx)("i",{children:"X"})," \u2013 ",(0,r.jsx)("i",{children:"n"})," \xb7 ",(0,r.jsx)("i",{children:"Y"}),", where ",(0,r.jsx)("i",{children:"n"})," is the integer nearest to the exact value of ",(0,r.jsx)("i",{children:"X"}),"/",(0,r.jsx)("i",{children:"Y"}),"; if |",(0,r.jsx)("i",{children:"n"})," \u2013 ",(0,r.jsx)("i",{children:"X"}),"/",(0,r.jsx)("i",{children:"Y"}),"| = 1/2, then ",(0,r.jsx)("i",{children:"n"})," is chosen to be even. If ",(0,r.jsx)("i",{children:"v"})," is a machine number of the type ",(0,r.jsx)("i",{children:"T"}),", the function yields ",(0,r.jsx)("i",{children:"v"}),"; otherwise, it yields zero. Constraint","_","Error is raised if ",(0,r.jsx)("i",{children:"Y"})," is zero. A zero result has the sign of ",(0,r.jsx)("i",{children:"X"})," when S'Signed","_","Zeros is True. ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"47.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"ramification",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The magnitude of the result is less than or equal to one-half the magnitude of ",(0,r.jsx)("i",{children:"Y"}),". ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"47.b_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"Given machine numbers ",(0,r.jsx)("i",{children:"X"})," and ",(0,r.jsx)("i",{children:"Y"})," of the type ",(0,r.jsx)("i",{children:"T"}),", ",(0,r.jsx)("i",{children:"v"})," is necessarily a machine number of the type ",(0,r.jsx)("i",{children:"T"}),", except when ",(0,r.jsx)("i",{children:"Y"})," is in the neighborhood of zero, ",(0,r.jsx)("i",{children:"X"})," is sufficiently close to a multiple of ",(0,r.jsx)("i",{children:"Y"}),", and ",(0,r.jsx)("i",{children:"T"}),"'Denorm is False. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"48_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Adjacent"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["S'Adjacent denotes a function with the following specification: ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsx)(d.A,{children:"49_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Adjacent (X, Towards : T)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"50_A.5.3"}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["If ",(0,r.jsx)("i",{children:"Towards"})," = ",(0,r.jsx)("i",{children:"X"}),", the function yields ",(0,r.jsx)("i",{children:"X"}),"; otherwise, it yields the machine number of the type ",(0,r.jsx)("i",{children:"T"})," adjacent to ",(0,r.jsx)("i",{children:"X"})," in the direction of ",(0,r.jsx)("i",{children:"Towards"}),", if that machine number exists. If the result would be outside the base range of S, Constraint","_","Error is raised. When ",(0,r.jsx)("i",{children:"T"}),"'Signed","_","Zeros is True, a zero result has the sign of ",(0,r.jsx)("i",{children:"X"}),". When ",(0,r.jsx)("i",{children:"Towards"})," is zero, its sign has no bearing on the result. ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"50.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"ramification",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The value of S'Adjacent(0.0, 1.0) is the smallest normalized positive number of the type ",(0,r.jsx)("i",{children:"T"})," when ",(0,r.jsx)("i",{children:"T"}),"'Denorm is False and the smallest denormalized positive number of the type ",(0,r.jsx)("i",{children:"T"})," when ",(0,r.jsx)("i",{children:"T"}),"'Denorm is True. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"51_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Copy","_","Sign"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["S'Copy","_","Sign denotes a function with the following specification: ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsx)(d.A,{children:"52_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Copy","_","Sign (Value, Sign : T)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"53_A.5.3"}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["If the value of ",(0,r.jsx)("i",{children:"Value"})," is nonzero, the function yields a result whose magnitude is that of ",(0,r.jsx)("i",{children:"Value"})," and whose sign is that of ",(0,r.jsx)("i",{children:"Sign"}),"; otherwise, it yields the value zero. Constraint","_","Error is optionally raised if the result is outside the base range of S. A zero result has the sign of ",(0,r.jsx)("i",{children:"Sign"})," when S'Signed","_","Zeros is True. ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"53.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}
1),"S'Copy","_","Sign is provided for convenience in restoring the sign to a quantity from which it has been temporarily removed, or to a related quantity. When S'Signed","_","Zeros is True, it is also instrumental in determining the sign of a zero quantity, when required. (Because negative and positive zeros compare equal in systems conforming to IEC 559:1989, a negative zero does ",(0,r.jsx)("i",{children:"not"})," appear to be negative when compared to zero.) The sign determination is accomplished by transferring the sign of the zero quantity to a nonzero quantity and then testing for a negative result. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"54_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Leading","_","Part"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["S'Leading","_","Part denotes a function with the following specification: ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsx)(d.A,{children:"55_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Leading","_","Part (X : T;","\n"," Radix","_","Digits : universal","_","integer)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"56_A.5.3"}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["Let ",(0,r.jsx)("i",{children:"v"})," be the value ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix",(0,r.jsx)("i",{children:"k"}),"\u2013",(0,r.jsxs)("i",{children:["Radix","_","Digits"]}),", where ",(0,r.jsx)("i",{children:"k"})," is the normalized exponent of ",(0,r.jsx)("i",{children:"X"}),". The function yields the value ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsx)(d.A,{children:"57_A.5.3"}),"\n",(0,r.jsxs)("ul",{children:[(0,r.jsxs)("li",{children:["\u230A",(0,r.jsx)("i",{children:"X"}),"/",(0,r.jsx)("i",{children:"v"}),"\u230B \xb7 ",(0,r.jsx)("i",{children:"v"}),", when ",(0,r.jsx)("i",{children:"X"})," is nonnegative and ",(0,r.jsxs)("i",{children:["Radix","_","Digits"]})," is positive;",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"58_A.5.3"}),(0,r.jsxs)("li",{children:["\u2308",(0,r.jsx)("i",{children:"X"}),"/",(0,r.jsx)("i",{children:"v"}),"\u2309 \xb7 ",(0,r.jsx)("i",{children:"v"}),", when ",(0,r.jsx)("i",{children:"X"})," is negative and ",(0,r.jsxs)("i",{children:["Radix","_","Digits"]})," is positive. ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(d.A,{children:"59_A.5.3"}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["Constraint","_","Error is raised when ",(0,r.jsxs)("i",{children:["Radix","_","Digits"]})," is zero or negative. A zero result[, which can only occur when ",(0,r.jsx)("i",{children:"X"})," is zero,] has the sign of ",(0,r.jsx)("i",{children:"X"}),". ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"59.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"Informally, if ",(0,r.jsx)("i",{children:"X"})," is nonzero, the result is the value obtained by retaining only the specified number of (leading) significant digits of ",(0,r.jsx)("i",{children:"X"})," (in the machine radix), setting all other digits to zero. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"59.b_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-note",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The result can be obtained by first scaling ",(0,r.jsx)("i",{children:"X"})," up, if necessary to normalize it, then masking the mantissa so as to retain only the specified number of leading digits, then scaling the result back down if ",(0,r.jsx)("i",{children:"X"})," was scaled up. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"60_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Machine"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["S'Machine denotes a function with the following specification: ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsx)(d.A,{children:"61_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Machine (X : T)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"62_A.5.3"}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["If ",(0,r.jsx)("i",{children:"X"})," is a machine number of the type ",(0,r.jsx)("i",{children:"T"}),", the function yields ",(0,r.jsx)("i",{children:"X"}),"; otherwise, it yields the value obtained by rounding or truncating ",(0,r.jsx)("i",{children:"X"})," to either one of the adjacent machine numbers of the type ",(0,r.jsx)("i",{children:"T"}
1),". Constraint","_","Error is raised if rounding or truncating ",(0,r.jsx)("i",{children:"X"})," to the precision of the machine numbers results in a value outside the base range of S. A zero result has the sign of ",(0,r.jsx)("i",{children:"X"})," when S'Signed","_","Zeros is True. ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"62.a/3_A.5.3"}),(0,r.jsx)(h.A,{items:["AI05-0005-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"All of the primitive function attributes except Rounding and Machine correspond to subprograms in the Generic","_","Primitive","_","Functions generic package that was proposed as a separate ISO standard (ISO/IEC DIS 11729) for Ada 83. The Scaling, Unbiased","_","Rounding, and Truncation attributes correspond to the Scale, Round, and Truncate functions, respectively, in Generic","_","Primitive","_","Functions. The Rounding attribute rounds away from zero; this functionality was not provided in Generic","_","Primitive","_","Functions. The name Round was not available for either of the primitive function attributes that perform rounding, since an attribute of that name is used for a different purpose for decimal fixed point types. Likewise, the name Scale was not available, since an attribute of that name is also used for a different purpose for decimal fixed point types. The functionality of the Machine attribute was also not provided in Generic","_","Primitive","_","Functions. The functionality of the Decompose procedure of Generic","_","Primitive","_","Functions is only provided in the form of the separate attributes Exponent and Fraction. The functionality of the Successor and Predecessor functions of Generic","_","Primitive","_","Functions is provided by the extension of the existing Succ and Pred attributes. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"62.b_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-note",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The primitive function attributes may be implemented either with appropriate floating point arithmetic operations or with integer and logical operations that act on parts of the representation directly. The latter is strongly encouraged when it is more efficient than the former; it is mandatory when the former cannot deliver the required accuracy due to limitations of the implementation's arithmetic operations. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"63_A.5.3"}),"\n",(0,r.jsxs)("p",{children:["The following ",(0,r.jsx)("i",{children:"model-oriented attributes"})," are defined for any subtype S of a floating point type ",(0,r.jsx)("i",{children:"T"}),". ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"64_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Model","_","Mantissa"]}),"\n",(0,r.jsxs)("dl",{children:[(0,r.jsxs)("dd",{children:["If the Numerics Annex is not supported, this attribute yields an implementation defined value that is greater than or equal to \u2308",(0,r.jsx)("i",{children:"d"})," \xb7 log(10) / log(",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix)\u2309 + 1, where ",(0,r.jsx)("i",{children:"d"})," is the requested decimal precision of ",(0,r.jsx)("i",{children:"T"}),", and less than or equal to the value of ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Mantissa. See ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.2#Subclause_G.2.2",children:"G.2.2"})," for further requirements that apply to implementations supporting the Numerics Annex. The value of this attribute is of the type ",(0,r.jsxs)("i",{children:["universal","_","integer"]}),".",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"65_A.5.3"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Model","_","Emin"]}),(0,r.jsxs)("dd",{children:["If the Numerics Annex is not supported, this attribute yields an implementation defined value that is greater than or equal to the value of ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Emin. See ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.2#Subclause_G.2.2",children:"G.2.2"}
1)," for further requirements that apply to implementations supporting the Numerics Annex. The value of this attribute is of the type ",(0,r.jsxs)("i",{children:["universal","_","integer"]}),".",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"66_A.5.3"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Model","_","Epsilon"]}),(0,r.jsxs)("dd",{children:["Yields the value ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix1 \u2013 ",(0,r.jsx)("i",{children:"T"}),"'Model","_","Mantissa. The value of this attribute is of the type ",(0,r.jsxs)("i",{children:["universal","_","real"]}),". ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"66.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"In most implementations, this attribute yields the absolute value of the difference between one and the smallest machine number of the type ",(0,r.jsx)("i",{children:"T"})," above one which, when added to one, yields a machine number different from one. Further discussion can be found in ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.2#Subclause_G.2.2",children:"G.2.2"}),". ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"67_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Model","_","Small"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["Yields the value ",(0,r.jsx)("i",{children:"T"}),"'Machine","_","Radix",(0,r.jsx)("i",{children:"T"}),"'Model","_","Emin \u2013 1. The value of this attribute is of the type ",(0,r.jsxs)("i",{children:["universal","_","real"]}),". ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"67.a/5_A.5.3"}),(0,r.jsx)(h.A,{items:["AI12-0453-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"In most implementations, this attribute yields the smallest positive normalized number of the type ",(0,r.jsx)("i",{children:"T"}),", that is, the number corresponding to the positive underflow threshold. In some implementations employing a radix-complement representation for the type ",(0,r.jsx)("i",{children:"T"}),", the positive underflow threshold is closer to zero than is the negative underflow threshold, with the consequence that the smallest positive normalized number does not coincide with the positive underflow threshold that is, it exceeds the latter). Further discussion can be found in ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.2#Subclause_G.2.2",children:"G.2.2"}),". ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"68_A.5.3"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Model"]}),"\n",(0,r.jsx)("dl",{children:(0,r.jsxs)("dd",{children:["S'Model denotes a function with the following specification: ",(0,r.jsx)("br",{})]})}),"\n",(0,r.jsx)(d.A,{children:"69_A.5.3"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["function S'Model (X : T)","\n"," return T","\n"]})}),"\n",(0,r.jsx)(d.A,{children:"70_A.5.3"}),"\n",(0,r.jsxs)("dl",{children:[(0,r.jsxs)("dd",{children:["If the Numerics Annex is not supported, the meaning of this attribute is implementation defined; see ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.2#Subclause_G.2.2",children:"G.2.2"})," for the definition that applies to implementations supporting the Numerics Annex.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"71_A.5.3"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Safe","_","First"]}),(0,r.jsxs)("dd",{children:["Yields the lower bound of the safe range (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-3/AA-3.5#Subclause_3.5.7",children:"3.5.7"}),") of the type ",(0,r.jsx)("i",{children:"T"}),". If the Numerics Annex is not supported, the value of this attribute is implementation defined; see ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.2#Subclause_G.2.2",children:"G.2.2"})," for the definition that applies to implementations supporting the Numerics Annex. The value of this attribute is of the type ",(0,r.jsxs)("i",{children:["universal","_","real"]}),".",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"72_A.5.3"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Safe","_","Last"]}),(0,r.jsxs)("dd",{children:["Yields the upper bound of the safe range (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-3/AA-3.5#Subclause_3.5.7",children:"3.5.7"}),") of the type ",(0,r.jsx)("i",{children:"T"}),". If the Numerics Annex is not supported, the value of this attribute is implementation defined; see ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.2#Subclause_G.2.2",children:"G.2.2"}
1)," for the definition that applies to implementations supporting the Numerics Annex. The value of this attribute is of the type ",(0,r.jsxs)("i",{children:["universal","_","real"]}),". ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"72.a_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"A predefined floating point arithmetic operation that yields a value in the safe range of its result type is guaranteed not to overflow. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"72.b_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{children:"To be honest: "}),"An exception is made for exponentiation by a negative exponent in ",(0,r.jsx)("a",{href:"/docs/arm/AA-4/AA-4.5#Subclause_4.5.6",children:"4.5.6"}),".",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"72.c_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-defined",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The values of the Model","_","Mantissa, Model","_","Emin, Model","_","Epsilon, Model, Safe","_","First, and Safe","_","Last attributes, if the Numerics Annex is not supported.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"incompatibilities-with-ada-83",children:"Incompatibilities With Ada 83"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"72.d_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The Epsilon and Mantissa attributes of floating point types are removed from the language and replaced by Model","_","Epsilon and Model","_","Mantissa, which may have different values (as a result of changes in the definition of model numbers); the replacement of one set of attributes by another is intended to convert what would be an inconsistent change into an incompatible change.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"72.e_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The Emax, Small, Large, Safe","_","Emax, Safe","_","Small, and Safe","_","Large attributes of floating point types are removed from the language. Small and Safe","_","Small are collectively replaced by Model","_","Small, which is functionally equivalent to Safe","_","Small, though it may have a slightly different value. The others are collectively replaced by Safe","_","First and Safe","_","Last. Safe","_","Last is functionally equivalent to Safe","_","Large, though it may have a different value; Safe","_","First is comparable to the negation of Safe","_","Large but may differ slightly from it as well as from the negation of Safe","_","Last. Emax and Safe","_","Emax had relatively few uses in Ada 83; T'Safe","_","Emax can be computed in the revised language as Integer'Min(T'Exponent(T'Safe","_","First), T'Exponent(T'Safe","_","Last)).",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"72.f_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["Implementations are encouraged to eliminate the incompatibilities discussed here by retaining the old attributes, during a transition period, in the form of implementation-defined attributes with their former values. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"extensions-to-ada-83-1",children:"Extensions to Ada 83"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"72.g_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The Model","_","Emin attribute is new. It is conceptually similar to the negation of Safe","_","Emax attribute of Ada 83, adjusted for the fact that the model numbers now have the hardware radix. It is a fundamental determinant, along with Model","_","Mantissa, of the set of model numbers of a type (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-G/AA-G.2#Subclause_G.2.1",children:"G.2.1"}),").",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"72.h_A.5.3"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The Denorm and Signed","_","Zeros attributes are new, as are all of the primitive function attributes. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"extensions-to-ada-95-1",children:"Extensions to Ada 95"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"72.i/2_A.5.3"}),(0,r.jsx)(h.A,{items:["AI95-00388-01"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The Machine","_","Rounding attribute is new. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)("a",{id:"Subclause_A.5.4"}),"\n",(0,r.jsx)(n.h2,{id:"a54--attributes-of-fixed-point-types",children:"A.5.4 Attributes of Fixed Point Types"}),"\n",(0,r.jsx)(n.h4,{id:"static-semantics-4",children:"Static Semantics"}),"\n",(0,r.jsx)(d.A,{children:"1_A.5.4"}),"\n",(0,r.jsxs)("p",{children:["The following ",(0,r.jsx)("i",{children:"representation-oriented"})," attributes are defined for every subtype S of a fixed point type ",(0,r.jsx)("i",{children:"T"}),". ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"2_A.5.4"}),"\n",(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Machine","_","Radix"]}),"\n",(0,r.jsxs)("dl",{children:[(0,r.jsxs)("dd",{children:["Yields the radix of the hardware representation of the type ",(0,r.jsx)("i",{children:"T"}),". The value of this attribute is of the type ",(0,r.jsxs)("i",{children:["universal","_","integer"]}),".",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"3_A.5.4"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Machine","_","Rounds"]}),(0,r.jsxs)("dd",{children:["Yields the value True if rounding is performed on inexact results of every predefined operation that yields a result of the type ",(0,r.jsx)("i",{children:"T"}),"; yields the value False otherwise. The value of this attribute is of the predefined type Boolean.",(0,r.jsx)("br",{})]}),(0,r.jsx)(d.A,{children:"4_A.5.4"}),(0,r.jsxs)("dt",{children:[(0,r.jsx)("br",{}),"S'Machine","_","Overflows"]}),(0,r.jsxs)("dd",{children:["Yields the value True if overflow and divi
1de-by-zero are detected and reported by raising Constraint","_","Error for every predefined operation that yields a result of the type ",(0,r.jsx)("i",{children:"T"}),"; yields the value False otherwise. The value of this attribute is of the predefined type Boolean. ",(0,r.jsx)("br",{})]})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"incompatibilities-with-ada-83-1",children:"Incompatibilities With Ada 83"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"4.a_A.5.4"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The Mantissa, Large, Safe","_","Small, and Safe","_","Large attributes of fixed point types are removed from the language.",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"4.b_A.5.4"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["Implementations are encouraged to eliminate the resulting incompatibility by retaining these attributes, during a transition period, in the form of implementation-defined attributes with their former values. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"extensions-to-ada-83-2",children:"Extensions to Ada 83"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"4.c_A.5.4"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The Machine","_","Radix attribute is now allowed for fixed point types. It is also specifiable in an attribute definition clause (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-F/AA-F.1",children:"F.1"}),"). ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)("a",{id:"Subclause_A.5.5"}),"\n",(0,r.jsx)(n.h2,{id:"a55--big-numbers",children:"A.5.5 Big Numbers"}),"\n",(0,r.jsx)(d.A,{children:"1/5_A.5.5"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1"]}),"\n",(0,r.jsxs)("p",{children:["Support is provided for integer arithmetic involving values larger than those supported by the target machine, and for arbitrary-precision real numbers. ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(n.h4,{id:"static-semantics-5",children:"Static Semantics"}),"\n",(0,r.jsx)(d.A,{children:"2/5_A.5.5"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1"]}),"\n",(0,r.jsxs)("p",{children:["The library package Numerics.Big","_","Numbers has the following declaration:",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"3/5_A.5.5"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["package Ada.Numerics.Big","_","Numbers","\n"," with Pure, Nonblocking, Global =",">"," null is","\n"," subtype Field is Integer range 0 .. implementation-defined;","\n"," subtype Number","_","Base is Integer range 2 .. 16;","\n","end Ada.Numerics.Big","_","Numbers;","\n"]})}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"extensions-to-ada-2012-1",children:"Extensions to Ada 2012"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"3.a/5_A.5.5"}),(0,r.jsx)(h.A,{items:["AI12-0208-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The package Numerics.Big","_","Numbers is new. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)("a",{id:"Subclause_A.5.6"}),"\n",(0,r.jsx)(n.h2,{id:"a56--big-integers",children:"A.5.6 Big Integers"}),"\n",(0,r.jsx)(n.h4,{id:"static-semantics-6",children:"Static Semantics"}),"\n",(0,r.jsx)(d.A,{children:"1/5_A.5.6"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1"]}),"\n",(0,r.jsxs)("p",{children:["The library package Numerics.Big","_","Numbers.Big","_","Integers has the following declaration:",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"2/5_A.5.6"}),"\n",(0,r.jsxs)(l.A,{language:"ada",children:[(0,r.jsxs)(n.p,{children:["with Ada.Strings.Text","_","Buffers;","\n","package Ada.Numerics.Big","_","Numbers.Big","_","Integers","\n"," with Preelaborate, Nonblocking, Global =",">"," in out synchronized is","\n","\n",(0,r.jsx)(d.A,{children:"3/5_A.5.6"})]}),(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1","AI12-0407-1"]}),(0,r.jsxs)(n.p,{children:["type Big","_","Integer is private","\n"," with Integer","_","Literal =",">"," From","_","Universal","_","Image,","\n"," Put","_","Image =",">"," Put","_","Image;","\n","\n",(0,r.jsx)(d.A,{children:"4/5_A.5.6"}),"\nfunction Is","_","Valid (Arg : Big","_","Integer) return Boolean","\n"," with Convention =",">"," Intrinsic;","\n"]})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"4.a/5_A.5.6"}),(0,r.jsx)(h.A,{items:["AI12-0005-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The result of Is","_","Valid on a default-initialized object of type Big","_","Integer is unspecified, analogous to the value of a Valid ",(0,r.jsx)("code",{children:(0,r.jsx)("a",{href:"/docs/arm/AA-4/AA-4.1#S0100",children:"attribute_reference"})})," applied to a default-initialized object of an integer type (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-13/AA-13.9#Subclause_13.9.2",children:"13.9.2"}),"). The language-provided functions in the Big","_","Integers package only return values for which Is","_","Valid is certain to be True. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"5/5_A.5.6"}),"\n",(0,r.jsxs)(l.A,{language:"ada",children:[(0,r.jsxs)(n.p,{children:["subtype Valid","_","Big","_","Integer is Big","_","Integer","\n"," with Dynamic","_","Predicate =",">"," Is","_","Valid (Valid","_","Big","_","Integer),","\n"," Predicate","_","Failure =",">"," (raise Program","_","Error);","\n","\n",(0,r.jsx)(d.A,{children:"6/5_A.5.6"}),'\nfunction "=" (L, R : Valid',"_","Big","_","Integer) return Boolean;
1","\n",' function "',"<",'" (L, R : Valid',"_","Big","_","Integer) return Boolean;","\n",' function "',"<",'=" (L, R : Valid',"_","Big","_","Integer) return Boolean;","\n",' function "',">",'" (L, R : Valid',"_","Big","_","Integer) return Boolean;","\n",' function "',">",'=" (L, R : Valid',"_","Big","_","Integer) return Boolean;","\n","\n",(0,r.jsx)(d.A,{children:"7/5_A.5.6"}),"\nfunction To","_","Big","_","Integer (Arg : Integer) return Valid","_","Big","_","Integer;","\n","\n",(0,r.jsx)(d.A,{children:"8/5_A.5.6"}),"\nsubtype Big","_","Positive is Big","_","Integer","\n"," with Dynamic","_","Predicate =",">"," (if Is","_","Valid (Big","_","Positive)","\n"," then Big","_","Positive ",">"," 0),","\n"," Predicate","_","Failure =",">"," (raise Constraint","_","Error);","\n","\n",(0,r.jsx)(d.A,{children:"9/5_A.5.6"}),"\nsubtype Big","_","Natural is Big","_","Integer","\n"," with Dynamic","_","Predicate =",">"," (if Is","_","Valid (Big","_","Natural)","\n"," then Big","_","Natural ",">","= 0),","\n"," Predicate","_","Failure =",">"," (raise Constraint","_","Error);","\n","\n",(0,r.jsx)(d.A,{children:"10/5_A.5.6"}),"\nfunction In","_","Range (Arg, Low, High : Valid","_","Big","_","Integer) return Boolean is","\n"," (Low ","<","= Arg and Arg ","<","= High);","\n","\n",(0,r.jsx)(d.A,{children:"11/5_A.5.6"}),"\nfunction To","_","Integer (Arg : Valid","_","Big","_","Integer) return Integer","\n"," with Pre =",">"," In","_","Range (Arg,","\n"," Low =",">"," To","_","Big","_","Integer (Integer'First),","\n"," High =",">"," To","_","Big","_","Integer (Integer'Last))","\n"," or else raise Constraint","_","Error;","\n","\n",(0,r.jsx)(d.A,{children:"12/5_A.5.6"}),"\ngeneric","\n"," type Int is range ","<",">",";","\n"," package Signed","_","Conversions is","\n"," function To","_","Big","_","Integer (Arg : Int) return Valid","_","Big","_","Integer;","\n"," function From","_","Big","_","Integer (Arg : Valid","_","Big","_","Integer) return Int","\n"," with Pre =",">"," In","_","Range (Arg,","\n"," Low =",">"," To","_","Big","_","Integer (Int'First),","\n"," High =",">"," To","_","Big","_","Integer (Int'Last))","\n"," or else raise Constraint","_","Error;","\n"," end Signed","_","Conversions;","\n","\n",(0,r.jsx)(d.A,{children:"13/5_A.5.6"}),"\ngeneric","\n"," type Int is mod ","<",">",";","\n"," package Unsigned","_","Conversions is","\n"," function To","_","Big","_","Integer (Arg : Int) return Valid","_","Big","_","Integer;","\n"," function From","_","Big","_","Integer (Arg : Valid","_","Big","_","Integer) return Int","\n"," with Pre =",">"," In","_","Range (Arg,","\n"," Low =",">"," To","_","Big","_","Integer (Int'First),","\n"," High =",">"," To","_","Big","_","Integer (Int'Last))","\n"," or else raise Constraint","_","Error;","\n"," end Unsigned","_","Conversions;","\n","\n",(0,r.jsx)(d.A,{children:"14/5_A.5.6"}),"\nfunction To","_","String (Arg : Valid","_","Big","_","Integer;","\n"," Width : Field := 0;","\n"," Base : Number","_","Base := 10) return String","\n"," with Post =",">"," To","_","String'Result'First = 1;","\n","\n",(0,r.jsx)(d.A,{children:"15/5_A.5.6"}),"\nfunction From","_","String (Arg : String) return Valid","_","Big","_","Integer;","\n","\n",(0,r.jsx)(d.A,{children:"16/5_A.5.6"})]}),(0,r.jsx)(h.A,{items:["AI12-0407-1"]}),(0,r.jsxs)(n.p,{children:["function From","_","Universal","_","Image (Arg : String) return Valid","_","Big","_","Integer","\n"," renames From","_","String;","\n","\n",(0,r.jsx)(d.A,{children:"17/5_A.5.6"}),"\nprocedure Put","_","Image","\n"," (Buffer : in out Ada.Strings.Text","_","Buffers.Root","_","Buffer","_","Type'Class;","\n"," Arg : in Valid","_","Big","_","Integer);","\n","\n",(0,r.jsx)(d.A,{children:"18/5_A.5.6"}),'\nfunction "+" (L : Valid',"_","Big","_","Integer) return Valid","_","Big","_","Integer;","\n",' function "-" (L : Valid',"_","Big","_","Integer) return Valid","_","Big","_","Integer;","\n",' function "abs" (L : Valid',"_","Big","_","Integer) return Valid","_","Big","_","Integer;","\n",' function "+" (L, R : Valid',"_","Big","_","Integer) return Valid","_","Big","_","Integer;","\n",' function "-" (L, R : Valid',"_","Big","_","Integer) return Valid","_","Big","_","Integer;","\n",' function "',"*",'" (L, R : Valid',"_","Big","_","Integer) return Valid","_","Big","_","Integer;","\n",' function "/" (L, R : Valid',"_","Big","_","Integer) return Valid","_","Big","_","Integer;","\n",' function "mod" (L, R : Valid',"_","Big","_","Integer) return Valid","_","Big","_","Integer;","\n",' function "rem" (L, R : Valid',"_","Big","_","Integer) return Valid","_","Big","_","Integer;","\n",' function "',"*","*",'" (L : Valid',"_","Big","_","Integer; R : Natural)","\n"," return Valid","_","Big","_","Integer;","\n"," function Min (L, R : Valid","_","Big","_","Integer) return Valid","_","Big","_","Integer;","\n"," function Max (L, R : Valid","_","Big","_","Integer) return Valid","_","Big","_","Integer;","\n","\n",(0,r.jsx)(d.A,{children:"19/5_A.5.6"}),"\nfunction Greatest","_","Common","_","Divisor","\n"," (L, R : Valid","_","Big","_","Integer) return Big","_","Positive","\n"," with Pre =",">"," (L /= 0 and R /= 0) or else raise Constraint","_","Error;","\n","\n",(0,r.jsx)(d.A,{children:"20/5_A.5.6"}),"\nprivate","\n"," ... -- not specified by the language","\n","end Ada.Numerics.Big","_","Numbers.Big","_","Integers;","\n"]})]}),"\n",(0,r.jsx)(d.A,{children:"21/5_A.5.6"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1"]}),"\n",(0,r.jsxs)("p",{children:["To","_","String and From","_","String behave analogously to the Put and Get procedures defined in Text","_","IO.Integer","_","IO (in particular, with respect to the interpretation of the Width and Base parameters) except that Constraint","_","Error, not Data","_","Error, is propagated in error cases and the result of a call to To","_","String with a Width parameter of 0 and a nonnegative Arg parameter does not include a leading blank. Put","_","Image calls To","_","String (passing in the default values for the Width and Base parameters), prepends a leading blank if the argument is nonnegative, and writes the resulting value to the buffer using Text","_","Buffers.Put.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"22/5_A.5.6"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1"]}),"\n",(0,r.jsxs)("p",{children:["The other functions have their usual mathematical meanings.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"23/5_A.5.6"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1"]}),"\n",(0,r.jsxs)("p",{children:["The type Big","_","Integer needs finalization (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-7/AA-7.6",children:"7.6"}),"). ",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(n.h4,{id:"dynamic-semantics-2",children:"Dynamic Semantics"}),"\n",(0,r.jsx)(d.A,{children:"24/5_A.5.6"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1"]}),"\n",(0,r.jsxs)("p",{children:["For purposes of determining whether predicate checks are performed as part of default initialization, the type Big","_","Integer is considered to have a subcomponent that has a ",(0,r.jsx)("code",{children:(0,r.jsx)("a",{href:"/docs/arm/AA-3/AA-3.7#S0063",children:"default_expression"})}),".",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"24.a/5_A.5.6"}),(0,r.jsx)(h.A,{items:["AI12-0005-1","AI12-0208-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"ramification",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"This means that the elaboration of ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"24.b/5_A.5.6"}),(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["Default","_","Initialized","_","Object : Valid","_","Big","_","Integer;","\n"]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"24.c/5_A.5.6"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["either produces a value for which Is","_","Valid is True. or it propagates Program","_","Error. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(n.h4,{id:"implementation-requirements-2",children:"Implementation Requirements"}),"\n",(0,r.jsx)(d.A,{children:"25/5_A.5.6"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1"]}),"\n",(0,r.jsxs)("p",{children:["No storage associated with a Big","_","Integer object shall be lost upon assignment or scope exit.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"25.a/5_A.5.6"}),(0,r.jsx)(h.A,{items:["AI12-0208-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-note",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The \u201CNo storage ... shall be lost\u201D requirement does not preclude implementation techniques such as caching or unique number tables. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"extensions-to-ada-2012-2",children:"Extensions to Ada 2012"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"25.b/5_A.5.6"}),(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The package Numerics.Big","_","Numbers.Big","_","Integers is new. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)("a",{id:"Subclause_A.5.7"}),"\n",(0,r.jsx)(n.h2,{id:"a57--big-reals",children:"A.5.7 Big Reals"}),"\n",(0,r.jsx)(n.h4,{id:"static-semantics-7",children:"Static Semantics"}),"\n",(0,r.jsx)(d.A,{children:"1/5_A.5.7"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1"]}),"\n",(0,r.jsxs)("p",{children:["The library package Numerics.Big","_","Numbers.Big","_","Real
1s has the following declaration:",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"2/5_A.5.7"}),"\n",(0,r.jsxs)(l.A,{language:"ada",children:[(0,r.jsxs)(n.p,{children:["with Ada.Numerics.Big","_","Numbers.Big","_","Integers;","\n"," use all type Big","_","Integers.Big","_","Integer;","\n","with Ada.Strings.Text","_","Buffers;","\n","package Ada.Numerics.Big","_","Numbers.Big","_","Reals","\n"," with Preelaborate, Nonblocking, Global =",">"," in out synchronized is","\n","\n",(0,r.jsx)(d.A,{children:"3/5_A.5.7"})]}),(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1","AI12-0407-1"]}),(0,r.jsxs)(n.p,{children:["type Big","_","Real is private","\n"," with Real","_","Literal =",">"," From","_","Universal","_","Image,","\n"," Put","_","Image =",">"," Put","_","Image;","\n","\n",(0,r.jsx)(d.A,{children:"4/5_A.5.7"}),"\nfunction Is","_","Valid (Arg : Big","_","Real) return Boolean","\n"," with Convention =",">"," Intrinsic;","\n"]})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"4.a/5_A.5.7"}),(0,r.jsx)(h.A,{items:["AI12-0005-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"discussion",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The result of Is","_","Valid on a default-initialized object of type Big","_","Real is unspecified, analogous to the value of a Valid ",(0,r.jsx)("code",{children:(0,r.jsx)("a",{href:"/docs/arm/AA-4/AA-4.1#S0100",children:"attribute_reference"})})," applied to a default-initialized object of a real type (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-13/AA-13.9#Subclause_13.9.2",children:"13.9.2"}),"). The language-provided functions in the Big","_","Reals package only return values for which Is","_","Valid is certain to be True. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"5/5_A.5.7"}),"\n",(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["subtype Valid","_","Big","_","Real is Big","_","Real","\n"," with Dynamic","_","Predicate =",">"," Is","_","Valid (Valid","_","Big","_","Real),","\n"," Predicate","_","Failure =",">"," raise Program","_","Error;","\n","\n",(0,r.jsx)(d.A,{children:"6/5_A.5.7"}),'\nfunction "/" (Num, Den : Big',"_","Integers.Valid","_","Big","_","Integer)","\n"," return Valid","_","Big","_","Real","\n"," with Pre =",">"," Den /= 0","\n"," or else raise Constraint","_","Error;","\n","\n",(0,r.jsx)(d.A,{children:"7/5_A.5.7"}),"\nfunction Numerator","\n"," (Arg : Valid","_","Big","_","Real) return Big","_","Integers.Valid","_","Big","_","Integer","\n"," with Post =",">"," (if Arg = 0.0 then Numerator'Result = 0);","\n"]})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"7.a/5_A.5.7"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"reason",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The postcondition of Numerator cannot be complete as it cannot mention Denominator. Since the postcondition of Denominator uses Numerator, we would get an infinite mutual recursion if both postconditions are enabled. The postcondition of Denominator serves as the postcondition for Numerator as well unless Arg = 0.0. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(d.A,{children:"8/5_A.5.7"}),"\n",(0,r.jsxs)(l.A,{language:"ada",children:[(0,r.jsxs)(n.p,{children:["function Denominator (Arg : Valid","_","Big","_","Real)","\n"," return Big","_","Integers.Big","_","Positive","\n"," with Post =",">","\n"," (if Arg = 0.0 then Denominator'Result = 1","\n"," else Big","_","Integers.Greatest","_","Common","_","Divisor","\n"," (Numerator (Arg), Denominator'Result) = 1);","\n","\n",(0,r.jsx)(d.A,{children:"9/5_A.5.7"}),"\nfunction To","_","Big","_","Real (Arg : Big","_","Integers.Valid","_","Big","_","Integer)","\n"," return Valid","_","Big","_","Real is (Arg / 1);","\n","\n",(0,r.jsx)(d.A,{children:"10/5_A.5.7"}),"\nfunction To","_","Real (Arg : Integer) return Valid","_","Big","_","Real is","\n"," (Big","_","Integers.To","_","Big","_","Integer (Arg) / 1);","\n","\n",(0,r.jsx)(d.A,{children:"11/5_A.5.7"}),'\nfunction "=" (L, R : Valid',"_","Big","_","Real) return Boolean;
1","\n",' function "',"<",'" (L, R : Valid',"_","Big","_","Real) return Boolean;","\n",' function "',"<",'=" (L, R : Valid',"_","Big","_","Real) return Boolean;","\n",' function "',">",'" (L, R : Valid',"_","Big","_","Real) return Boolean;","\n",' function "',">",'=" (L, R : Valid',"_","Big","_","Real) return Boolean;","\n","\n",(0,r.jsx)(d.A,{children:"12/5_A.5.7"}),"\nfunction In","_","Range (Arg, Low, High : Valid","_","Big","_","Real) return Boolean is","\n"," (Low ","<","= Arg and Arg ","<","= High);","\n","\n",(0,r.jsx)(d.A,{children:"13/5_A.5.7"}),"\ngeneric","\n"," type Num is digits ","<",">",";","\n"," package Float","_","Conversions is","\n"," function To","_","Big","_","Real (Arg : Num) return Valid","_","Big","_","Real;","\n"," function From","_","Big","_","Real (Arg : Valid","_","Big","_","Real) return Num","\n"," with Pre =",">"," In","_","Range (Arg,","\n"," Low =",">"," To","_","Big","_","Real (Num'First),","\n"," High =",">"," To","_","Big","_","Real (Num'Last))","\n"," or else (raise Constraint","_","Error);","\n"," end Float","_","Conversions;","\n","\n",(0,r.jsx)(d.A,{children:"14/5_A.5.7"}),"\ngeneric","\n"," type Num is delta ","<",">",";","\n"," package Fixed","_","Conversions is","\n"," function To","_","Big","_","Real (Arg : Num) return Valid","_","Big","_","Real;","\n"," function From","_","Big","_","Real (Arg : Valid","_","Big","_","Real) return Num","\n"," with Pre =",">"," In","_","Range (Arg,","\n"," Low =",">"," To","_","Big","_","Real (Num'First),","\n"," High =",">"," To","_","Big","_","Real (Num'Last))","\n"," or else (raise Constraint","_","Error);","\n"," end Fixed","_","Conversions;","\n","\n",(0,r.jsx)(d.A,{children:"15/5_A.5.7"}),"\nfunction To","_","String (Arg : Valid","_","Big","_","Real;","\n"," Fore : Field := 2;","\n"," Aft : Field := 3;","\n"," Exp : Field := 0) return String","\n"," with Post =",">"," To","_","String'Result'First = 1;","\n","\n",(0,r.jsx)(d.A,{children:"16/5_A.5.7"}),"\nfunction From","_","String (Arg : String) return Valid","_","Big","_","Real;","\n","\n",(0,r.jsx)(d.A,{children:"17/5_A.5.7"})]}),(0,r.jsx)(h.A,{items:["AI12-0407-1"]}),(0,r.jsxs)(n.p,{children:["function From","_","Universal","_","Image (Arg : String) return Valid","_","Big","_","Real","\n"," renames From","_","String;","\n","\n",(0,r.jsx)(d.A,{children:"18/5_A.5.7"})]}),(0,r.jsx)(h.A,{items:["AI12-0407-1"]}),(0,r.jsxs)(n.p,{children:["function From","_","Universal","_","Image (Num, Den : String)","\n"," return Valid","_","Big","_","Real is","\n"," (Big","_","Integers.From","_","Universal","_","Image (Num) /","\n"," Big","_","Integers.From","_","Universal","_","Image (Den));","\n","\n",(0,r.jsx)(d.A,{children:"19/5_A.5.7"}),"\nfunction To","_","Quotient","_","String (Arg : Valid","_","Big","_","Real) return String is","\n"," (To","_",'String (Numerator (Arg)) & " / " & To',"_","String (Denominator (Arg)));","\n"," function From","_","Quotient","_","String (Arg : String) return Valid","_","Big","_","Real;","\n","\n",(0,r.jsx)(d.A,{children:"20/5_A.5.7"}),"\nprocedure Put","_","Image","\n"," (Buffer : in out Ada.Strings.Text","_","Buffers.Root","_","Buffer","_","Type'Class;","\n"," Arg : in Valid","_","Big","_","Real);","\n","\n",(0,r.jsx)(d.A,{children:"21/5_A.5.7"}),'\nfunction "+" (L : Valid',"_","Big","_","Real) return Valid","_","Big","_","Real;","\n",' function "-" (L : Valid',"_","Big","_","Real) return Valid","_","Big","_","Real;","\n",' function "abs" (L : Valid',"_","Big","_","Real) return Valid","_","Big","_","Real;","\n",' function "+" (L, R : Valid',"_","Big","_","Real) return Valid","_","Big","_","Real;","\n",' function "-" (L, R : Valid',"_","Big","_","Real) return Valid","_","Big","_","Real;","\n",' function "',"*",'" (L, R : Valid',"_","Big","_","Real) return Valid","_","Big","_","Real;","\n",' function "/" (L, R : Valid',"_","Big","_","Real) return Valid","_","Big","_","Real;","\n",' function "',"*","*",'" (L : Valid',"_","Big","_","Real; R : Integer)","\n"," return Valid","_","Big","_","Real;","\n"," function Min (L, R : Valid","_","Big","_","Real) return Valid","_","Big","_","Real;","\n"," function Max (L, R : Valid","_","Big","_","Real) return Valid","_","Big","_","Real;","\n","\n",(0,r.jsx)(d.A,{children:"22/5_A.5.7"}),"\nprivate","\n"," ... -- not specified by the language","\n","end Ada.Numerics.Big","_","Numbers.Big","_","Real
1s;","\n"]})]}),"\n",(0,r.jsx)(d.A,{children:"23/5_A.5.7"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1"]}),"\n",(0,r.jsxs)("p",{children:["To","_","String and From","_","String behave analogously to the Put and Get procedures defined in Text","_","IO.Float","_","IO (in particular, with respect to the interpretation of the Fore, Aft, and Exp parameters), except that Constraint","_","Error (not Data","_","Error) is propagated in error cases. From","_","Quotient","_","String implements the inverse function of To","_","Quotient","_","String; Constraint","_","Error is propagated in error cases. Put","_","Image calls To","_","String, and writes the resulting value to the buffer using Text","_","Buffers.Put.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"24/5_A.5.7"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1"]}),"\n",(0,r.jsxs)("p",{children:["For an instance of Float","_","Conversions or Fixed","_","Conversions, To","_","Big","_","Real is exact (that is, the result represents exactly the same mathematical value as the argument) and From","_","Big","_","Real is subject to the same precision rules as a type conversion of a value of type T to the target type Num, where T is a hypothetical floating point type whose model numbers include all of the model numbers of Num as well as the exact mathematical value of the argument.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"25/5_A.5.7"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1"]}),"\n",(0,r.jsxs)("p",{children:["The other functions have their usual mathematical meanings.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(d.A,{children:"26/5_A.5.7"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1"]}),"\n",(0,r.jsxs)("p",{children:["The type Big","_","Real needs finalization (see ",(0,r.jsx)("a",{href:"/docs/arm/AA-7/AA-7.6",children:"7.6"}),").",(0,r.jsx)("br",{})]}),"\n",(0,r.jsx)(n.h4,{id:"dynamic-semantics-3",children:"Dynamic Semantics"}),"\n",(0,r.jsx)(d.A,{children:"27/5_A.5.7"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1"]}),"\n",(0,r.jsxs)("p",{children:["For purposes of determining whether predicate checks are performed as part of default initialization, the type Big","_","Real is considered to have a subcomponent that has a ",(0,r.jsx)("code",{children:(0,r.jsx)("a",{href:"/docs/arm/AA-3/AA-3.7#S0063",children:"default_expression"})}),".",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"27.a/5_A.5.7"}),(0,r.jsx)(h.A,{items:["AI12-0005-1","AI12-0208-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"ramification",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"This means that the elaboration of ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"27.b/5_A.5.7"}),(0,r.jsx)(l.A,{language:"ada",children:(0,r.jsxs)(n.p,{children:["Default","_","Initialized","_","Object : Valid","_","Big","_","Real;","\n"]})})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"27.c/5_A.5.7"}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["either produces a value for which Is","_","Valid is True. or it propagates Program","_","Error. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(n.h4,{id:"implementation-requirements-3",children:"Implementation Requirements"}),"\n",(0,r.jsx)(d.A,{children:"28/5_A.5.7"}),"\n",(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1"]}),"\n",(0,r.jsxs)("p",{children:["No storage associated with a Big","_","Real object shall be lost upon assignment or scope exit.",(0,r.jsx)("br",{})]}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"28.a/5_A.5.7"}),(0,r.jsx)(h.A,{items:["AI12-0208-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"implementation-note",children:(0,r.jsxs)(n.p,{children:[(0,r.jsx)("b",{}),"The \u201CNo storage ... shall be lost\u201D requirement does not preclude implementation techniques such as caching or unique number tables. ",(0,r.jsx)("br",{})]})})]}),"\n",(0,r.jsx)(o.A,{children:(0,r.jsx)(n.h4,{id:"extensions-to-ada-2012-3",children:"Extensions to Ada 2012"})}),"\n",(0,r.jsxs)(o.A,{children:[(0,r.jsx)(d.A,{children:"28.b/5_A.5.7"}),(0,r.jsx)(h.A,{items:["AI12-0208-1","AI12-0366-1"]}),(0,r.jsx)(a.A,{type:"aarm",aarm:"note",children:(0,r.jsxs)(n.p,{children:["The package Numerics.Big","_","Numbers.Big","_","Real
1s is new. ",(0,r.jsx)("br",{})]})})]})]})}function A(e={}){let{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(m,{...e})}):m(e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.