# division not returnig float

MorgoZ
Junior MemberPosts:

**116**
Hi,

I don't know why this operation returns an integer value and not a float:

The last line returns "0" when it should be "0.3". Does enyone can explain why is it being rounded to an integer?

Note: "real" comes from a level value

Thanks!

I don't know why this operation returns an integer value and not a float:

```
DEFINE_FUNCTION char[10] DbsIORealToFake(char cTipoIO, float real)
{
stack_var float fAux
integer nAux, nAuxTp, nAuxFake
nAuxTp = MAX_LEVEL_TP - MIN_LEVEL_TP
if(real > MAX_LEVEL_TP)
real = MAX_LEVEL_TP
if(real < MIN_LEVEL_TP)
real = MIN_LEVEL_TP
fAux = (real - MIN_LEVEL_TP) / nAuxTp
send_string 5001:0:0,"'fAux ',ftoa(fAux)"
}
```

The last line returns "0" when it should be "0.3". Does enyone can explain why is it being rounded to an integer?

Note: "real" comes from a level value

Thanks!

0

## Comments

8Now you have float = (float - float) / float which should return a float type. I have also heard, but not tried, that simply adding and then subtracting 0.1 to the equation will cause the compiler to return a float as follows:

70e.g.

At the end of the function you need:

RETURN ftoa(fAux)

Then char[10] will be something else, it will be nothing

116Thank you both!