Ada Programming/Attributes/'Machine Radix

Description
X'Machine_Radix is an Ada attribute where X is any floating or fixed point type. It returns the radix of the hardware representation of type X. On most machines this will be 2.

Machine_Radix is also an Ada aspect that may be set for decimal fixed point types via an attribute definition clause. The value is constrained to either 2 or 10.

Example
Machine_Radix AdaText_IO AdaText_IOInteger_IO Integer My_Fixed_Point_Type  01  10  10 My_Decimal_Type  001  10 T_IOPut "Radix of Float type           = " I_IOPut Float T_IONew_Line T_IOPut "Radix of My_Fixed_Point_Type  = " I_IOPut My_Fixed_Point_Type T_IONew_Line T_IOPut "Radix of My_Decimal_Type type = " I_IOPut My_Decimal_Type T_IONew_Line Machine_Radix

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

Radix of Float type           =           2 Radix of My_Fixed_Point_Type  =           2 Radix of My_Decimal_Type type =           2

Wikibook

 * Ada Programming
 * Ada Programming/Attributes
 * Ada Programming/Attributes/'Machine_Emax
 * Ada Programming/Attributes/'Machine_Emin
 * Ada Programming/Attributes/'Machine_Mantissa

Ada Reference Manual


|Address Address