kvz/phpjs — Issue #23: bcscale not preserved
Author: rbro
Created: 2011-11-01 02:39:52+00:00
State: open

I'm seeing an issue where the bcscale is not preserved when using the bcmath functions. The following JS code should alert "0.33333", but it alerts "0" instead:

bcscale(5);
alert(bcdiv(1, 3));

It looks like it's occurring because each call to bcdiv calls this._phpjs_shared_bc() which returns a new libbcmath object each time.

This issue does not exist in the project https://sourceforge.net/projects/bcmath-js because libbcmath is a global object there.

Is there a way to preserve the bcscale() call with the way that php.js is including the libbcmath library?