Skip to content

Commit d663ca6

Browse files
authored
Merge pull request #1245 from gusthoff/advanced_ada/new_content/numerics/discrete_numeric_types/20250706
Adding section on discrete numeric types
2 parents 905d360 + 463a0e3 commit d663ca6

File tree

2 files changed

+605
-25
lines changed

2 files changed

+605
-25
lines changed

content/courses/advanced-ada/parts/data_types/numeric_attributes.rst

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,6 @@ Numeric Attributes
88
Attributes of Modular Types
99
---------------------------
1010

11-
In the Introduction to Ada course, we've seen that Ada has two kinds of integer
12-
type: :ref:`signed <Intro_Ada_Integers>` and
13-
:ref:`modular <Intro_Ada_Unsigned_Types>` types. For example:
14-
15-
.. code:: ada compile_button project=Courses.Advanced_Ada.Data_Types.Numerics.Modular_Types.Modular_1
16-
17-
package Num_Types is
18-
19-
type Signed_Integer is range 1 .. 1_000_000;
20-
type Modular is mod 2**32;
21-
22-
end Num_Types;
23-
2411
In this section, we discuss two attributes of modular types: :ada:`Modulus`
2512
and :ada:`Mod`. We also discuss operations on modular types.
2613

@@ -35,10 +22,17 @@ and :ada:`Mod`. We also discuss operations on modular types.
3522
The :ada:`Modulus` attribute returns the modulus of the modular type as a
3623
universal integer value. Let's get the modulus of the 32-bit :ada:`Modular`
3724
type that we've declared in the :ada:`Num_Types` package of the previous
38-
example:
25+
chapter:
3926

4027
.. code:: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics.Modular_Types.Modular_1
4128

29+
package Num_Types is
30+
31+
type Signed_Integer is range 1 .. 1_000_000;
32+
type Modular is mod 2**32;
33+
34+
end Num_Types;
35+
4236
with Ada.Text_IO; use Ada.Text_IO;
4337

4438
with Num_Types; use Num_Types;

0 commit comments

Comments
 (0)