Hi,
i need an alternative function which does the same as bcmul(). Please help me.
greetz
Ryu
alternative bcmul()
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Why?
Code: Select all
function bcmul_alternative($n, $m, $dec=0) {
$value = $n * $m;
if ($dec) {
$value = round($value, $dec);
}
return $value;
}- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Well from what I read about bcmul() it just multiplies two floats and optionally rounds to X decimal places.
That's what the above does. The third paramter is optional but if given it will round to that many places. Unless I misunderstand what the function is for?
That's what the above does. The third paramter is optional but if given it will round to that many places. Unless I misunderstand what the function is for?
If you want bcmul, you want bcmul, if he wouldn't need it he would just use the multiplicator sign (or did he missunderstand the meaning of bcmul?).
bcmul btw is used for arbitrary precision mathematics, meaning that you can do calculations with virtually any number, something you CAN'T do with $n * $m, as the precision for that is about 10 digits (roughly said) if I'm not mistkaken.
I don't know, perhaps "gmp_" can do this, but it's likelt not available.
bcmul btw is used for arbitrary precision mathematics, meaning that you can do calculations with virtually any number, something you CAN'T do with $n * $m, as the precision for that is about 10 digits (roughly said) if I'm not mistkaken.
I don't know, perhaps "gmp_" can do this, but it's likelt not available.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia