Div Decimals?

Please discuss general Delphi programming topics here.

Div Decimals?

Postby fmwyso » November 30th, 2007, 5:50 pm

Using math with decimals? Hey, i was wondering if there was an easy solution i could do in order to use decimals in math. Example, 1.2 div 1.5.

I tried integers but they don't hold the decimal value, and floats can't do div. Is there a workaround for this?
fmwyso
Active Member
Active Member
 
Posts: 12
Joined: October 15th, 2007, 5:33 pm

Postby Kambiz » December 1st, 2007, 3:14 am

use / operator instead of div operator.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby fmwyso » December 1st, 2007, 5:39 am

I feel like a moron X.X. I tried that with integers and it didn't work, didn't figure it would with floats ><. Thanks man.
fmwyso
Active Member
Active Member
 
Posts: 12
Joined: October 15th, 2007, 5:33 pm

Postby Johnny_Bit » December 1st, 2007, 11:57 am

and that's why Delphi sucks. people do sometimes feel like morons.
Thou shalt write the code, not connect the bricks.
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby fmwyso » December 1st, 2007, 3:09 pm

Hey, my project i'm working on has several different floats, variables and strings/integers. Is there an easy line of code to just free all the memory. I remember seeing it once in a source code i saw, but i don't remember what it was.
fmwyso
Active Member
Active Member
 
Posts: 12
Joined: October 15th, 2007, 5:33 pm

Postby Kambiz » December 1st, 2007, 4:11 pm

For these kinds of data types you don't need to free memory.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby fmwyso » December 1st, 2007, 6:26 pm

I got 2 questions... I want to save a .ini but to the spot the .exe is located in and not to Windows Directory. How do i get the current spot the .exe is located in? I mean because it can do that easily with saving .txt.

And secondly, can i save a memo's lines to a .ini and retrieve it/place it in a memo later?

-- Thanks again :D.
fmwyso
Active Member
Active Member
 
Posts: 12
Joined: October 15th, 2007, 5:33 pm

Postby Kambiz » December 2nd, 2007, 12:51 am

1. Use full path of the ini file. Without the path, it will be considered in Windows directory.
2. No.

Please create new topic for new questions.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 9 guests

cron