@@ -24,7 +24,7 @@ universal integer value. Let's get the modulus of the 32-bit :ada:`Modular`
2424type that we've declared in the :ada: `Num_Types ` package of the previous
2525chapter:
2626
27- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Modular_Types.Modular_1
27+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Modular_Types.Modular_1
2828
2929 package Num_Types is
3030
@@ -43,7 +43,8 @@ chapter:
4343 Put_Line (Modulus_Value'Image);
4444 end Show_Modular;
4545
46- When we run this example, we get 4294967296, which is equal to :ada: `2**32 `.
46+ When we run this example, we get 4,294,967,296 |mdash | which is equal to
47+ :ada: `2**32 `.
4748
4849:ada: `Mod ` Attribute
4950~~~~~~~~~~~~~~~~~~~~
@@ -69,7 +70,7 @@ be something like :ada:`-2**31 .. 2**31 - 1`. (Note: we discussed the
6970Operations on modular integers use modular (wraparound) arithmetic. For
7071example:
7172
72- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Modular_Types.Modular_1
73+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Modular_Types.Modular_1
7374
7475 with Ada.Text_IO; use Ada.Text_IO;
7576
@@ -94,7 +95,7 @@ wrap around)? The answer in Ada is the former |mdash| that is, if you try to
9495convert, say, :ada: `Integer'(-1) ` to :ada: `Modular `, you will get
9596:ada: `Constraint_Error `:
9697
97- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Modular_Types.Modular_1
98+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Modular_Types.Modular_1
9899 :class: ada-run-expect-failure
99100
100101 with Ada.Text_IO; use Ada.Text_IO;
@@ -111,7 +112,7 @@ convert, say, :ada:`Integer'(-1)` to :ada:`Modular`, you will get
111112
112113To solve this problem, we can use the :ada: `Mod ` attribute:
113114
114- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Modular_Types.Modular_1
115+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Modular_Types.Modular_1
115116
116117 with Ada.Text_IO; use Ada.Text_IO;
117118
@@ -140,7 +141,7 @@ given modular type, using wraparound semantics.
140141 The :ada: `Mod ` attribute was added to Ada 2005 to solve this problem.
141142 Also, we can now safely use this attribute in generics. For example:
142143
143- .. code :: ada compile_button project=Courses.Advanced_Ada.Data_Types.Numerics .Modular_Types.Mod_Attribute
144+ .. code :: ada compile_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Modular_Types.Mod_Attribute
144145
145146 generic
146147 type Formal_Modular is mod <>;
@@ -180,7 +181,7 @@ performed.
180181
181182Let's see a simple implementation of the CRC-CCITT (0x1D0F) algorithm:
182183
183- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Modular_Types.Mod_Crc_CCITT_Ada
184+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Modular_Types.Mod_Crc_CCITT_Ada
184185
185186 package Crc_Defs is
186187
@@ -298,7 +299,7 @@ Attribute: :ada:`Machine_Radix`
298299:ada: `Machine_Radix ` is an attribute that returns the radix of the hardware
299300representation of a type. For example:
300301
301- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Machine_Radix
302+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Machine_Radix
302303
303304 with Ada.Text_IO; use Ada.Text_IO;
304305
@@ -324,7 +325,7 @@ Attributes: :ada:`Machine_Mantissa`
324325:ada: `Machine_Mantissa ` is an attribute that returns the number of bits
325326reserved for the mantissa of the floating-point type. For example:
326327
327- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Machine_Mantissa
328+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Machine_Mantissa
328329
329330 with Ada.Text_IO; use Ada.Text_IO;
330331
@@ -352,7 +353,7 @@ and maximum value, respectively, of the machine exponent the floating-point
352353type. Note that, in all cases, the returned value is a universal integer. For
353354example:
354355
355- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Machine_Emin_Emax
356+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Machine_Emin_Emax
356357
357358 with Ada.Text_IO; use Ada.Text_IO;
358359
@@ -405,7 +406,7 @@ Attribute: :ada:`Digits`
405406:ada: `Digits ` is an attribute that returns the requested decimal precision of
406407a floating-point subtype. Let's see an example:
407408
408- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Digits
409+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Digits
409410
410411 with Ada.Text_IO; use Ada.Text_IO;
411412
@@ -425,7 +426,7 @@ Note that we said that :ada:`Digits` is the *requested* level of precision,
425426which is specified as part of declaring a floating point type. We can retrieve
426427the actual decimal precision with :ada: `Base'Digits `. For example:
427428
428- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Base_Digits
429+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Base_Digits
429430
430431 with Ada.Text_IO; use Ada.Text_IO;
431432
@@ -462,7 +463,7 @@ indicating whether a feature is available or not in the target architecture:
462463 :ada: `Constraint_Error ` exception is (or is not) guaranteed to be raised
463464 when an operation with that type produces an overflow or divide-by-zero.
464465
465- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Machine_Rounds_Overflows
466+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Machine_Rounds_Overflows
466467
467468 with Ada.Text_IO; use Ada.Text_IO;
468469
@@ -541,7 +542,7 @@ floating-point value:
541542
542543Let's see some examples:
543544
544- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Exponent_Fraction
545+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Exponent_Fraction
545546
546547 with Ada.Text_IO; use Ada.Text_IO;
547548
@@ -600,7 +601,7 @@ Attribute: :ada:`Scaling`
600601:ada: `Scaling ` is an attribute that scales a floating-point value based on the
601602machine radix and a machine exponent passed to the function. For example:
602603
603- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Scaling
604+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Scaling
604605
605606 with Ada.Text_IO; use Ada.Text_IO;
606607
@@ -629,7 +630,7 @@ Round-up and round-down attributes
629630:ada: `Floor ` and :ada: `Ceiling ` are attributes that returned the rounded-down
630631or rounded-up value, respectively, of a floating-point value. For example:
631632
632- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Floor_Ceiling
633+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Floor_Ceiling
633634
634635 with Ada.Text_IO; use Ada.Text_IO;
635636
@@ -655,7 +656,7 @@ is the closest integer value.
655656
656657Let's see a code example:
657658
658- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Rounding
659+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Rounding
659660
660661 with Ada.Text_IO; use Ada.Text_IO;
661662
@@ -752,7 +753,7 @@ second parameter is the :ada:`Towards` value.
752753
753754Let's see a code example:
754755
755- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Truncation_Remainder
756+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Truncation_Remainder
756757
757758 with Ada.Text_IO; use Ada.Text_IO;
758759
@@ -837,7 +838,7 @@ mantissa. Let's see some examples:
837838
838839Let's see some examples:
839840
840- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Sign_Leading
841+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Sign_Leading
841842
842843 with Ada.Text_IO; use Ada.Text_IO;
843844
@@ -879,7 +880,7 @@ Not every real number is directly representable as a floating-point value on a
879880specific machine. For example, let's take a value such as 1.0 x 10\ :sup: `15`
880881(or 1,000,000,000,000,000):
881882
882- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Float_Value
883+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Float_Value
883884
884885 with Ada.Text_IO; use Ada.Text_IO;
885886
@@ -932,7 +933,7 @@ the difference between the original real value in our example
932933(1.0 x 10\ :sup: `15`) and the actual value that is assigned to :ada: `V `. We can
933934do this by using the :ada: `Machine ` attribute in the calculation:
934935
935- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Machine_Attribute
936+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Machine_Attribute
936937
937938 with Ada.Text_IO; use Ada.Text_IO;
938939
@@ -1028,7 +1029,7 @@ This is the reason why we see 1.3008896 x 10\ :sup:`7` instead of
10281029
10291030 Let's see an example:
10301031
1031- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Model_Mantissa
1032+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Model_Mantissa
10321033
10331034 with Ada.Text_IO; use Ada.Text_IO;
10341035
@@ -1075,7 +1076,7 @@ This is the reason why we see 1.3008896 x 10\ :sup:`7` instead of
10751076
10761077 Let's see some examples:
10771078
1078- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Model_Epsilon_Small
1079+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Model_Epsilon_Small
10791080
10801081 with Ada.Text_IO; use Ada.Text_IO;
10811082
@@ -1118,7 +1119,7 @@ This is the reason why we see 1.3008896 x 10\ :sup:`7` instead of
11181119 value in 1.0 x 10\ :sup: `15` and the actual model value, we can use the
11191120 :ada: `Model ` attribute:
11201121
1121- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Model_Attribute
1122+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Model_Attribute
11221123
11231124 with Ada.Text_IO; use Ada.Text_IO;
11241125
@@ -1169,7 +1170,7 @@ This is the reason why we see 1.3008896 x 10\ :sup:`7` instead of
11691170 Let's see a code example with these attributes and compare them to the
11701171 :ada: `First ` and :ada: `Last ` attributes:
11711172
1172- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Floating_Point_Types.Safe_First_Last
1173+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Floating_Point_Types.Safe_First_Last
11731174
11741175 with Ada.Text_IO; use Ada.Text_IO;
11751176
@@ -1229,7 +1230,7 @@ Attribute: :ada:`Machine_Radix`
12291230:ada: `Machine_Radix ` is an attribute that returns the radix of the hardware
12301231representation of a type. For example:
12311232
1232- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Fixed_Point_Types.Fixed_Machine_Radix
1233+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Fixed_Point_Types.Fixed_Machine_Radix
12331234
12341235 with Ada.Text_IO; use Ada.Text_IO;
12351236
@@ -1265,7 +1266,7 @@ indicating whether a feature is available or not in the target architecture:
12651266 :ada: `Constraint_Error ` is guaranteed to be raised when a fixed-point
12661267 operation with that type produces an overflow or divide-by-zero.
12671268
1268- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Fixed_Point_Types.Fixed_Machine_Rounds_Overflows
1269+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Fixed_Point_Types.Fixed_Machine_Rounds_Overflows
12691270
12701271 with Ada.Text_IO; use Ada.Text_IO;
12711272
@@ -1314,7 +1315,7 @@ it's automatically selected by the compiler, and it's always equal to the
13141315
13151316Let's see an example:
13161317
1317- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Fixed_Point_Types.Fixed_Small_Delta
1318+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Fixed_Point_Types.Fixed_Small_Delta
13181319
13191320 package Fixed_Small_Delta is
13201321 D3 : constant := 10.0 ** (-3);
@@ -1386,7 +1387,7 @@ In the case of the :ada:`TQ15` type, we're specifying the *small* by using the
13861387type is 32 bits, while the precision we get when operating with this type is
1387138816 bits. Let's see a specific example for this type:
13881389
1389- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Fixed_Point_Types.Fixed_Small_Delta
1390+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Fixed_Point_Types.Fixed_Small_Delta
13901391
13911392 with Ada.Text_IO; use Ada.Text_IO;
13921393
@@ -1431,7 +1432,7 @@ precise:
14311432
14321433Let's see an example:
14331434
1434- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Fixed_Point_Types.Fixed_Fore_Aft
1435+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Fixed_Point_Types.Fixed_Fore_Aft
14351436
14361437 with Ada.Text_IO; use Ada.Text_IO;
14371438
@@ -1485,7 +1486,7 @@ use for the :ada:`digits` in the definition of a decimal fixed-point type.
14851486
14861487Let's see an example:
14871488
1488- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Fixed_Point_Types.Decimal_Digits
1489+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Fixed_Point_Types.Decimal_Digits
14891490
14901491 with Ada.Text_IO; use Ada.Text_IO;
14911492
@@ -1527,7 +1528,7 @@ of :ada:`T'Scale` is three.
15271528
15281529Let's look at this complete example:
15291530
1530- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Fixed_Point_Types.Decimal_Scale
1531+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Fixed_Point_Types.Decimal_Scale
15311532
15321533 with Ada.Text_IO; use Ada.Text_IO;
15331534
@@ -1570,7 +1571,7 @@ value, while the returned value is of :ada:`S'Base` type.
15701571
15711572Let's look at this example:
15721573
1573- .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics .Fixed_Point_Types.Decimal_Round
1574+ .. code :: ada run_button project=Courses.Advanced_Ada.Data_Types.Numeric_Attributes .Fixed_Point_Types.Decimal_Round
15741575
15751576 with Ada.Text_IO; use Ada.Text_IO;
15761577
0 commit comments