Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
SOLVED-Divison of two numbers
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Extended Module Player
by
Gigatron
[
Today
at 05:32:06 pm]
CONCAT formula
by
wp
[
Today
at 05:27:43 pm]
could Ardour's YTK be use...
by
robert rozee
[
Today
at 05:27:15 pm]
CryptoLib4Pascal
by
jamie
[
Today
at 05:25:35 pm]
[AGGPas] Difference betwe...
by
Roland57
[
Today
at 04:36:02 pm]
GTK3 : Icons have borders...
by
cdbc
[
Today
at 04:05:27 pm]
Getting results from sql ...
by
CraigC
[
Today
at 03:44:57 pm]
Hello! Anything new?
by
marcov
[
Today
at 03:29:02 pm]
Questions about TFuncSeri...
by
wp
[
Today
at 03:05:31 pm]
declaring Array
by
Thaddy
[
Today
at 01:24:11 pm]
Problem with drawing orde...
by
wp
[
Today
at 11:32:56 am]
TChart: Wrong default val...
by
wp
[
Today
at 11:30:54 am]
Text Fill (Memo)
by
paweld
[
Today
at 09:09:13 am]
Qt6/Wayland clipboard: pa...
by
AlexTP
[
Today
at 08:56:58 am]
Pocketbase
by
PierceNg
[
Today
at 06:29:04 am]
ADUG Symposium 2026
by
Mathias Burbach
[
Today
at 04:45:57 am]
Any way to "embed" Window...
by
jamie
[
Today
at 12:55:37 am]
DataPort StopBits and Flo...
by
Thaddy
[March 13, 2026, 02:14:16 pm]
Lazarus Bugfix Release 4....
by
JuhaManninen
[March 13, 2026, 10:05:03 am]
88 year D. Knuth changes ...
by
Thaddy
[March 13, 2026, 07:31:38 am]
interface and GUID someth...
by
egsuh
[March 13, 2026, 03:31:00 am]
CADSys4 3D.
by
maurog
[March 13, 2026, 01:00:05 am]
UOS - pre-compiled librar...
by
Fred vS
[March 13, 2026, 12:34:06 am]
Pipewire API
by
Fred vS
[March 12, 2026, 10:11:02 pm]
TSplitter color property ...
by
valdir.marcos
[March 12, 2026, 09:20:11 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: SOLVED-Divison of two numbers (Read 2761 times)
wjackson153
Sr. Member
Posts: 267
SOLVED-Divison of two numbers
«
on:
December 16, 2012, 02:56:21 am »
Ok this is my problem
var
sizeMB: Integer;
lblSize.caption := fileSize('/home/technet/somFile'); // Size of file in bytes reported to 1146 in this case
ok so now i have the files size
sizeMB := StrToInt('1146') Div 1024; // Devide file size by 1024
sizeMB := 1 // I need it to = 1.119140625 just like if you was to devide those figures on a calculator
I have also tried
sizeMB := sizeMB / 1024;
how can I achieve the results I need
Im sure this is a simple process but everything i have tried is not working for me can some one point me in the right direction.
«
Last Edit: December 16, 2012, 03:34:03 am by wjackson153
»
Logged
Lazarus 1.1 r39490 CT FPC 2.7.1 i386-linux KDE
Linux Mint 14 KDE 4
Carver413
Full Member
Posts: 119
Re: Divison of two numbers
«
Reply #1 on:
December 16, 2012, 03:12:42 am »
sizeMB must be a float not an integer
sizeMB:Single;
sizeMB := StrToInt('1146') / 1024;
Logged
wjackson153
Sr. Member
Posts: 267
Re: Divison of two numbers
«
Reply #2 on:
December 16, 2012, 03:31:23 am »
lblStatus.caption := IntToStr(filesize('/home/technet/Desktop/StartupInfo'));
sizeMB := StrToInt('1146') / 1024;
lblStatus.Caption := IntToStr(sizeMB); // How can i get sizeMB into labels caption,
is there a sngToStr function lol
Logged
Lazarus 1.1 r39490 CT FPC 2.7.1 i386-linux KDE
Linux Mint 14 KDE 4
wjackson153
Sr. Member
Posts: 267
Re: SOLVED-Divison of two numbers
«
Reply #3 on:
December 16, 2012, 03:35:25 am »
Nevermind I figured it out
since single is a float type, it dawned on me i seen a floattostr()
I tried that and it worked
thanks for for pointing me in the right direction
Logged
Lazarus 1.1 r39490 CT FPC 2.7.1 i386-linux KDE
Linux Mint 14 KDE 4
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
SOLVED-Divison of two numbers
TinyPortal
© 2005-2018