Ada Programming/Attributes/'Machine Emax
Description
X'Machine_Emax 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_Emax returns the largest exponent.
Example
withAda.Text_IO;procedureMachine_EmaxispackageT_IOrenamesAda.Text_IO;packageI_IOisnewAda.Text_IO.Integer_IO (Integer);beginT_IO.Put ("Emax of Float type = "); I_IO.Put (Float'); T_IO.New_Line; T_IO.Put ("Emax of Long_Float type = "); I_IO.Put (Long_Float'); T_IO.New_Line;endMachine_Emax;
The output with GNAT 4.6 on the x86-64 architecture is:
Emax of Float type = 128 Emax of Long_Float type = 1024
See also
Wikibook
- Ada Programming
- Ada Programming/Attributes
- Ada Programming/Attributes/'Machine_Emin
- Ada Programming/Attributes/'Machine_Mantissa
- Ada Programming/Attributes/'Machine_Radix