Ada: standing declaration

I read Norman Cohen Ada's book 95 and on page 129 we have regular announcements:

 Pi: constant Float := 3.1415926536

and

Pi: constant := 3.1415926536

The second declaration is considered interpreted as, I quote: "any floating point type with a fixed point with an appropriate range." My question is that one works with Long_Float precision, then, for example, to declare a constant, say, 2 * PI, you need to specifically declare how

Two_Pi : CONSTANT Long_Float := 2.0 * 3.1415926536

or much better:

Two_Pi: CONSTANT Long_Float :=  2.0 * Ada.Numerics.Pi;

(second declaration to use more digits after the decimal point)?

Will be

Two_Pi : CONSTANT := 2.0 * 3.1415926536   

or better yet

Two_Pi: CONSTANT  :=  2.0 * Ada.Numerics.Pi;

, , Ada , , Two_Pi Long_Float, ? Pi 3.1415926536 Long_Float ( ), , i.e.

Two_Pi: CONSTANT  :=  2.0 * Ada.Numerics.Pi;

, , Two_Pi Long_Float. ? ,

Two_Pi: CONSTANT  :=  2.0 * Ada.Numerics.Pi;

Float, .

...

+3
1

Number Declarations,

Two_Pi : constant := 2.0 * Ada.Numerics.Pi;

. universal " , , (. 8.6).

: universal, " ." , Two_Pi Float, Long_Float , universal_real.

Ada binding GNU GMP MPFR.

: GNU Ada, example.

+2
source

Source: https://habr.com/ru/post/1753135/


All Articles