Ada Programming/Attributes/'Machine Emin


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

Description

edit

X'Machine_Emin is an Ada attribute where X is any floating point type.

Floating point types are represented as:

 

where

sign is 1 or -1
mantissa is a fraction in base radix
radix is the hardware radix (usually 2)
exponent is an integer

'Machine_Emin returns the smallest exponent.

Example

edit
with Ada.Text_IO;

procedure Machine_Emin is

   package T_IO renames Ada.Text_IO;
   package I_IO is new  Ada.Text_IO.Integer_IO (Integer);
begin
   T_IO.Put ("Emin of Float type       = ");
   I_IO.Put (Float'Machine_Emin);
   T_IO.New_Line;
   
   T_IO.Put ("Emin of Long_Float type  = ");
   I_IO.Put (Long_Float'Machine_Emin);
   T_IO.New_Line;

end Machine_Emin;

The output with GNAT 4.6 on the x86-64 architecture is:

Emin of Float type       =        -125
Emin of Long_Float type  =       -1021

See also

edit

Wikibook

edit

Ada Reference Manual

edit