Delphi Chart With 2 Decimal Places

Delphi Chart With 2 Decimal Places Average ratng: 5,6/10 6962 votes

I have to selected some column data from a database table and make this data with two decimal places only. I see this

Free coins solitaire grand harvest

What is that #9?
How can I deal with the data I selected to make it only keep two decimal places?
I am very new to Delphi.
Thanks!

Marco

Mar 01, 2017  Retain 2 decimal points on float when converting to string delphi. Browse other questions tagged string delphi decimal or ask your own question. 2 years, 3 months ago. 2 years, 3 months ago. Difference between decimal, float and double in.NET?

47.4k11 gold badges111 silver badges134 bronze badges
spsplispspli
1,3756 gold badges36 silver badges67 bronze badges

5 Answers

#9 is the character with code 9, TAB.

If you want to convert a floating point value to a string with 2 decimal places you use one of the formatting functions, e.g. Format():

David HeffernanDavid Heffernan
529k35 gold badges866 silver badges1260 bronze badges

#9 is the tab character.

If f is a floating-point variable, you can do FormatFloat('#.##', f) to obtain a string representation of f with no more than 2 decimals.

Andreas RejbrandDelphi Chart With 2 Decimal PlacesAndreas Rejbrand
74.2k6 gold badges220 silver badges310 bronze badges

The internal float format routines only work with simple numbers > 1

You need to do something more complicated for a general purpose decimal place limiter that works correctly on both fixed point and values < 1 with scientific notation.

Delphi Chart With 2 Decimal Places

I use this routine

So, with digits=2, 1.2349 rounds to 1.23 and 1.2349E-17 rounds to 1.23E-17

Andy kAndy k
5631 gold badge6 silver badges18 bronze badges

Delphi Chart With 2 Decimal Places Free

Brian Tompsett - 汤莱恩
4,38214 gold badges40 silver badges107 bronze badges
RTSRTS
amytrajghimireamytrajghimire

2 Decimal Places

Not the answer you're looking for? Browse other questions tagged delphidecimal or ask your own question.

Posted on