Mega Code Archive

 
Categories / Delphi / Types
 

Extended - the floating point type with the highest capacity and precision

Description The Extended type is a floating point type used when the highest exponent and/or significant digits are required. It supports approximately 19 digits of precision in a range from 3.37 x 10-4932 to 1.18 x 104932. Notes The Single type is the smallest and fastest, but with worst capacity and precision. The Double type has medium storage, speed, capacity and performance. A Extended set to its highest value is treated as Infinity. Related commands Currency A floating point type with 4 decimals used for financial values Double A floating point type supporting about 15 digits of precision PExtended Pointer to a Extended floating point value Single The smallest capacity and precision floating point type Example code : Showing the precision and capacity of Extended values var account1, account2, account3, account4 : Extended; begin account1 := 0.1234567890123456789; // 20 decimal places account2 := 3.37E-4932; // Lowest exponent value account3 := 1.18E4932; // Highest exponent value account4 := 1.19E4932; // Treated as infinite ShowMessage('Account1 = '+FloatToStrF(account1, ffGeneral, 22, 20)); ShowMessage('Account2 = '+FloatToStr(account2)); ShowMessage('Account3 = '+FloatToStr(account3)); ShowMessage('Account4 = '+FloatToStr(account4)); end; Show full unit code Account1 = 0.123456789012345679 Account2 = 3.37E-4932 Account3 = 1.18E4932 Account4 = INF