Delphi Basic : Double Type : Other
 

Forum :: Other :: Delphi Basic : Double Type

Example code : Showing the precision and capacity of Double values
var
  account1, account2, account3, account4 : Double;
begin
  account1 := 0.1234567890123456789;      // 20 decimal places
  account2 := 1.234567890123456789E308;   // Highest exponent value
  account3 := account1 + account2;
  account4 := 9.9E308;                    // Treated as infinite

  ShowMessage('Account1 = '+FloatToStr(account1));
  ShowMessage('Account2 = '+FloatToStr(account2));
  ShowMessage('Account3 = '+FloatToStr(account3));
  ShowMessage('Account4 = '+FloatToStr(account4));
end;

Show full unit code
   Account1 = 0.123456789012346
   Account2 = 1.23456789012346E308
   Account3 = 1.23456789012346E308
   Account4 = INF

0 Comment

  • Have no comment.

Comment Forum

 
 
 
Share This Topic Login with Facebook