# 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?

[Webinar] Streamline your web hosting managementRegister Today

x

Commented:
hi Eftodi,

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

meikl
0

Author Commented:
Edited text of question.
0

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