# Extract the decimals from a float.

How can I extract the decimals and the other part of a float?

for example if I have

40011.9786

and want them in 2 variables.

a = 40011
b = 9786

how can I do that?
LVL 2
###### Who is Participating?

Commented:
1. assign value to an integer variable
2. assign expression (value - (1)VARIABLEvalue) to a real variable, where (1)VARIABLEvalue is the integer variable used in step 1.
0

Commented:
Try

Int() and Frac()

Frac gives You 0.9786 If You want to it to be an Integer value You must know how many decimals You vant. Example

I = Int(Frac(X)*10000) // gives an integer betveen 0 and 9999.

bullen
0

Commented:
a := Int(40011.9786);
b := Frac(40011.9786);
0

Commented:
ooops... too late :)
0

Commented:
too late, too :-))
0

Commented:
This question was "pounced upon" wasn't it.  So many answers, just waiting for a question.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.