| | |
restricting decimal places on floating point values
Thread Solved
![]() |
•
•
Join Date: Jul 2009
Posts: 17
Reputation:
Solved Threads: 0
hi, just a quick question
can somebody please tell me how to restrict the output of the code below to 2 decimal places.
thx for the help.
can somebody please tell me how to restrict the output of the code below to 2 decimal places.
Pascal and Delphi Syntax (Toggle Plain Text)
VolumeCalc.Caption := FloatToStr(StrToFloat(EngineSizeVal.Text) / 2 / StrToFloat(CylNumVal.Text));
thx for the help.
•
•
Join Date: Jul 2009
Posts: 7
Reputation:
Solved Threads: 2
Use the Format command like this:
Sub Xero
Pascal and Delphi Syntax (Toggle Plain Text)
VolumeCalc.Caption := Format('%.2f',[StrToFloat(EngineSizeVal.Text) / 2 / StrToFloat(CylNumVal.Text)]);
Sub Xero
Last edited by Sub Xero; Jul 5th, 2009 at 4:27 pm.
•
•
Join Date: Jul 2009
Posts: 17
Reputation:
Solved Threads: 0
i have just changed my Label to a EditBox.. and the above code doesnt seem to work at all, just wondering how to limit an edit box to 2 decimal places.
Pascal and Delphi Syntax (Toggle Plain Text)
VolumeCalc.Text := FloatToStr(StrToFloat(EngineSizeVal.Text) / 2 / StrToFloat(CylNumVal.Text));
![]() |
Similar Threads
- Floating Point Exception Using Hash Tables (C++)
- How to copy floating point values from text file to array (C)
- How to compare floating point values (VB.NET)
- how to read a binary file holding floating-point values (VB.NET)
- Diplaying floating point values (Java)
- school's back, and so am i :D (C++)
- floating point : overflow error (C)
- Floating point numbers (C++)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: Could you tell me what's wrong of my answer?
- Next Thread: Could you tell me how can I do this question?
| Thread Tools | Search this Thread |





