# float to integer convertion

#### Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

•  Subject
• Author
• Posted on
I have this functions,  c3 and c2 that computes and return a float
number. The problem is that wen I pass the result of c2 (float number)
to c3(), in function apears to be an integer. Ex.:
\$calc2=c2(params); (float number)
\$calc3=c3(\$calc2); (\$calc2 - float number)
echo \$calc3; (is not the number that supposed to be, because c4
computes \$calc2 as if it were an integer: if \$calc=39.96 it wil be
converted in 39).

What is the problem? I really can't see it.

_____

function c2(\$j,\$n)
{
//=(J54*100)/N47
\$c=\$j*100/\$n;
return number_format(\$c,2,",",".");
}

function c3(\$calc)
{
//=((16*M54)/100)+4
\$c=((16*\$calc)/100)+4;
return number_format(\$calc,2,",",".");
}
______

## Re: float to integer convertion

iulian.ilea wrote:

\$c=((16*\$calc)/100)+4; --> \$c variable never been used

return number_format(\$calc,2,",",".");  --> it will format the input
number \$calc

---
http://www.groupvita.com
http://www.deshot.com