You are here: float to integer convertion « PHP Programming Language « IT news, forums, messages
float to integer convertion

Posted by iulian.ilea on 09/21/06 07:18

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,",",".");
}
______

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация