Ada 程式設計/屬性/'Machine Emax
外觀
X'Machine_Emax 是一個 Ada 屬性,其中 X 是任何浮點型別。
浮點型別表示為
其中
- sign 是 1 或 -1
- mantissa 是以基數為基數的分數
- radix 是硬體基數(通常為 2)
- exponent 是一個整數
'Machine_Emax 返回最大指數。
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'Machine_Emax); T_IO.New_Line; T_IO.Put ("Emax of Long_Float type = "); I_IO.Put (Long_Float'Machine_Emax); T_IO.New_Line;endMachine_Emax;
在 x86-64 架構上使用 GNAT 4.6 的輸出為
Emax of Float type = 128 Emax of Long_Float type = 1024
- Ada 程式設計
- Ada 程式設計/屬性
- Ada 程式設計/屬性/'Machine_Emin
- Ada 程式設計/屬性/'Machine_Mantissa
- Ada 程式設計/屬性/'Machine_Radix
- 5.3 浮點型別的屬性 (註釋)
- 附錄 K 語言定義的屬性 (註釋)
