Hi, I'm reading Norman Cohen's Ada 95 book and on page 129 we have the constant declarations:
Pi: constant Float := 3.1415926536
and
Pi: constant := 3.1415926536
The second declaration is said to be interpreted as, I quote: "any floating-point of fixed-point type with the appropriate range". My question is say one is working with Long_Float precision, then for example to declare a constant say 2*PI do one has to specifically declare like
Two_Pi : CONSTANT Long_Float := 2.0 * 3.1415926536
or much better still:
Two_Pi: CONSTANT Long_Float := 2.0 * Ada.Numerics.Pi;
(the second declaration to take advantage of more digits after the decimal point) ?
Would
Two_Pi : CONSTANT := 2.0 * 3.1415926536
or better still
Two_Pi: CONSTANT := 2.0 * Ada.Numerics.Pi;
be as good as the book claims so that the Ada compiler would know for instance if I'm using Two_Pi in a Long_Float calculation, then the compiler would supply the required number of precision digits? Since the Pi value 3.1415926536 is not of Long_Float type (as it has fewer precision digits), I guess that the last declaration i.e.
Two_Pi: CONSTANT := 2.0 * Ada.Numerics.Pi;
would be all that is required if I need Two_Pi in a Long_Float calculation. Am I understanding right? With a similar understanding, then
Two_Pi: CONSTANT := 2.0 * Ada.Numerics.Pi;
would be relevant also in a Float type calculation and the compiler would supply only the required number of precision digits.
Thanks a lot...