num=5/2;

ans="{num,numberformat,0.0}";

//I want 2.5 as answer ,but returned value is 2.0

//Teach me how to get 2.5 ,please.

## how to get 2.5 from 5/2

**Moderator:** Martin

### Re: how to get 2.5 from 5/2

Hello Suda!

Make a point behind the divisor:

Peter

Make a point behind the divisor:

regardsnum=5/2.;

Peter

### Re: how to get 2.5 from 5/2

Soon answer, Thank you!

I could get 2.5.

5/2. is Hidden function?

Recently i found "old_global_....."!

I think this function is good.

I could get 2.5.

5/2. is Hidden function?

Recently i found "old_global_....."!

I think this function is good.

### Re: how to get 2.5 from 5/2

Hello Suda!

I am myself desperate at this "problem"! An official documentation or help is not known to me.

After a long search I found this post: http://automagic4android.com/forum/view ... oint#p8246

regards

Peter

I am myself desperate at this "problem"! An official documentation or help is not known to me.

After a long search I found this post: http://automagic4android.com/forum/view ... oint#p8246

regards

Peter

### Re: how to get 2.5 from 5/2

Certainly, Strange...

"5/2 is 2.5" is simply than "5/2 is 2".

I think so.

For a long search, thank you.

"5/2 is 2.5" is simply than "5/2 is 2".

I think so.

For a long search, thank you.

### Re: how to get 2.5 from 5/2

The problem is that if you divide using integers it asumes that the output will be an integer so it deletes the decimals. If you add a '.' or '.0' after at least one of the numbers, it predicts the result as a float and you get the decimals

Edit: if you were using variables (or if you want to) I think you can just put "(float)" in front of one of the parts of the division

Edit: if you were using variables (or if you want to) I think you can just put "(float)" in front of one of the parts of the division

### Re: how to get 2.5 from 5/2

Thank you!

In short, for example, when dividing, if you want decimal values, add ". 0" somewhere in the calculation formula. Is that it? It is okay.

I am using google translator. It became easy.

In short, for example, when dividing, if you want decimal values, add ". 0" somewhere in the calculation formula. Is that it? It is okay.

I am using google translator. It became easy.