Re: note 9309 added to bcmul
| From: | J. M. Castagnetto | Date: | Thu, 26 Oct 2000 22:25:15 +0000 |
| Subject: | Re: note 9309 added to bcmul | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7057@lists.php.net to get a copy of this message | ||
I added the following editor's note to your comment:
[Editor's note: It is not that the parameter is not
optional, but that when using the bc* functions, you
should defined the scale beforehand using bcscale(),
e.g. in the example below you should use "bcscale(3);"
before you use bcmul/bcdiv/etc.]
--- chris.key@wcom.com wrote:
> bcmul optional scale parameter is not optional.
> Given the following code:
>
> echo "A: ".(2900000 / 500)."\n";
> echo "C: ".bcdiv( (290000 / 500), 290000, 5). "\n";
> echo "K: ".bcmul( bcdiv( (290000 / 500), 290000, 5),
> 290000,3)."\n";
> echo "ACK: ". bcmul( bcdiv( (290000 / 500), 290000,
> 5), 2900000);
>
> Should yield:
> A: 646.654
> C: 0.00200
> K: 646.654
> ACK: 646
>
> But instead gives:
> A: 646.654
> C: 0.00200
> K: 646.654
> ACK: 0
>
> Even if there is an integer portion of the result,
> it will return 0 unless the scale parameter is set
> to the number of non-zero digits after the decimal.
>
> http://www.php.net/manual/function.bcmul.php
>
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-notes-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-notes-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
=====
--- Jesus M. Castagnetto (jcastagnetto@yahoo.com)
__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf! It's FREE.
http://im.yahoo.com/