Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Significant Digits - Extended Data Type?

Status
Not open for further replies.

UKChris

Programmer
Jul 2, 2001
5
0
0
US
My number seems to be truncating, is Extended the data type with the greatest range? Int he following code:

procedure TForm1.Button2Click(Sender: TObject);
var a : extended;
begin
a := 1.123456789123456789;
showmessage(floattostr(a));
end;

The Message shows as 1.12345678912346 seems it only deals with 16 digits. Can I increase this? I really need 20, or more digits.

Chris.
 
With help from elsewhere it seems this does it for me:

showmessage(floattostrF(a,ffGeneral,18,18));

Lucky that 18 digits will do it for my app!

Chris.
 
I think you can also use formatfloat, with the format specifier #.###################

FormatFloat('#.###################',a)

Or you can use zeros instead of #'s to force it to show the decimal places even if they are zero.

TealWren
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top