From 2f0dc0b943706d1d6225d7aa41af2901b53db110 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Fri, 19 Dec 2025 14:46:03 +0100 Subject: [PATCH 1/2] Editorial change: correcting terminology --- content/courses/advanced-ada/parts/data_types/numerics.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/courses/advanced-ada/parts/data_types/numerics.rst b/content/courses/advanced-ada/parts/data_types/numerics.rst index 5bce2349c..bc073d089 100644 --- a/content/courses/advanced-ada/parts/data_types/numerics.rst +++ b/content/courses/advanced-ada/parts/data_types/numerics.rst @@ -973,7 +973,7 @@ are universal fixed types. It's possible to implement custom :ada:`*` and :ada:`/` operators for fixed-point types. However, those operators do **not** override the - corresponding operators for universal fixed-point types. For example: + corresponding operators for universal fixed types. For example: .. code:: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics.Universal_Types.Fixed_Point_Custom_Multiplication @@ -1060,7 +1060,7 @@ are universal fixed types. operator, we're indeed overriding the default :ada:`+` operator of the :ada:`TQ31` type in the :ada:`Normalized_Fixed_Point_Types` because the addition operator is associated with its corresponding fixed-point type, - not with the universal fixed-point type. In the + not with the universal fixed type. In the :ada:`Q31_A := Q31_A * Q31_B` statement, we see at runtime (through the "=> Custom non-overriding '*'" message) that the custom multiplication is being used. From e8b52b525c80f33a328df15a28dcd15f04c21dc6 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Fri, 19 Dec 2025 14:47:20 +0100 Subject: [PATCH 2/2] Improving description of "small" --- .../parts/data_types/numerics.rst | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/content/courses/advanced-ada/parts/data_types/numerics.rst b/content/courses/advanced-ada/parts/data_types/numerics.rst index bc073d089..fd6f7822a 100644 --- a/content/courses/advanced-ada/parts/data_types/numerics.rst +++ b/content/courses/advanced-ada/parts/data_types/numerics.rst @@ -3140,13 +3140,20 @@ In this example, we see the values for the compiler-selected *small* and the *delta* of type :ada:`Ordinary_Fixed_Point`. (Both are 0.25.) When we declare a fixed-point data type, we must specify the *delta*. In -contrast, providing a *small* in the type declaration is optional. +contrast, providing a *small* in the type declaration is optional for +ordinary fixed-point data types, but forbidden for decimal fixed-point types. -When the *small* isn't specified, it is automatically selected by the compiler. -In this case, the actual value of the *small* is an implementation-defined +By default, the compiler automatically selects the *small*: this value is a power of ten for decimal fixed-point types and a power of two for ordinary -fixed-point types. Again, the selected value always follows the rule that the -*small* must be smaller or equal to the delta. For example: +fixed-point types. Also, for ordinary fixed-point types, we can specify the +*small* by using the :ada:`Small` aspect. + +.. todo:: + + Add link to subsection on :ada:`Small` aspect once available. + +As we mentioned before, the selected value for the *small* always follows the +rule that it must be smaller or equal to the *delta*. For example: .. code:: ada run_button project=Courses.Advanced_Ada.Data_Types.Numerics.Fixed_Point_Types.Fixed_Small_Delta @@ -3170,17 +3177,6 @@ fixed-point types. Again, the selected value always follows the rule that the In this example, the *delta* that we specifed for :ada:`Ordinary_Fixed_Point` is 0.2, while the compiler-selected *small* is 2.0\ :sup:`-3`. -If we want to specify the *small*, we can use the :ada:`Small` aspect. (we'll -see this aspect again later on.) - -.. todo:: - - Add link to subsection on :ada:`Small` aspect once available. - -However, we can only do so for ordinary fixed-point types: for decimal -fixed-point types, the *small* is automatically selected by the compiler, and -it's always equal to the *delta*. - .. admonition:: For further reading... As we've mentioned, the small and the delta need not actually be small