1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>AARM95 - Model-Oriented Attributes of Floating Point Types</TITLE>
<META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
<META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
<STYLE type="text/css">
DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
TT {font-family: "Courier New", monospace}
DT {display: compact}
DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
DIV.Index {font-family: "Times New Roman", Times, serif}
DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left: 10.0em; margin-bottom: 0.6em}
DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 15.0em; margin-bottom: 0.6em}
UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
DD.Hanging {margin-left: 6.0em}
DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.IndentedHanging {margin-left: 2.0em}
DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.HangingInBulleted {margin-left: 4.0em}
DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.SmallHanging {margin-left: 7.5em}
DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.SmallIndentedHanging {margin-left: 2.0em}
DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.SmallHangingInBulleted {margin-left: 5.0em}
DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.Enumerated {margin-left: 2.0em}
DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.SmallEnumerated {margin-left: 2.5em}
DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
</STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-G-2-1.html">Previous</A> <A HREF="AA-G-2-3.html">Next</A></P>
<HR>
<H1> G.2.2 Model-Oriented Attributes of Floating Point Types</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal"> In implementations that support the Numerics Annex,
the model-oriented attributes of floating point types shall yield the
values defined here, in both the strict and the relaxed modes. These
definitions add conditions to those in <A HREF="AA-A-5-3.html">A.5.3</A>.
</DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> For every subtype
S of a floating point type <I>T</I>: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DL Class="Hanging"><DT> S'<A NAME="I7263"></A>Model_Mantissa <DD Class="Hanging">
Yields the number of digits in the mantissa of the canonical form of
the model numbers of <I>T</I> (see <A HREF="AA-A-5-3.html">A.5.3</A>).
The value of this attribute shall be greater than or equal to <I>Ceiling</I>(<I>d</I>
· log(10) / log(<I>T</I>'Machine_Radix)) + 1, where <I>d</I> is
the requested decimal precision of <I>T</I>. In addition, it shall be
less than or equal to the value of <I>T</I>'Machine_Mantissa. This attribute
yields a value of the type <I>universal_integer</I>. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>3.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>S'Model_Epsilon,
which is defined in terms of S'Model_Mantissa (see <A HREF="AA-A-5-3.html">A.5.3</A>),
yields the absolute value of the difference between one and the next
model number of the type <I>T</I> above one. It is equal to or larger
than the absolute value of the difference between one and the next machine
number of the type <I>T</I> above one. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DL Class="Hanging"><DT> S'<A NAME="I7264"></A>Model_Emin <DD Class="Hanging">
Yields the minimum exponent of the canonical form of the model numbers
of <I>T</I> (see <A HREF="AA-A-5-3.html">A.5.3</A>). The value of this
attribute shall be greater than or equal to the value of <I>T</I>'Machine_Emin.
This attribute yields a value of the type <I>universal_integer</I>. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>4.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>S'Model_Small,
which is defined in terms of S'Model_Emin (see <A HREF="AA-A-5-3.html">A.5.3</A>),
yields the smallest positive (nonzero) model number of the type <I>T</I>.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DL Class="Hanging"><DT> S'<A NAME="I7265"></A>Safe_First <DD Class="Hanging">
Yields the lower bound of the safe range of <I>T</I>. The value of this
attribute shall be a model number of <I>T</I> and greater than or equal
to the lower bound of the base range of <I>T</I>. In addition, if <I>T</I>
is declared by a <FONT FACE="Arial, Helvetica">floating_point_definition</FONT>
or is derived from such a type, and the <FONT FACE="Arial, Helvetica">floating_point_definition</FONT>
includes a <FONT FACE="Arial, Helvetica">real_range_specification</FONT>
specifying a lower bound of <I>lb</I>, then the value of this attribute
shall be less than or equal to <I>lb</I>; otherwise, it shall be less
than or equal to -10.0 <SUP><FONT SIZE=+1><FONT SIZE=-2>4 · <I>d</I></FONT></FONT></SUP>,
where <I>d</I> is the requested decimal precision of <I>T</I>. This attribute
yields a value of the type <I>universal_real</I>.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DL Class="Hanging"><DT> S'<A NAME="I7266"></A>Safe_Last <DD Class="Hanging">
Yields the upper bound of the safe range of <I>T</I>. The value of this
attribute shall be a model number of <I>T</I> and less than or equal
to the upper bound of the base range of <I>T</I>. In addition, if <I>T</I>
is declared by a <FONT FACE="Arial, Helvetica">floating_point_definition</FONT>
or is derived from such a type, and the <FONT FACE="Arial, Helvetica">floating_point_definition</FONT>
includes a <FONT FACE="Arial, Helvetica">real_range_specification</FONT>
specifying an upper bound of <I>ub</I>, then the value of this attribute
shall be greater than or equal to <I>ub</I>; otherwise, it shall be greater
than or equal to 10.0 <SUP><FONT SIZE=+1><FONT SIZE=-2>4 · <I>d</I></FONT></FONT></SUP>,
where d is the requested decimal precision of <I>T</I>. This attribute
yields a value of the type <I>universal_real</I>.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DL Class="Hanging"><DT> <A NAME="I7267"></A>S'<A NAME="I7268"></A>Model <DD Class="Hanging">
Denotes a function (of a parameter <I>X</I>) whose specification is given
in <A HREF="AA-A-5-3.html">A.5.3</A>. If <I>X</I> is a model number of
<I>T</I>, the function yields <I>X</I>; otherwise, it yields the value
obtained by rounding or truncating <I>X</I> to either one of the adjacent
model numbers of <I>T</I>. <A NAME="I7269"></A><A NAME="I7270"></A>Constraint_Error
is raised if the resulting model number is outside the safe range of
S. A zero result has the sign of <I>X</I> when S'Signed_Zeros is True.
</DL>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> Subject to the constraints
given above, the values of S'Model_Mantissa and S'Safe_Last are to be
maximized, and the values of S'Model_Emin and S'Safe_First minimized,
by the implementation as follows: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>First, S'Model_Mantissa is set to the largest value for
which values of S'Model_Emin, S'Safe_First, and S'Safe_Last can be chosen
so that the implementation satisfies the strict-mode requirements of
<A HREF="AA-G-2-1.html">G.2.1</A> in terms of the model numbers and safe
range induced by these attributes.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Next, S'Model_Emin is set to the smallest value for which
values of S'Safe_First and S'Safe_Last can be chosen so that the implementation
satisfies the strict-mode requirements of <A HREF="AA-G-2-1.html">G.2.1</A>
in terms of the model numbers and safe range induced by these attributes
and the previously determined value of S'Model_Mantissa.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Finally, S'Safe_First and S'Safe_last are set (in either
order) to the smallest and largest values, respectively, for which the
implementation satisfies the strict-mode requirements of <A HREF="AA-G-2-1.html">G.2.1</A>
in terms of the model numbers and safe range induced by these attributes
and the previously determined values of S'Model_Mantissa and S'Model_Emin.
</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>11.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B><A NAME="I7271"></A><A NAME="I7272"></A>The
following table shows appropriate attribute values for IEEE basic single
and double precision types (ANSI/IEEE Std 754-1985, IEC 559:1989). Here,
we use the names IEEE_Float_32 and IEEE_Float_64, the names that would
typically be declared in package Interfaces, in an implementation that
supports IEEE arithmetic. In such an implementation, the attributes would
typically be the same for Standard.Float and Long_Float, respectively.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11.b</FONT></DIV>
<DIV Class="SmallExamples"><TT>Attribute IEEE_Float_32 IEEE_Float_64</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11.c</FONT></DIV>
<DIV Class="SmallExamples"><TT>'Machine_Radix 2 2<BR>
'Machine_Mantissa 24 53<BR>
'Machine_Emin -125 -1021<BR>
'Machine_Emax 128 1024<BR>
'Denorm True True<BR>
'Machine_Rounds True True<BR>
'Machine_Overflows True/False True/False<BR>
'Signed_Zeros should be True should be True</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11.d</FONT></DIV>
<DIV Class="SmallExamples"><TT>'Model_Mantissa (same as 'Machine_Mantissa) (same as 'Machine_Mantissa)<BR>
'Model_Emin (same as 'Machine_Emin) (same as 'Machine_Emin)<BR>
'Model_Epsilon 2.0**(-23) 2.0**(-52)<BR>
'Model_Small 2.0**(-126) 2.0**(-1022)<BR>
'Safe_First -2.0**128*(1.0-2.0**(-24)) -2.0**1024*(1.0-2.0**(-53))<BR>
'Safe_Last 2.0**128*(1.0-2.0**(-24)) 2.0**1024*(1.0-2.0**(-53))</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11.e</FONT></DIV>
<DIV Class="SmallExamples"><TT>'Digits 6 15<BR>
'Base'Digits (same as 'Digits) (same as 'Digits)</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11.f</FONT></DIV>
<DIV Class="SmallExamples"><TT>'First (same as 'Safe_First) (same as 'Safe_First)<BR>
'Last (same as 'Safe_Last) (same as 'Safe_Last)<BR>
'Size 32 64</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11.g</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Note: 'Machine_Overflows can be
True or False, depending on whether the Ada implementation raises Constraint_Error
or delivers a signed infinity in overflow and zerodivide situations (and
at poles of the elementary functions).</FONT></DIV>
<HR>
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-G-2-1.html">Previous</A> <A HREF="AA-G-2-3.html">Next</A> <A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>
|