On Wed, Aug 08, 2001 at 07:18:26PM +1000, ReDucTor wrote:
> if you use
> echo (float)((8.85-8)*100);
> it works because 8.85 go's to 0.85 and times that by 100, and you get 85
> which is what you get...
Maybe you've heard about dynamic pages and stuff...
Say:
$a = 8.85;
$b = 8;
$c = 100;
$result = (int)(($a-$b)*$c);
And you know... we need an integer. Let's say for inserting into a
db or so. Then it doesn't help converting it to float, does it? I
mean... ofcourse in the above example it returns the correct result,
but let's just change it a bit:
$a = 8.8512;
$b = 7.1237;
$c = 100;
$result_i = (int)(($a-$b)*$c);
$result_f = (float)(($a-$b)*$c);
See the diff between $result_i and $result_f? And if you realy need
an integer, $result_f isn't realy what you're looking for.
--
* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»»
-- Renze Munnik
-- DataLink BV
--
-- E: [EMAIL PROTECTED]
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
-- H: +31 23 5516190
--
-- Stationsplein 82
-- 2011 LM HAARLEM
--
-- http://www.datalink.nl
-- ««««««««««««««««««««««««
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]