# Operations

I want to write code for :
1-square of a number
2-square root of a number
3-multiplication and division with decimals
Thanks
Dragos
I use Delphi 4 pro
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Author Commented:
Edited text of question.
0
Commented:
hi Eftodi,

1-square of a number -> SQR
2-square root of a number -> SQRT
3-multiplication and division with decimals -> * /

meikl
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Commented:
hi again Eftodi,

some samples

1-square of a number -> SQR -> SQR(4) -> 16
X := SQR(4); //X=16

2-square root of a number -> SQRT -> SQRT(16) -> 4
X := SQRT(16); //X=4

3-multiplication and division with decimals -> * / > 1.2*1.2 = 1.44; 2.4 / 1.2 = 2;
X := 1.2*1.2; //X=1.44
X := 2.4 / 1.2; //X := 2;

meikl
0
Author Commented:
The problem it is NOT solved
Declarations of :
Var
- for decimals numbers for example
......
Thanks anyway
Dragos
0
Commented:
hi Eftodi,

well, vartypes, which can hold decimals

var
X : Extended; or
X : Single; or
X : Double; or
X : Currency; or
X : Real;  //Maybe this is not supported by D4 -> Type Real48;

meikl
0
Author Commented:
Hi
For example :
a=-b/2-sqrt((sqr(b/2)-c)
I have some problem with the declaration of:
Var
Thanks
Dragos
0
Commented:
hi dragos,

a must be a type from above
b and c can be integer if no decimals, otherwise dito

sqr & sqrt returns a type extended, but will automatically transformed
to a double if a for example a type double.

meikl
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.