Jump to content

Ada Programming/Delimiters/**

From Wikibooks, open books for an open world

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

Operator

[edit | edit source]

Standard Operations

[edit | edit source]

Arithmetic Power of

[edit | edit source]

The "**" operator is defined as arithmetic power of for all numeric types.

function "**" (Left : T; Right : Integer) return T;
Usage
[edit | edit source]
A : constant Float   := 5.0 ** 2;  -- A is now 25.0
B : constant Integer := 5 ** 2;    -- B is also 25
Working Example
[edit | edit source]
File: operator_power.adb (view, plain text, download page, browse all)
with Ada.Text_IO;

procedure Operator_Power is
   A : constant Float   := 5.0 ** 2;  -- A is now 25.0
   B : constant Integer := 5 ** 2;    -- B is also 25

   package T_IO renames Ada.Text_IO;
   package F_IO is new  Ada.Text_IO.Float_IO (Float);
   package I_IO is new  Ada.Text_IO.Integer_IO (Integer);

begin
   T_IO.Put ("A = ");
   F_IO.Put (
      Item => A,
      Fore => 3,
      Aft  => 1,
      Exp  => 0);
   T_IO.New_Line;
   T_IO.Put ("B = ");
   I_IO.Put (
      Item  => B,
      Width => 3,
      Base  => 10);
   T_IO.New_Line;
end Operator_Power;

See also

[edit | edit source]

Wikibook

[edit | edit source]

Ada 95 Reference Manual

[edit | edit source]

Ada 2005 Reference Manual

[edit | edit source]



Ada Operators
and and then > + abs &
or or else >= - mod
xor = < * rem in
not /= <= ** / not in